Neutron L3 Agent

每个租户对应着一个router,每个L3 Agent运行在一个network namespace中,而namespace命名为qrouter-$router-uuid,Agent主要负责router,dhcp,nat等管理工作

$ neutron router-list
+--------------------------------------+---------+-----------------------------------------------------------------------------+
| id                                   | name    | external_gateway_info                                                       |
+--------------------------------------+---------+-----------------------------------------------------------------------------+
| 41f2f732-3574-48fb-923f-7fa3b9dc6f0c | router1 | {"network_id": "8956472f-0245-4447-bafe-374287d49156", "enable_snat": true} |
+--------------------------------------+---------+-----------------------------------------------------------------------------+

namespace为qrouter-41f2f732-3574-48fb-923f-7fa3b9dc6f0c,那么就可以查看namespace的相关信息

$ sudo ip netns exec qrouter-41f2f732-3574-48fb-923f-7fa3b9dc6f0c 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
18: qr-e242edbc-aa:  mtu 1500 qdisc noqueue state UNKNOWN group default
    link/ether fa:16:3e:b0:3b:9c brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/24 brd 10.0.0.255 scope global qr-e242edbc-aa
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:feb0:3b9c/64 scope link
       valid_lft forever preferred_lft forever
19: qg-119953bc-6f:  mtu 1500 qdisc noqueue state UNKNOWN group default
    link/ether fa:16:3e:bf:4f:c3 brd ff:ff:ff:ff:ff:ff
    inet 172.24.4.226/28 brd 172.24.4.239 scope global qg-119953bc-6f
       valid_lft forever preferred_lft forever
    inet6 fe80::f816:3eff:febf:4fc3/64 scope link
       valid_lft forever preferred_lft forever

这里interface的地址都是连接router的subnet的gateway地址,比如查询下

lihui@lihui-devstack:~$ neutron port-list | grep 172.24.4.226
| 119953bc-6f9f-4616-9401-aa6f2bbce805 |      | fa:16:3e:bf:4f:c3 | {"subnet_id": "37a98a23-8025-48fc-a606-8bc1406843a6", "ip_address": "172.24.4.226"} |
lihui@lihui-devstack:~$ neutron port-show 119953bc-6f9f-4616-9401-aa6f2bbce805
+-----------------------+-------------------------------------------------------------------------------------+
| Field                 | Value                                                                               |
+-----------------------+-------------------------------------------------------------------------------------+
| admin_state_up        | True                                                                                |
| allowed_address_pairs |                                                                                     |
| binding:capabilities  | {"port_filter": false}                                                              |
| binding:host_id       | lihui-devstack                                                                   |
| binding:profile       | {}                                                                                  |
| binding:vif_type      | binding_failed                                                                      |
| device_id             | 41f2f732-3574-48fb-923f-7fa3b9dc6f0c                                                |
| device_owner          | network:router_gateway                                                              |
| extra_dhcp_opts       |                                                                                     |
| fixed_ips             | {"subnet_id": "37a98a23-8025-48fc-a606-8bc1406843a6", "ip_address": "172.24.4.226"} |
| id                    | 119953bc-6f9f-4616-9401-aa6f2bbce805                                                |
| mac_address           | fa:16:3e:bf:4f:c3                                                                   |
| name                  |                                                                                     |
| network_id            | 8956472f-0245-4447-bafe-374287d49156                                                |
| port_security_enabled |                                                                                     |
| security_groups       |                                                                                     |
| status                | ACTIVE                                                                              |
| support_azs           |                                                                                     |
| tenant_id             |                                                                                     |
+-----------------------+-------------------------------------------------------------------------------------+

比如有哪个子网出了问题,就可以监听gateway来判断哪部分出了问题,当然,先得查询网关在哪个物理节点上

~$ neutron l3-agent-list-hosting-router 41f2f732-3574-48fb-923f-7fa3b9dc6f0c
+--------------------------------------+-------------------+----------------+-------+
| id                                   | host              | admin_state_up | alive |
+--------------------------------------+-------------------+----------------+-------+
| e6a321fa-06a4-4851-bc21-1310187f785f | lihui-devstack    | True           | xxx   |
+--------------------------------------+-------------------+----------------+-------+

好吧,我自己L3都挂了,还好是个小demo机器~!

发表评论