http://haoningabc.iteye.com/blog/2282452
liberty装好之后,做一个neutron的关于router的试验
建立router
neutron net-list
neutron subnet-list
neutron net-create private
ip netns
#这之后建立命名空间
neutron subnet-create --name private-subnet1 private 192.168.10.0/29
nova boot --image cirros --flavor 1 One
nova boot --image cirros --flavor 1 Two
nova boot --image cirros --flavor 1 Three
nova boot --image cirros --flavor 1 Four
neutron subnet-create --name private-subnet2 private 192.168.20.0/29
nova boot --image cirros --flavor 1 Five
nova list
ip netns exec qdhcp-c8c64093-fbde-4660-9f06-1bf7016b2a50 ip a
nova get-vnc-console Five novnc
neutron router-create --distributed=false MyRouter
#这也建立一个新的命名空间
[root@controller ~(keystone_admin_v3)]# ip netns qrouter-f8f7ba67-ee99-4186-b51f-1f3974cf8282 (id: 1) qdhcp-c8c64093-fbde-4660-9f06-1bf7016b2a50 (id: 0)
neutron router-list
neuron router-interface-add MyRouter privat-subnet1
neutron router-interface-add MyRouter privat-subnet2
neutron router-list
neutron router-port-list f8f7ba67-ee99-4186-b51f-1f3974cf8282
ip netns exec qrouter-f8f7ba67-ee99-4186-b51f-1f3974cf8282 ip a
[root@controller ~(keystone_admin_v3)]# ip netns exec qrouter-f8f7ba67-ee99-4186-b51f-1f3974cf8282 ip a 1: lo:mtu 65536 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 valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: qr-63bf9f93-cf@if27: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether fa:16:3e:33:8f:65 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 192.168.10.1/29 brd 192.168.10.7 scope global qr-63bf9f93-cf valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:fe33:8f65/64 scope link valid_lft forever preferred_lft forever 3: qr-4e347ef7-f8@if28: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether fa:16:3e:bb:8b:11 brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 192.168.20.1/29 brd 192.168.20.7 scope global qr-4e347ef7-f8 valid_lft forever preferred_lft forever inet6 fe80::f816:3eff:febb:8b11/64 scope link valid_lft forever preferred_lft forever [root@controller ~(keystone_admin_v3)]#
ip netns exec qrouter-f8f7ba67-ee99-4186-b51f-1f3974cf8282 ethtool -S qr-63bf9f93-cf
ip netns exec qrouter-f8f7ba67-ee99-4186-b51f-1f3974cf8282 ethtool -S qr-4e347ef7-f8
ip a
brctl show
[root@controller ~(keystone_admin_v3)]# nova get-vnc-console Five novnc +-------+---------------------------------------------------------------------------------+ | Type | Url | +-------+---------------------------------------------------------------------------------+ | novnc | http://controller:6080/vnc_auto.html?token=23d23505-1e41-4458-a0aa-877cf44c2b31 | +-------+---------------------------------------------------------------------------------+ [root@controller ~(keystone_admin_v3)]# nova get-vnc-console One novnc +-------+---------------------------------------------------------------------------------+ | Type | Url | +-------+---------------------------------------------------------------------------------+ | novnc | http://controller:6080/vnc_auto.html?token=a6d5d088-f9a4-4522-9095-2a3a42b87cb2 | +-------+---------------------------------------------------------------------------------+ [root@controller ~(keystone_admin_v3)]# 一个192.168.10.3 一个192.168.20.3 可以互相ping通
-------------------------------------如果是删除操作--------------
nova delete Five
ip netns
#两个,一个router一个dhcp
neutron subnet-list +--------------------------------------+-----------------+-----------------+--------------------------------------------------+ | id | name | cidr | allocation_pools | +--------------------------------------+-----------------+-----------------+--------------------------------------------------+ | 3468a50d-3287-4316-b050-e2cd026672c9 | private-subnet1 | 192.168.10.0/29 | {"start": "192.168.10.2", "end": "192.168.10.6"} | | f9e407e5-9a58-4668-a2a3-1966881b2c2c | private-subnet2 | 192.168.20.0/29 | {"start": "192.168.20.2", "end": "192.168.20.6"} | +--------------------------------------+-----------------+-----------------+--------------------------------------------------+ neutron router-list +--------------------------------------+----------+-----------------------+-------------+-------+ | id | name | external_gateway_info | distributed | ha | +--------------------------------------+----------+-----------------------+-------------+-------+ | f8f7ba67-ee99-4186-b51f-1f3974cf8282 | MyRouter | null | False | False | +--------------------------------------+----------+-----------------------+-------------+-------+
neutron router-port-list f8f7ba67-ee99-4186-b51f-1f3974cf8282
#这句没用
neutron router-interface-delete MyRouter 3468a50d-3287-4316-b050-e2cd026672c9
neutron router-interface-delete MyRouter private-subnet2
neutron router-delete MyRouter
ip netns
[root@controller ~(keystone_admin_v3)]# neutron subnet-list +--------------------------------------+-----------------+-----------------+--------------------------------------------------+ | id | name | cidr | allocation_pools | +--------------------------------------+-----------------+-----------------+--------------------------------------------------+ | 3468a50d-3287-4316-b050-e2cd026672c9 | private-subnet1 | 192.168.10.0/29 | {"start": "192.168.10.2", "end": "192.168.10.6"} | | f9e407e5-9a58-4668-a2a3-1966881b2c2c | private-subnet2 | 192.168.20.0/29 | {"start": "192.168.20.2", "end": "192.168.20.6"} | +--------------------------------------+-----------------+-----------------+--------------------------------------------------+
[root@controller ~(keystone_admin_v3)]# neutron subnet-delete private-subnet2
Deleted subnet: private-subnet2
[root@controller ~(keystone_admin_v3)]# neutron subnet-delete private-subnet1
Unable to complete operation on subnet 3468a50d-3287-4316-b050-e2cd026672c9. One or more ports have an IP allocation from this subnet.
[root@controller ~(keystone_admin_v3)]#
###有vm的网络是不能删除的,需要先删除vm
nova delete One
nova delete Two
nova delete Three
nova delete Four
neutron subnet-delete private-subnet1
neutron net-delete private