我创建了大约 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 dumpxml 2 的输出匹配来验证它。它具有以下浮动 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:VM 浮动 IP
但是,vnet0 --> 172.16.6.12 (floating 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