问题: eth2 设备无ip
root@pri1-nova295-yq-163-org-freedom-1297:~# ip a
1: lo: mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: mtu 1400 qdisc pfifo_fast state UP qlen 1000
link/ether fa:16:3e:ca:25:e8 brd ff:ff:ff:ff:ff:ff
inet 10.171.162.28/20 brd 10.171.175.255 scope global eth0
inet6 fe80::f816:3eff:feca:25e8/64 scope link
valid_lft forever preferred_lft forever
3: eth1: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether fa:16:3e:4d:0f:1c brd ff:ff:ff:ff:ff:ff
inet 10.172.99.224/26 brd 10.172.99.255 scope global eth1
inet6 fe80::f816:3eff:fe4d:f1c/64 scope link
valid_lft forever preferred_lft forever
4: eth2: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether fa:16:3e:05:62:4a brd ff:ff:ff:ff:ff:ff
inet6 fe80::f816:3eff:fe05:624a/64 scope link
valid_lft forever preferred_lft forever
root@pri1-nova295-yq-163-org-freedom-1297:~#
可以先在云主机内自行 dhclient -v eth2试着获取ip
还是不能解决。
试着排查
qa@ca826:~/IaaS_Regression_Testing/source$ nova interface-list 1b04648c-c08d-4d20-b6ca-ea1918755a82
+------------+--------------------------------------+--------------------------------------+---------------+-------------------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+--------------------------------------+--------------------------------------+---------------+-------------------+
| ACTIVE | 208fa1d6-1e3a-4655-b0c8-1b0bbb366c9a | fcfeb227-2c99-4e32-9609-95998aafaf07 | 59.111.30.170 | fa:16:3e:05:62:4a |
| ACTIVE | 70a003b0-3983-4164-a58a-647c2f0997b1 | 885356b0-905f-4fa9-888e-1416e958888f | 10.171.162.28 | fa:16:3e:ca:25:e8 |
| ACTIVE | d13735c5-ca5b-4c6a-9046-28bff5a6e642 | 6ff8b62b-4fed-4c67-940e-15a586f553a5 | 10.172.99.224 | fa:16:3e:4d:0f:1c |
+------------+--------------------------------------+--------------------------------------+---------------+-------------------+
查看这个云主机所在的物理节点
qa@ca826:~/IaaS_Regression_Testing$ nova show 1b04648c-c08d-4d20-b6ca-ea1918755a82
+--------------------------------------------------+----------------------------------------------------------------+
| Property | Value |
+--------------------------------------------------+----------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | yiqiao1.music1 |
| OS-EXT-SRV-ATTR:host | pri1-nova295.yq.163.org |
| OS-EXT-SRV-ATTR:hypervisor_hostname | pri1-nova295.yq.163.org |
| OS-EXT-SRV-ATTR:instance_name | instance-0004d80d |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2017-03-30T01:57:54.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| availability_zone | yiqiao1.music1 |
| config_drive | 1 |
| created | 2017-03-30T01:57:34Z |
| flavor | flavor_1 (1) |
| hostId | 88754d7b28b0ec172eb1aba61abcf866e3eb9cc894969cf085c000b2 |
| hypervisor_type | qemu |
| id | 1b04648c-c08d-4d20-b6ca-ea1918755a82 |
| idc_e52c62f6a5334806b6bac162eb3f7a42 network | 10.172.99.224 |
| image | debian_7_x86_64_pri.raw (9a60713c-204f-4797-b5b4-2330e47fafc9) |
| key_name | IaaScheck |
| metadata | {} |
| name | pri1-nova295-yq-163-org-freedom-1297 |
| os-extended-volumes:volumes_attached | [] |
| os-netease-extended-volumes:volumes_attached | [] |
| os-server-status | up |
| os_type | linux |
| private_e52c62f6a5334806b6bac162eb3f7a42 network | 10.171.162.28 |
| progress | 0 |
| public_admin network | 59.111.30.170 |
| security_groups | default |
| status | ACTIVE |
| tenant_id | e52c62f6a5334806b6bac162eb3f7a42 |
| updated | 2017-03-30T01:57:54Z |
| use_ceph | yes |
| user_id | f04ca6a1295740cc974769601c54b668 |
+--------------------------------------------------+----------------------------------------------------------------+
这里是用云网络联调做一下实验。原理一样的
hzhuangzhexiao@10-180-0-37:~$ nova show f755c788-64a8-40e7-9e33-70bed6709fb7
+--------------------------------------------------+----------------------------------------------------------------+
| Property | Value |
+--------------------------------------------------+----------------------------------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-AZ:availability_zone | zw.netbeta1 |
| OS-EXT-SRV-ATTR:host | 10-180-0-37 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | 10-180-0-37 |
| OS-EXT-SRV-ATTR:instance_name | instance-000ac3a0 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-STS:task_state | - |
| OS-EXT-STS:vm_state | active |
| OS-SRV-USG:launched_at | 2017-02-16T06:55:42.000000 |
| OS-SRV-USG:terminated_at | - |
| accessIPv4 | |
| accessIPv6 | |
| availability_zone | zw.netbeta1 |
| config_drive | 1 |
| created | 2016-12-20T06:54:34Z |
| flavor | flavor_85 (85) |
| hostId | 0e225977a1045489747c0b643058ba9489f6d9e3679b423757a5e31c |
| hypervisor_type | qemu |
| id | f755c788-64a8-40e7-9e33-70bed6709fb7 |
| image | debian_7_x86_64_pri.raw (009b381e-f42e-42d5-a227-8fc032e6b5c8) |
| key_name | luozewen |
| metadata | {} |
| name | nbs-management |
| os-extended-volumes:volumes_attached | [] |
| os-netease-extended-volumes:volumes_attached | [] |
| os-server-status | up |
| os_type | linux |
| private_5b54a7e1084b465780c0b8db5b0cca26 network | 10.180.65.243 |
| progress | 0 |
| public_admin_zw network | 115.236.127.178 |
| security_groups | default |
| status | ACTIVE |
| tenant_id | 5b54a7e1084b465780c0b8db5b0cca26 |
| updated | 2017-02-27T11:55:07Z |
| use_ceph | yes |
| user_id | 7579c1456aea4178a97ab642375d1ee2 |
| vncPass | 000000 |
+--------------------------------------------------+----------------------------------------------------------------+
hzhuangzhexiao@10-180-0-37:~$ nova interface-list f755c788-64a8-40e7-9e33-70bed6709fb7
+------------+--------------------------------------+--------------------------------------+-----------------+-------------------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+--------------------------------------+--------------------------------------+-----------------+-------------------+
| ACTIVE | 0b89bc22-90e1-4005-a5ac-cb84b2c89a0e | c5c58a7a-477f-4949-a2ec-acb057e5d0ab | 10.180.65.243 | fa:16:3e:2f:8b:cf |
| ACTIVE | 2bf57e70-3c8c-429c-ae2e-450662b066f4 | dae73933-9e60-4ad7-b48c-046aca96343f | 115.236.127.178 | fa:16:3e:81:ae:3f |
+------------+--------------------------------------+--------------------------------------+-----------------+-------------------+
hzhuangzhexiao@10-180-0-37:~$
hzhuangzhexiao@10-180-0-37:~$ neutron port-show 2bf57e70-3c8c-429c-ae2e-450662b066f4
+-----------------------+----------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+----------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:capabilities | {"port_filter": true} |
| binding:host_id | 10-180-0-37 |
| binding:profile | {"nova_no_clean": true} |
| binding:vif_type | ovs |
| device_id | f755c788-64a8-40e7-9e33-70bed6709fb7 |
| device_owner | compute:zw.netbeta1 |
| extra_data | {"user_id": "1cd096c922064b3ba51bdc1cd076987b"} |
| extra_dhcp_opts | |
| filtered_ports | |
| fixed_ips | {"subnet_id": "3f4a0aef-73bb-4240-a4d8-187dc0d9208f", "ip_address": "115.236.127.178"} |
| id | 2bf57e70-3c8c-429c-ae2e-450662b066f4 |
| ingress_max_rate | |
| mac_address | fa:16:3e:81:ae:3f |
| max_bm_pps | |
| max_pps | |
| max_rate | |
| name | pub-zw |
| network_id | dae73933-9e60-4ad7-b48c-046aca96343f |
| parent_portid | |
| port_security_enabled | False |
| prefer_rate | |
| security_groups | |
| status | ACTIVE |
| support_azs | zw |
| tenant_id | 5b54a7e1084b465780c0b8db5b0cca26 |
+-----------------------+----------------------------------------------------------------------------------------+
知道port 之后 , 通过port设备,可以知道对应的 Interface.
hzhuangzhexiao@10-180-0-37:~$ sudo ovs-vsctl show |grep -C 10 2bf57e70
tag: 156
Interface "tapc2eb6208-1f"
type: internal
Port "tap2bf57e70-3c"
tag: 31
Interface "tap2bf57e70-3c"
Port "tap6b0f7a7f-ce"
tag: 179
列出 Interface
sudo ovs-vsctl list interface tap2bf57e70-3c
hzhuangzhexiao@10-180-0-37:~$ sudo ovs-vsctl list interface tap2bf57e70-3c |grep attached-mac
external_ids : {attached-mac="fa:16:3e:81:ae:3f", iface-id="2bf57e70-3c8c-429c-ae2e-450662b066f4", iface-status=active, vm-id="f755c788-64a8-40e7-9e33-70bed6709fb7"}
hzhuangzhexiao@10-180-0-37:~$
hzhuangzhexiao@10-180-0-37:~$ ip -s link show tap2bf57e70-3c
221: tap2bf57e70-3c: mtu 1500 qdisc htb master ovs-system state UNKNOWN mode DEFAULT group default qlen 500
link/ether fe:16:3e:81:ae:3f brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
8851335 109246 0 0 0 0
TX: bytes packets errors dropped carrier collsns
969707031 14688579 0 0 0 0
如果需要抓包的话:
找出port 对应的net
hzhuangzhexiao@10-180-0-37:~$ neutron dhcp-agent-list-hosting-net dae73933-9e60-4ad7-b48c-046aca96343f
+--------------------------------------+-------------+----------------+-------+
| id | host | admin_state_up | alive |
+--------------------------------------+-------------+----------------+-------+
| 9995f487-dd26-4034-b37b-f558ff08d2f2 | 10-180-0-38 | True | :-) |
| a65b0294-0a68-4cec-8619-7a053045bc73 | 10-180-0-37 | True | :-) |
+--------------------------------------+-------------+----------------+-------+
hzhuangzhexiao@10-180-0-37:~$ sudo ip netns exec qdhcp-dae73933-9e60-4ad7-b48c-046aca96343f ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default
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
60: tap1241c583-1f: mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether fa:16:3e:33:ef:69 brd ff:ff:ff:ff:ff:ff
inet 115.236.127.171/24 brd 115.236.127.255 scope global tap1241c583-1f
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fe33:ef69/64 scope link
valid_lft forever preferred_lft forever
这下可以在namespace 里面抓包,看各种问题
sudo ip netns exec qdhcp-dae73933-9e60-4ad7-b48c-046aca96343f tcpdump -i tap1241c583-1f -v host 115.236.127.178
============================================================
看 ml2_conf.ini
hzhuangzhexiao@10-180-0-37:~$ cat /etc/neutron/plugins/ml2/ml2_conf.ini | grep public
bridge_mapping_patterns = public:br-wan
sudo ovs-vsctl show
hzhuangzhexiao@10-180-0-37:~$ sudo ovs-vsctl show |grep br-wan
Bridge br-wan-zw
Port phy-br-wan-zw
Interface phy-br-wan-zw
options: {peer=int-br-wan-zw}
Port br-wan-zw
Interface br-wan-zw
Port int-br-wan-zw
Interface int-br-wan-zw
options: {peer=phy-br-wan-zw}
Port int-br-wan-yz
Interface int-br-wan-yz
options: {peer=phy-br-wan-yz}
Bridge br-wan-yz
Port phy-br-wan-yz
Interface phy-br-wan-yz
options: {peer=int-br-wan-yz}
Port br-wan-yz
Interface br-wan-yz
ip -s link show |grep eth2
hzhuangzhexiao@10-180-0-37:~$ ip -s link show |grep eth2
2: eth2: mtu 1500 qdisc prio state UP mode DEFAULT group default qlen 1000
20: eth2.101@eth2: mtu 1500 qdisc noqueue state UP mode DEFAULT group default
21: eth2.104@eth2: mtu 1500 qdisc noqueue master ovs-system state UP mode DEFAULT group default
22: eth2.110@eth2: mtu 1500 qdisc noqueue master ovs-system state UP mode DEFAULT group default
hzhuangzhexiao@10-180-0-37:~$
hzhuangzhexiao@10-180-0-37:~$ sudo ovs-vsctl list interface eth2.104 |grep ofport
ofport : 1
ofport_request : []
hzhuangzhexiao@10-180-0-37:~$
ofport 不应该为 -1
看对应的流量 rx tx 这个应该是看对应物理机的流量。
hzhuangzhexiao@10-180-0-37:~$ ip -s link show eth2.104
21: eth2.104@eth2: mtu 1500 qdisc noqueue master ovs-system state UP mode DEFAULT group default
link/ether ec:f4:bb:e6:31:44 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
817091270 15381530 0 0 0 113324
TX: bytes packets errors dropped carrier collsns
17222606 216169 0 0 0 0
hzhuangzhexiao@10-180-0-37:~$
sa用这个来看
cat /proc/net/dev |grep eth2