本帖最后由 nettman 于 2014-8-31 23:30 编辑
问题导读
1、如何使用浮动 IP 管理的帮助命令?
2、如何移除浮动 IP?
3、如何利用网络命名空间进行操作?
帮助
- [root@station140 ~(keystone_admin)]# nova help | grep float
- add-floating-ip Add a floating IP address to a server.
- floating-ip-bulk-create
- Bulk create floating ips by range.
- floating-ip-bulk-delete
- Bulk delete floating ips by range.
- floating-ip-bulk-list
- List all floating ips.
- floating-ip-create Allocate a floating IP for the current tenant.
- floating-ip-delete De-allocate a floating IP.
- floating-ip-list List floating ips for this tenant.
- floating-ip-pool-list
- List all floating ip pools.
- remove-floating-ip Remove a floating IP address from a server.
复制代码
生成 浮动 IP
- [root@station140 ~(keystone_admin)]# nova floating-ip-create pub1
- +----------------+-------------+----------+------+
- | Ip | Instance Id | Fixed Ip | Pool |
- +----------------+-------------+----------+------+
- | 192.168.48.143 | None | None | pub1 |
- +----------------+-------------+----------+------+
复制代码
分配
- [root@station140 ~(network_admin)]# nova add-floating-ip terry_instance1 192.168.48.143
复制代码
查询浮动 IP 分配情况
- [root@station140 ~(keystone_admin)]# nova floating-ip-list
- +----------------+--------------------------------------+-----------+------+
- | Ip | Instance Id | Fixed Ip | Pool |
- +----------------+--------------------------------------+-----------+------+
- | 192.168.48.143 | 93d0c9c1-b38b-4fe3-9ae3-400f43276f60 | 10.0.0.50 | pub1 |
- +----------------+--------------------------------------+-----------+------+
复制代码
移除浮动 IP
- [root@station140 ~(keystone_admin)]# nova floating-ip-delete 192.168.48.143
复制代码
openstack 命令行管理:网络测试
注: 192.168.48.142 为 floating ip
ping 测试
- [root@station140 ~(keystone_admin)]# ping 192.168.48.142
- PING 192.168.48.142 (192.168.48.142) 56(84) bytes of data.
- 64 bytes from 192.168.48.142: icmp_seq=1 ttl=63 time=1.61 ms
复制代码
ssh 测试
- [root@station140 ~(keystone_admin)]# ssh 192.168.48.142
- The authenticity of host '192.168.48.142 (192.168.48.142)' can't be established.
- RSA key fingerprint is 7f:cc:6e:22:e4:39:99:6a:4c:de:4a:82:df:e9:1c:6c.
- Are you sure you want to continue connecting (yes/no)?
复制代码
ip netns 空间测试方法
查询路由方法
- [root@station140 ~(keystone_admin)]# neutron router-list | grep -v router1
- +--------------------------------------+------------+-----------------------------------------------------------------------------+
- | id | name | external_gateway_info |
- +--------------------------------------+------------+-----------------------------------------------------------------------------+
- | b83f43cd-bf8f-42f8-812a-708c2c372820 | ext-to-int | {"network_id": "aebe75f0-6013-4a5e-bbd9-cb81e1f017bc", "enable_snat": true} |
- +--------------------------------------+------------+-----------------------------------------------------------------------------+
复制代码
列出网络命名空间
- [root@station140 ~(keystone_admin)]# ip netns
- qrouter-59fa152c-df2e-43e4-9d09-7b89fb9cce5d
- qdhcp-dc121f2d-1b3b-471f-8fe7-15ef973b949e
- qrouter-99859660-68fe-4be4-835a-073a05da6533
- qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820
- qdhcp-d0e3f988-d62f-4f95-ab21-b73f4dae326b
- qdhcp-e8e14001-44d9-4ab1-a462-ea621b8a4746
复制代码
利用网络命名空间进行操作例 1
- [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ip addr list
- 32: lo: <LOOPBACK,UP,LOWER_UP> 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
- 33: qg-5a8b8f30-f5: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
- link/ether fa:16:3e:6f:b7:1c brd ff:ff:ff:ff:ff:ff
- inet 192.168.48.143/24 brd 192.168.48.255 scope global qg-5a8b8f30-f5
- inet 192.168.48.142/32 brd 192.168.48.142 scope global qg-5a8b8f30-f5
- inet6 fe80::f816:3eff:fe6f:b71c/64 scope link
- valid_lft forever preferred_lft forever
- 34: qr-bbfe84a2-50: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
- link/ether fa:16:3e:1c:fd:1e brd ff:ff:ff:ff:ff:ff
- inet 10.0.0.1/8 brd 10.255.255.255 scope global qr-bbfe84a2-50
- inet6 fe80::f816:3eff:fe1c:fd1e/64 scope link
- valid_lft forever preferred_lft forever
复制代码
利用网络命名空间进行操作例 2
- [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ping 192.168.48.142
- PING 192.168.48.142 (192.168.48.142) 56(84) bytes of data.
- 64 bytes from 192.168.48.142: icmp_seq=1 ttl=64 time=2.01 ms
- ^C
- --- 192.168.48.142 ping statistics ---
- 1 packets transmitted, 1 received, 0% packet loss, time 615ms
- rtt min/avg/max/mdev = 2.013/2.013/2.013/0.000 ms
复制代码
利用网络命名空间进行操作例 3
- [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ping 10.0.0.50
- PING 10.0.0.50 (10.0.0.50) 56(84) bytes of data.
- 64 bytes from 10.0.0.50: icmp_seq=1 ttl=64 time=2.27 ms
复制代码
上一篇:
openstack 命令行管理七:外部网络;路由管理 命令总结
下一篇:
openstack 命令行管理九:宿主主机管理;instance管理 命令总结
|