美文网首页
Neutron的Floating ip实现原理

Neutron的Floating ip实现原理

作者: JohnLee1100 | 来源:发表于2017-08-20 16:28 被阅读0次

    http://www.cnblogs.com/sammyliu/p/4636091.html

    本机实验

    查看虚拟路由所在的namespace中的ip地址。

    [root@network01 home]# ip netns exec qrouter-ddc9e259-57d6-4965-b0aa-89b139a64c04 ip addr
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    10: qr-2666afbd-02: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
        link/ether fa:16:3e:6a:65:69 brd ff:ff:ff:ff:ff:ff
        inet 10.0.0.1/24 brd 10.0.0.255 scope global qr-2666afbd-02
           valid_lft forever preferred_lft forever
        inet6 fe80::f816:3eff:fe6a:6569/64 scope link 
           valid_lft forever preferred_lft forever
    11: qg-d761e544-c7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000
        link/ether fa:16:3e:85:4a:fb brd ff:ff:ff:ff:ff:ff
        inet 202.95.237.56/24 brd 202.95.237.255 scope global qg-d761e544-c7
           valid_lft forever preferred_lft forever
        inet 202.95.237.53/32 brd 202.95.237.53 scope global qg-d761e544-c7
           valid_lft forever preferred_lft forever
        inet6 fe80::f816:3eff:fe85:4afb/64 scope link 
           valid_lft forever preferred_lft forever
    

    查看查看虚拟路由所在的namespace中的nat表。

    [root@network01 home]# ip netns exec qrouter-ddc9e259-57d6-4965-b0aa-89b139a64c04 iptables -S -t nat
    -P PREROUTING ACCEPT
    -P INPUT ACCEPT
    -P OUTPUT ACCEPT
    -P POSTROUTING ACCEPT
    -N neutron-l3-agent-OUTPUT
    -N neutron-l3-agent-POSTROUTING
    -N neutron-l3-agent-PREROUTING
    -N neutron-l3-agent-float-snat
    -N neutron-l3-agent-snat
    -N neutron-postrouting-bottom
    -A PREROUTING -j neutron-l3-agent-PREROUTING
    -A OUTPUT -j neutron-l3-agent-OUTPUT
    -A POSTROUTING -j neutron-l3-agent-POSTROUTING
    -A POSTROUTING -j neutron-postrouting-bottom
    -A neutron-l3-agent-OUTPUT -d 202.95.237.53/32 -j DNAT --to-destination 10.0.0.11
    -A neutron-l3-agent-POSTROUTING ! -i qg-d761e544-c7 ! -o qg-d761e544-c7 -m conntrack ! --ctstate DNAT -j ACCEPT
    -A neutron-l3-agent-PREROUTING -d 169.254.169.254/32 -i qr-+ -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 9697
    -A neutron-l3-agent-PREROUTING -d 202.95.237.53/32 -j DNAT --to-destination 10.0.0.11
    -A neutron-l3-agent-float-snat -s 10.0.0.11/32 -j SNAT --to-source 202.95.237.53
    -A neutron-l3-agent-snat -j neutron-l3-agent-float-snat
    -A neutron-l3-agent-snat -o qg-d761e544-c7 -j SNAT --to-source 202.95.237.56
    -A neutron-l3-agent-snat -m mark ! --mark 0x2/0xffff -m conntrack --ctstate DNAT -j SNAT --to-source 202.95.237.56
    -A neutron-postrouting-bottom -m comment --comment "Perform source NAT on outgoing traffic." -j neutron-l3-agent-snat
    

    此类问题处理:1,通过api的接口查信息。2,查看制定route所在的namespace和iptables。

    相关文章

      网友评论

          本文标题:Neutron的Floating ip实现原理

          本文链接:https://www.haomeiwen.com/subject/anvfdxtx.html