openstack 下网络[路由绑定]故障解决

1. 查询网络信息

[root@kf-test-pinyun-048228 ~(keystone_admin)]# neutron net-list | grep w2
| 01a7ab13-65a8-4300-a53b-d6a774414c2a | w2                              | 67f3da0b-a513-4857-8ad7-2283494a3b4f 192.168.0.0/24 |



2. 查询子网信息

[root@kf-test-pinyun-048228 ~(keystone_admin)]# neutron subnet-list | grep 67f3da0b-a513-4857-8ad7-2283494a3b4f
| 67f3da0b-a513-4857-8ad7-2283494a3b4f | 2                                      | 192.168.0.0/24  | {"start": "192.168.0.21", "end": "192.168.0.200"}  |


3. 查询当前路由信息

[root@kf-test-pinyun-048228 ~(keystone_admin)]#neutron router-list | grep ly2
| 698a3113-e94d-4c5a-ba62-870c9c7897bc | ly2   | {"network_id": "c3d7ba94-4360-4f3f-a9c8-83cda089dfa7", "enable_snat": true} |


4. 添加网络接口

[root@kf-test-pinyun-048228 ~(keystone_admin)]#neutron router-list | grep ly2
| 698a3113-e94d-4c5a-ba62-870c9c7897bc | ly2   | {"network_id": "c3d7ba94-4360-4f3f-a9c8-83cda089dfa7", "enable_snat": true} |
[root@kf-test-pinyun-048228 ~(keystone_admin)]#neutron router-interface-add 698a3113-e94d-4c5a-ba62-870c9c7897bc 67f3da0b-a513-4857-8ad7-2283494a3b4f
400-{u'NeutronError': {u'message': u'Bad router request: Subnet for router interface must have a gateway IP', u'type': u'BadRequest', u'detail': u''}}



检查原因

[root@kf-test-pinyun-048228 ~(keystone_admin)]# neutron subnet-show  2
+------------------+---------------------------------------------------+
| Field            | Value                                             |
+------------------+---------------------------------------------------+
| allocation_pools | {"start": "192.168.0.21", "end": "192.168.0.200"} |
| cidr             | 192.168.0.0/24                                    |
| dns_nameservers  |                                                   |
| enable_dhcp      | True                                              |
| gateway_ip       |                                                   |  <-- 没有路由导致无法连接该路由
| host_routes      |                                                   |
| id               | 67f3da0b-a513-4857-8ad7-2283494a3b4f              |
| ip_version       | 4                                                 |
| name             | 2                                                 |
| network_id       | 01a7ab13-65a8-4300-a53b-d6a774414c2a              |
| tenant_id        | 491b8025e52b4876a4c92e34faab6de9                  |
+------------------+---------------------------------------------------+


重新创建一个子网

[root@kf-test-pinyun-048228 ~(keystone_admin)]# neutron subnet-delete 2
Deleted subnet: 2
[root@kf-test-pinyun-048228 ~(keystone_admin)]#neutron subnet-create --name terry_subnet --allocation-pool start=192.168.0.21,end=192.168.0.200 --gateway 192.168.0.1 --dns-nameserver 192.168.86.37 --enable_dhcp=True --ip-version 4  w2 192.168.0.0/24
Created a new subnet:
+------------------+---------------------------------------------------+
| Field            | Value                                             |
+------------------+---------------------------------------------------+
| allocation_pools | {"start": "192.168.0.21", "end": "192.168.0.200"} |
| cidr             | 192.168.0.0/24                                    |
| dns_nameservers  | 192.168.86.37                                     |
| enable_dhcp      | True                                              |
| gateway_ip       | 192.168.0.1                                       |
| host_routes      |                                                   |
| id               | 22515256-2d5e-4e97-b8d4-4dd00a2a4595              |
| ip_version       | 4                                                 |
| name             | terry_subnet                                      |
| network_id       | 01a7ab13-65a8-4300-a53b-d6a774414c2a              |
| tenant_id        | 96536b80f74a4aea90d728befa0d1114                  |
+------------------+---------------------------------------------------+


重新连接路由成功, 问题解决

[root@kf-test-pinyun-048228 ~(keystone_admin)]#neutron router-interface-add 698a3113-e94d-4c5a-ba62-870c9c7897bc 22515256-2d5e-4e97-b8d4-4dd00a2a4595
Added interface ad53878a-f358-4867-bbf5-3d1fd3302e6c to router 698a3113-e94d-4c5a-ba62-870c9c7897bc.


你可能感兴趣的:(openstack 下网络[路由绑定]故障解决)