我创建了大约10个节点的DevStack安装,以了解有关OpenStack如何管理网络的更多信息。我创建了一些VMS,并在一些主机上验证了它们,如下所示:
virsh # list
Id Name State
----------------------------------------------------
2 instance-0000001b running
3 instance-0000001f running
4 instance-00000024 running
5 instance-0000002c running
我已经将一个浮动IP与实例id 2相关联,我通过查看其openstack id并与virsh-dumpxml2的输出相匹配来验证它。具有以下浮动IP:172.16.6.12和本地IP:10.4.128.11
我看到它使用vnet0:
<interface type='bridge'>
<mac address='fa:16:3e:a1:f8:65'/>
<source bridge='br100'/>
<target dev='vnet0'/>
<model type='virtio'/>
<filterref filter='nova-instance-instance-0000001b-fa163ea1f865'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
执行ifconfig vnet0时,它不显示IP地址:
vnet0 Link encap:Ethernet HWaddr fe:16:3e:a1:f8:65
inet6 addr: fe80::fc16:3eff:fea1:f865/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:70 errors:0 dropped:0 overruns:0 frame:0
TX packets:44216 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:7232 (7.2 KB) TX bytes:29123311 (29.1 MB)
当我执行ip addr
时,我看到在桥中定义了IP地址br100
。
4: br100: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether d8:50:e6:c3:22:ee brd ff:ff:ff:ff:ff:ff
inet 10.4.128.13/20 brd 10.4.143.255 scope global br100
valid_lft forever preferred_lft forever
inet 172.16.0.101/21 brd 172.16.7.255 scope global br100
valid_lft forever preferred_lft forever
inet 172.16.6.12/32 scope global br100
valid_lft forever preferred_lft forever
inet 172.16.6.19/32 scope global br100
valid_lft forever preferred_lft forever
inet6 fe80::80b6:99ff:fef7:dc16/64 scope link
valid_lft forever preferred_lft forever
5: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br100 state UNKNOWN group default qlen 500
link/ether fe:16:3e:a1:f8:65 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc16:3eff:fea1:f865/64 scope link
valid_lft forever preferred_lft forever
- 172.16.0.101/21:主机IP
- 172.16.6.12/32:虚拟机浮动IP
但是,vnet0-->172.16.6.12(浮动IP)的关联在哪里?为什么进入172.16.6.19的流量没有进入172.16.6.12,
我查找了iptables规则,但没有任何内容表明vnet0或浮动ip。这是怎么做到的?我看到它们与brctl桥接,但我看不到IP-MAC关联。它甚至不在arp表中。我研究了iptables或侦听端口,如果任何转发都是用户空间,但不是。
bridge name bridge id STP enabled interfaces
br100 8000.d850e6c322ee no eth0
vnet0
vnet1
vnet2
vnet3
好的,我找到了。我忘了看iptables NAT规则,它用来将给定的浮动ip转发到那个veth设备。