分享

openstack 命令行管理八:浮动 IP 管理;网络测试 命令总结

xioaxu790 发表于 2014-8-31 17:08:18 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 31795
本帖最后由 nettman 于 2014-8-31 23:30 编辑
问题导读
1、如何使用浮动 IP 管理的帮助命令?
2、如何移除浮动 IP?
3、如何利用网络命名空间进行操作?





帮助
  1. [root@station140 ~(keystone_admin)]# nova help | grep float  
  2.     add-floating-ip     Add a floating IP address to a server.  
  3.     floating-ip-bulk-create  
  4.                         Bulk create floating ips by range.  
  5.     floating-ip-bulk-delete  
  6.                         Bulk delete floating ips by range.  
  7.     floating-ip-bulk-list  
  8.                         List all floating ips.  
  9.     floating-ip-create  Allocate a floating IP for the current tenant.  
  10.     floating-ip-delete  De-allocate a floating IP.  
  11.     floating-ip-list    List floating ips for this tenant.  
  12.     floating-ip-pool-list  
  13.                         List all floating ip pools.  
  14.     remove-floating-ip  Remove a floating IP address from a server.
复制代码


生成 浮动 IP
  1. [root@station140 ~(keystone_admin)]# nova floating-ip-create pub1  
  2. +----------------+-------------+----------+------+  
  3. | Ip             | Instance Id | Fixed Ip | Pool |  
  4. +----------------+-------------+----------+------+  
  5. | 192.168.48.143 | None        | None     | pub1 |  
  6. +----------------+-------------+----------+------+
复制代码


分配
  1. [root@station140 ~(network_admin)]# nova add-floating-ip terry_instance1 192.168.48.143  
复制代码


查询浮动 IP 分配情况
  1. [root@station140 ~(keystone_admin)]# nova floating-ip-list  
  2. +----------------+--------------------------------------+-----------+------+  
  3. | Ip             | Instance Id                          | Fixed Ip  | Pool |  
  4. +----------------+--------------------------------------+-----------+------+  
  5. | 192.168.48.143 | 93d0c9c1-b38b-4fe3-9ae3-400f43276f60 | 10.0.0.50 | pub1 |  
  6. +----------------+--------------------------------------+-----------+------+
复制代码


移除浮动 IP
  1. [root@station140 ~(keystone_admin)]# nova floating-ip-delete 192.168.48.143  
复制代码




openstack 命令行管理:网络测试
注: 192.168.48.142 为 floating ip
ping 测试
  1. [root@station140 ~(keystone_admin)]# ping 192.168.48.142  
  2. PING 192.168.48.142 (192.168.48.142) 56(84) bytes of data.  
  3. 64 bytes from 192.168.48.142: icmp_seq=1 ttl=63 time=1.61 ms
复制代码


ssh 测试
  1. [root@station140 ~(keystone_admin)]# ssh 192.168.48.142  
  2. The authenticity of host '192.168.48.142 (192.168.48.142)' can't be established.  
  3. RSA key fingerprint is 7f:cc:6e:22:e4:39:99:6a:4c:de:4a:82:df:e9:1c:6c.  
  4. Are you sure you want to continue connecting (yes/no)?
复制代码


ip netns 空间测试方法
查询路由方法
  1. [root@station140 ~(keystone_admin)]# neutron router-list | grep -v router1  
  2. +--------------------------------------+------------+-----------------------------------------------------------------------------+  
  3. | id                                   | name       | external_gateway_info                                                       |  
  4. +--------------------------------------+------------+-----------------------------------------------------------------------------+  
  5. | b83f43cd-bf8f-42f8-812a-708c2c372820 | ext-to-int | {"network_id": "aebe75f0-6013-4a5e-bbd9-cb81e1f017bc", "enable_snat": true} |  
  6. +--------------------------------------+------------+-----------------------------------------------------------------------------+  
复制代码


列出网络命名空间
  1. [root@station140 ~(keystone_admin)]# ip netns  
  2. qrouter-59fa152c-df2e-43e4-9d09-7b89fb9cce5d  
  3. qdhcp-dc121f2d-1b3b-471f-8fe7-15ef973b949e  
  4. qrouter-99859660-68fe-4be4-835a-073a05da6533  
  5. qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820  
  6. qdhcp-d0e3f988-d62f-4f95-ab21-b73f4dae326b  
  7. qdhcp-e8e14001-44d9-4ab1-a462-ea621b8a4746
复制代码


利用网络命名空间进行操作例 1
  1. [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ip addr list  
  2. 32: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN  
  3.     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
  4.     inet 127.0.0.1/8 scope host lo  
  5.     inet6 ::1/128 scope host  
  6.        valid_lft forever preferred_lft forever  
  7. 33: qg-5a8b8f30-f5: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN  
  8.     link/ether fa:16:3e:6f:b7:1c brd ff:ff:ff:ff:ff:ff  
  9.     inet 192.168.48.143/24 brd 192.168.48.255 scope global qg-5a8b8f30-f5  
  10.     inet 192.168.48.142/32 brd 192.168.48.142 scope global qg-5a8b8f30-f5  
  11.     inet6 fe80::f816:3eff:fe6f:b71c/64 scope link  
  12.        valid_lft forever preferred_lft forever  
  13. 34: qr-bbfe84a2-50: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN  
  14.     link/ether fa:16:3e:1c:fd:1e brd ff:ff:ff:ff:ff:ff  
  15.     inet 10.0.0.1/8 brd 10.255.255.255 scope global qr-bbfe84a2-50  
  16.     inet6 fe80::f816:3eff:fe1c:fd1e/64 scope link  
  17.        valid_lft forever preferred_lft forever
复制代码


利用网络命名空间进行操作例 2
  1. [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ping 192.168.48.142  
  2. PING 192.168.48.142 (192.168.48.142) 56(84) bytes of data.  
  3. 64 bytes from 192.168.48.142: icmp_seq=1 ttl=64 time=2.01 ms  
  4. ^C  
  5. --- 192.168.48.142 ping statistics ---  
  6. 1 packets transmitted, 1 received, 0% packet loss, time 615ms  
  7. rtt min/avg/max/mdev = 2.013/2.013/2.013/0.000 ms
复制代码


利用网络命名空间进行操作例 3
  1. [root@station140 ~(keystone_admin)]# ip netns exec qrouter-b83f43cd-bf8f-42f8-812a-708c2c372820 ping 10.0.0.50  
  2. PING 10.0.0.50 (10.0.0.50) 56(84) bytes of data.  
  3. 64 bytes from 10.0.0.50: icmp_seq=1 ttl=64 time=2.27 ms
复制代码


上一篇:
openstack 命令行管理七:外部网络;路由管理 命令总结

下一篇:
openstack 命令行管理九:宿主主机管理;instance管理 命令总结


没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条