Azure Standard Load Balancer 出站规则

    上一篇中其实有谈到Azure Standard Load Balancer 有一个优点也是劣势的地方是他的出站链接,默认状况下,当VM被挂载到Standard Public Load Balancer的backend pool中时,这台VM会失去outbound到internet的能力,这可能会致使有些用户搞不清楚是为何,并且若是是Standard Internal Load Balancer,实际上是不提供outbound到internet的方案的,除非附加一个公网IP给到这台VM,因此这能够算是Standard Load Balancer的一个缺点后端


    可是另外一方面,Standard Load Balancer实际上是可让用户本身去控制outbound的规则的,若是你比较了解Azure VM的出入站规则的话,你会知道Azure实际上是有SNAT端口耗尽的问题的,Standard Load Balancer可让用户本身去配置SNAT时候的协议,端口数量,使用的IP等等,这会比以前要灵活一些frontend


    此次咱们来普及下若是在Standard Public Load Balancer backend pool中的VM,想要出站到internet,要怎么配置ide

    

    整体上来讲,有两类办法
测试

    1.配置Load Balancer rule或者NAT rule
3d

    2.手动为Load Balancer 配置outbound ruleblog


    首先咱们来看第一种
ip

    咱们如今有一台VM,这台VM是在Standard Public Load Balancer 的  Backend Pool中的,能够看到它是没办法访问internet的ci

    1.png


    

    以后尝试建立LB规则,可是create implicit outbound rule选择NOit

    2.png


    能够看到LB规则其实已经生效了
io

    3.png


    可是在VM内部,能够发现仍是没办法访问internet

    4.png


    

    接下来咱们删掉以前的规则,从新添加一次,此次create implicit outbound rule选择yes

    5.png



    能够看到此次终于可以访问了!6.png


    可是若是咱们删掉LB的rule

    7.png


    立刻就不能再访问了

    8.png


    以上是第一种方法,接下来咱们来看还有第二种方法,即便咱们没有任何LB或者NAT的规则,也能够经过直接指定outbound rule来让VM出站到Internet

    首先获取到LB

 9.png

  

    接下来就能够为LB添加规则了

    这里要注意,LB的出站规则实际上是有不少参数能够配置的,整体来讲能够分为如下这些

    "frontendIPConfigurations": [ list_of_frontend_ip_configuations ],

    "allocatedOutboundPorts": number_of_SNAT_ports, 须要是8的倍数,上限64000

    "idleTimeoutInMinutes": 4 through 66,

    "enableTcpReset": true | false,

    "protocol": "Tcp" | "Udp" | "All",

    "backendAddressPool": backend_pool_reference,

    10.png 

    配置完成后,咱们就能够更新这个LB了

    11.png


    再次测试,能够发现又能够访问internet了,可是这时候咱们并无任何LB的rule12.png


    以上就是在使用Standard Load Balancer时,若是后端的VM想要可以访问internet,咱们须要注意的地方

相关文章
相关标签/搜索