当前位置:   article > 正文

云计算:OpenStack 配置云主机实例的存储挂载并实现外网互通_openstack如何配置才能使云主机通公网?

openstack如何配置才能使云主机通公网?

目录

一、实验

1. 环境

2.配置存储挂载

3.云主机实例连接外部网络(SNAT)

4.外部网络连接云主机实例(DNAT)

二、问题

1.云主机 ping 不通外部网络

2.nova list 查看云主机列表报错

3.nova list 与 virsh list --all有何区别

4.OpenStack如何查看虚拟路由器

5.OpenStack如何查看虚拟DHCP服务器


 

 

一、实验

1. 环境

(1)宿主机

表1 宿主机

主机架构IP地址
openstackall in one192.168.199.201

(2)云主机

表2 云主机

 主机架构IP地址

浮动IP

cs_01云主机

         172.25.1.109   

192.168.199.87

cs_02云主机

        172.25.2.107

192.168.199.82

 

2.配置存储挂载

(1)项目devops03用户user01

54f281f882c74a94b11e80863be1142f.png25fbaf24670a49a4a6c780282bb6527b.png

(2)创建卷

799695fe8ca742db91164d943da22d40.png

(3)创建中

18398804fef34feca9f3882a24be1edf.png

(4)完成

cf365275980d42968dd47d4698f48f88.png

(5)登录云主机cs_01控制台1cd67cc4b6534cadbc9b5e8a2c1f8035.png

(6)查看分区情况

eb9c22e16d15420b861349194d47343c.png

(7)管理与连接卷

ad5c06d6037b4495a7834e178d5710ce.png

(8)连接中

1806661aa6924898afd1335824124f17.png

(9)完成

0c5b9238c0ea46beb526da0e26cd830a.png

(10)云主机cs_01控制台查看分区情况

新增磁盘vdb

8d528704bc2c4b5691300035b3e481cb.png

(11) 分区

8255b1531d4d4975bde563f09acee1c7.pngc29cb3b33f754cb69e5017eaef3e03c8.png

(12)查看

89ff375ba95241898b4a5bf397ec1672.png

(13)格式化为ext4文件系统

ed429e19f33340fba4a5082574595a07.png

(14)挂载(会弹出提示,不影响最终挂载)

9e479318ddda4b9e9503b0e01aa96966.png

(15)查看挂载情况

e2b5167e66344fc49ed340d26ee3b6ee.png

 

3.云主机实例连接外部网络(SNAT)

(1)查看当前网络拓扑

79071dcd117d472a99a5b1ea9b0968ba.png

(2)分配浮动IP给云主机cs_01

378e294a1d6f453abc8d80ccedb15894.png

(3)查看

ee6bd70b1eca45e8a8fae02c7072ff75.png

(4)管理浮动IP的关联

ad4f9d6148a24a7f8ef523281af30875.png

(5)已绑定

24efedbb379543f38828bb023475fba4.png


(6)查看实例情况

cca5cbce6a7943558a85ccf323a0e670.png

(7)分配浮动IP给云主机cs_02

48fc791815624f30a5b40deb0e41d09d.png

(8)查看

5a095c7fd455417ca4cf50cfee5f2931.png

(9)点击”绑定浮动IP“

5c3fb0ac60c2471487e857d72b0a8ed5.png

(10)管理浮动IP的关联

f33b8ac6ff704aad9bc0a58249d0018c.png

(11)已绑定

a45bdb9020174970b952a82006d2cf30.png
 

(12)宿主机查看路由信息

5334cf2174db414dbd59a1082496fffd.png

87471872bcdf4edc9efecd9504b8e1e1.png

(13)宿主机添加流表信息cda9dca5c6ba48c5825981738ea0800f.png

6750c4eff17a42ba90f8b49158f347ac.png

(16)云主机 ping 外部网络成功

3bab96cf6dc740ed9391469523cd1e66.png

 

4.外部网络连接云主机实例(DNAT)

(1)查看当前安全组

9df792f84e8e40159fcfe592550fbd82.png

(2)添加规则

d512fa3fe4c44838a2e7defceda6814e.png

(3)查看安全组规则

409c0174ffe14919ab52fe40f6d55755.png

(4)继续添加规则61bba8c0a36b4a8ebf2cd6d2170a43d1.png

(4)再次查看查看安全组规则8fefa02f94b94fa3b4505e97ac149199.png

(5)查看网络拓扑图27ebd21e46d9485ba244483c14a5f0fe.png

94c51d6e679848ea95ed562203d4fd5b.png

 

(6)Windows11系统 ping 云主机cs_01

ace676ba49f54995bc3844b147611fa6.png

(7)Windows11系统 ping 云主机cs_02

7ce445357cf244809484dc1d5bd3d33f.png

 

 

二、问题

1.云主机 ping 不通外部网络

(1)报错

14e183b387e748e2aa57bbadaf324ceb.png

(2)原因分析

未配置流表。

OpenFlow是用于管理交换机流表的协议,ovs-ofctl是Open vSwitch提供的命令行工具。在没有配置OpenFlow控制器的模式下,用户可以使用ovs-ofctl命令通过OpenFlow协议连接Open vSwitch来创建、修改或删除Open vSwitch中的流表项,并对Open vSwitch的运行状况进行动态监控。ovs-ofctl关于流表管理的常用命令如下表所示。

53f61a6c1e654fb2b2a18404a59b299b.png

  1. 对于add-flow、add-flows和mod-flows这3个命令,还需要指定要执行的动作actions=[target],[target],一个流规则中可能有多个动作,按照指定的先后顺序执行。
  2. 常见的流表操作如下表所示。

a81c72cf74c242db8f7ebada39249477.png

在OpenFlow白皮书中,Flow被定义为某个特定的网络流量。例如,一个TCP连接就是一个Flow,或者从某个IP地址发出来的数据包,都可以被认为是一个Flow。支持OpenFlow协议的交换机应该包括一个或多个流表,流表中的条目包含:数据包头的信息、匹配成功后要执行的指令和统计信息。当数据包进入OVS后,会将数据包和流表中的流表项进行匹配,如果发现了匹配的流表项,则执行该流表项中的指令集。相反,如果数据包在流表中没有发现任何匹配,OVS会通过控制通道把数据包发到OpenFlow控制器中。在OVS中,流表项作为ovs-ofctl的参数,采用如下的格式:字段=值,如果有多个字段,可以用逗号或空格分开,一些常用的字段列举如下表所示。

b6d868e0c7894d0e875663890833b179.png

(3)解决方法

命令行输入添加流表。

① 基础网络配置

  1. 1)br-ex
  2. 连接外部网络(external)
  3. 2)br-tun
  4. 连接隧道网络(tunnel)
  5. 3)br-int
  6. 综合网桥(integration)

② 查看网桥(虚拟交换机)的基本信息

  1. [root@openstack ~]# ovs-vsctl show
  2. db90689c-619b-4abe-bcbf-16563efed45b
  3. Manager "ptcp:6640:127.0.0.1"
  4. is_connected: true
  5. Bridge br-int
  6. Controller "tcp:127.0.0.1:6633"
  7. is_connected: true
  8. fail_mode: secure
  9. Port "qg-ff43c0db-46"
  10. tag: 3
  11. Interface "qg-ff43c0db-46"
  12. type: internal
  13. Port "tap2d46a37a-12"
  14. tag: 3
  15. Interface "tap2d46a37a-12"
  16. type: internal
  17. Port br-int
  18. Interface br-int
  19. type: internal
  20. Port "qr-68faaa7e-cc"
  21. tag: 1
  22. Interface "qr-68faaa7e-cc"
  23. type: internal
  24. Port "tapd441263b-ea"
  25. tag: 2
  26. Interface "tapd441263b-ea"
  27. type: internal
  28. Port "qvo7b9dd20c-6e"
  29. tag: 1
  30. Interface "qvo7b9dd20c-6e"
  31. Port "qvo04708a06-18"
  32. tag: 2
  33. Interface "qvo04708a06-18"
  34. Port int-br-ex
  35. Interface int-br-ex
  36. type: patch
  37. options: {peer=phy-br-ex}
  38. Port "tap1a095310-18"
  39. Interface "tap1a095310-18"
  40. type: internal
  41. Port "tapc64270af-df"
  42. tag: 1
  43. Interface "tapc64270af-df"
  44. type: internal
  45. Port "qr-df3559a2-e7"
  46. tag: 2
  47. Interface "qr-df3559a2-e7"
  48. type: internal
  49. Port patch-tun
  50. Interface patch-tun
  51. type: patch
  52. options: {peer=patch-int}
  53. Bridge br-tun
  54. Controller "tcp:127.0.0.1:6633"
  55. is_connected: true
  56. fail_mode: secure
  57. Port patch-int
  58. Interface patch-int
  59. type: patch
  60. options: {peer=patch-tun}
  61. Port br-tun
  62. Interface br-tun
  63. type: internal
  64. Bridge br-ex
  65. Controller "tcp:127.0.0.1:6633"
  66. is_connected: true
  67. fail_mode: secure
  68. Port br-ex
  69. Interface br-ex
  70. type: internal
  71. Port phy-br-ex
  72. Interface phy-br-ex
  73. type: patch
  74. options: {peer=int-br-ex}
  75. Port "ens33"
  76. Interface "ens33"
  77. ovs_version: "2.7.3"

8734370590144dfe8ecc1275f092574f.png

c735b1243a9a43b8b72bc5b0c8d81774.png32488802dd8b4dd787870d2ab6bd6020.pngcfa7766905fb43e2886cc8c58effa621.png
③ 查看br-ex虚拟交换机上各端口的状态

输出的结果中包含了各端口上收到的数据包数,字节数,丢包数,错误数据包数等。

  1. [root@openstack ~]# ovs-ofctl dump-flows br-ex
  2. NXST_FLOW reply (xid=0x4):
  3. cookie=0x0, duration=25482.541s, table=0, n_packets=964, n_bytes=43532, idle_age=10005, in_port=2 actions=AL
  4. cookie=0x3ee824d85c7adea0, duration=34310.012s, table=0, n_packets=369061, n_bytes=82371938, idle_age=0, pr

e86c56967e8049bbb672d6dbf225affe.png

5c61fc09336645c88ac9b3774fcec253.png

④ 查看br-ex桥的流表信息(重点关注序号)

ovs-ofctl show br-ex 
  1. [root@openstack ~]# ovs-ofctl show br-ex
  2. OFPT_FEATURES_REPLY (xid=0x2): dpid:0000000c295385ce
  3. n_tables:254, n_buffers:0
  4. capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
  5. actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_
  6. 1(ens33): addr:00:0c:29:53:85:ce
  7. config: 0
  8. state: 0
  9. current: 1GB-FD COPPER AUTO_NEG
  10. advertised: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG
  11. supported: 10MB-HD 10MB-FD 100MB-HD 100MB-FD 1GB-FD COPPER AUTO_NEG
  12. speed: 1000 Mbps now, 1000 Mbps max
  13. 2(phy-br-ex): addr:12:67:6d:8e:d4:dc
  14. config: 0
  15. state: 0
  16. speed: 0 Mbps now, 0 Mbps max
  17. LOCAL(br-ex): addr:00:0c:29:53:85:ce
  18. config: 0
  19. state: 0
  20. speed: 0 Mbps now, 0 Mbps max
  21. OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0

622e700d644f42e89a611fdde1b48731.pnga8253a350826450398bb7c18a3a49ba1.png

⑤查看br-int桥的流表信息(重点关注序号)

  1. [root@openstack ~]# ovs-ofctl show br-int
  2. OFPT_FEATURES_REPLY (xid=0x2): dpid:000006b7f9bd7d47
  3. n_tables:254, n_buffers:0
  4. capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
  5. actions: output enqueue set_vlan_vid set_vlan_pcp strip_vlan mod_dl_src mod_dl_dst mod_nw_src mod_nw_dst mod_
  6. 2(patch-tun): addr:c2:48:6b:4a:78:56
  7. config: 0
  8. state: 0
  9. speed: 0 Mbps now, 0 Mbps max
  10. 10(int-br-ex): addr:b6:76:78:81:41:dd
  11. config: 0
  12. state: 0
  13. speed: 0 Mbps now, 0 Mbps max
  14. 11(qr-68faaa7e-cc): addr:00:00:00:00:10:c3
  15. config: PORT_DOWN
  16. state: LINK_DOWN
  17. speed: 0 Mbps now, 0 Mbps max
  18. 12(qr-df3559a2-e7): addr:00:00:00:00:e0:99
  19. config: PORT_DOWN
  20. state: LINK_DOWN
  21. speed: 0 Mbps now, 0 Mbps max
  22. 13(qg-ff43c0db-46): addr:00:00:00:00:20:5d
  23. config: PORT_DOWN
  24. state: LINK_DOWN
  25. speed: 0 Mbps now, 0 Mbps max
  26. 14(tap1a095310-18): addr:00:00:00:00:10:80
  27. config: PORT_DOWN
  28. state: LINK_DOWN
  29. speed: 0 Mbps now, 0 Mbps max
  30. 15(tap2d46a37a-12): addr:00:00:00:00:f0:9f
  31. config: PORT_DOWN
  32. state: LINK_DOWN
  33. speed: 0 Mbps now, 0 Mbps max
  34. 16(tapc64270af-df): addr:02:ec:b9:56:6c:04
  35. config: PORT_DOWN
  36. state: LINK_DOWN
  37. speed: 0 Mbps now, 0 Mbps max
  38. 17(tapd441263b-ea): addr:00:00:00:00:b0:39
  39. config: PORT_DOWN
  40. state: LINK_DOWN
  41. speed: 0 Mbps now, 0 Mbps max
  42. 18(qvo04708a06-18): addr:0a:84:80:cb:e4:50
  43. config: 0
  44. state: 0
  45. current: 10GB-FD COPPER
  46. speed: 10000 Mbps now, 0 Mbps max
  47. 19(qvo7b9dd20c-6e): addr:7a:22:2b:be:43:4c
  48. config: 0
  49. state: 0
  50. current: 10GB-FD COPPER
  51. speed: 10000 Mbps now, 0 Mbps max
  52. LOCAL(br-int): addr:06:b7:f9:bd:7d:47
  53. config: PORT_DOWN
  54. state: LINK_DOWN
  55. speed: 0 Mbps now, 0 Mbps max
  56. OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0

ee88ab8f192d44e4aa40d44aa3950fc8.pngc45c2e48296e4412a63f3ae86b12688e.pnge8a6076211fd4d688308210afe6be96f.png

⑥查看br-int虚拟交换机上各端口的状态

  1. [root@openstack ~]# ovs-ofctl dump-flows br-int
  2. NXST_FLOW reply (xid=0x4):
  3. cookie=0xc40afaa44e3bf01c, duration=35262.046s, table=0, n_packets=13199, n_bytes=1029702, idle_age=1, priority=2,in_port=10 actions=dr
  4. cookie=0xc40afaa44e3bf01c, duration=33864.921s, table=0, n_packets=1447, n_bytes=141992, idle_age=10954, priority=9,in_port=18 actions=
  5. cookie=0xc40afaa44e3bf01c, duration=33022.776s, table=0, n_packets=119, n_bytes=11871, idle_age=16595, priority=9,in_port=19 actions=re
  6. cookie=0x0, duration=4.201s, table=0, n_packets=0, n_bytes=0, idle_age=4, in_port=13 actions=ALL
  7. cookie=0xc40afaa44e3bf01c, duration=33864.919s, table=0, n_packets=0, n_bytes=0, idle_age=33864, priority=10,icmp6,in_port=18,icmp_typemit(,24)
  8. cookie=0xc40afaa44e3bf01c, duration=33022.774s, table=0, n_packets=0, n_bytes=0, idle_age=33022, priority=10,icmp6,in_port=19,icmp_typemit(,24)
  9. cookie=0xc40afaa44e3bf01c, duration=33864.917s, table=0, n_packets=115, n_bytes=4830, idle_age=10959, priority=10,arp,in_port=18 action
  10. cookie=0xc40afaa44e3bf01c, duration=33022.772s, table=0, n_packets=10, n_bytes=420, idle_age=16593, priority=10,arp,in_port=19 actions=
  11. cookie=0xc40afaa44e3bf01c, duration=35263.424s, table=0, n_packets=2752, n_bytes=239758, idle_age=10954, priority=0 actions=resubmit(,6
  12. cookie=0xc40afaa44e3bf01c, duration=35263.425s, table=23, n_packets=0, n_bytes=0, idle_age=35263, priority=0 actions=drop
  13. cookie=0xc40afaa44e3bf01c, duration=33864.920s, table=24, n_packets=0, n_bytes=0, idle_age=33864, priority=2,icmp6,in_port=18,icmp_type0::f816:3eff:fedb:3d7d actions=resubmit(,60)
  14. cookie=0xc40afaa44e3bf01c, duration=33022.775s, table=24, n_packets=0, n_bytes=0, idle_age=33022, priority=2,icmp6,in_port=19,icmp_type0::f816:3eff:fe35:1ec9 actions=resubmit(,60)
  15. cookie=0xc40afaa44e3bf01c, duration=33864.918s, table=24, n_packets=115, n_bytes=4830, idle_age=10959, priority=2,arp,in_port=18,arp_spions=resubmit(,25)
  16. cookie=0xc40afaa44e3bf01c, duration=33022.773s, table=24, n_packets=10, n_bytes=420, idle_age=16593, priority=2,arp,in_port=19,arp_spa=ns=resubmit(,25)
  17. cookie=0xc40afaa44e3bf01c, duration=35263.423s, table=24, n_packets=0, n_bytes=0, idle_age=35263, priority=0 actions=drop
  18. cookie=0xc40afaa44e3bf01c, duration=33864.922s, table=25, n_packets=1560, n_bytes=146682, idle_age=10954, priority=2,in_port=18,dl_src=actions=resubmit(,60)
  19. cookie=0xc40afaa44e3bf01c, duration=33022.778s, table=25, n_packets=127, n_bytes=12151, idle_age=16593, priority=2,in_port=19,dl_src=fations=resubmit(,60)
  20. cookie=0xc40afaa44e3bf01c, duration=35263.424s, table=60, n_packets=4439, n_bytes=398591, idle_age=10954, priority=3 actions=NORMAL

824b766600c64ea49541be98868d18cb.png
⑦修改br-ex 流表信息

  1. [root@openstack ~]# ovs-ofctl del-flows br-ex "in_port=2"
  2. [root@openstack ~]# ovs-ofctl add-flow br-ex in_port=1,actions=all

b985bb80f8e1443abf49949cc9a853a7.png

⑧  修改br-int 流表信息

  1. [root@openstack ~]# ovs-ofctl del-flows br-int "in_port=13"
  2. [root@openstack ~]# ovs-ofctl add-flow br-int in_port=10,actions=all

2668dcb221f341cfb9e35a90b70e0689.png

⑨ 云主机 ping 外部网络成功

0cd8bf424a364f2b8292d69323b48638.png

 

2.nova list 查看云主机列表报错

(1)报错

bc57ea0c58eb46219f0642002cacab79.png

14ebe1c61f5846259b31edd5bc26497b.png

(2)原因分析

未配置项目文件。

(3)解决方法

①  复制配置文件

d5c619500cc249bd95bebdb84ec3422d.png

② 编辑配置文件并刷新

a61be8e976e648f2a622a83a3365d6ff.png

3f870d59112f47738da1302fcde32bc0.png

③ 再次查看云主机列表,成功

3ed76a55123a4ae98b07de04745e82dc.pngdc094a7e86d74cf2b66129135b907fc0.png

3.nova list 与 virsh list --all有何区别

(1)nova list命令查看云主机

3ed76a55123a4ae98b07de04745e82dc.png

dc094a7e86d74cf2b66129135b907fc0.png

(2)virsh list --all命令查看KVM虚拟机

71e245ca75dd4a61a9110034dda45414.png

3cbc28dac4e24c4582b4c7c8e70daa73.png

①  查看云主机cs_01进程

dd8bc91abc2f4ad28248a06c025af1ff.png75ab6401a87d4e13b703061eb70d502c.png

②查看云主机cs_02进程

115b37fb3a27443db894b356b5bcff97.pngeec0be2a64044b2dadd405d6a5e9dcd0.png

③ 查看配置文件目录

cb0013ab4cc94b18a94e3fbb7c3da51b.pngfe00a46fd6ed4908b2ac778dec219a94.png④ 云主机cs_01 配置文件关键接口信息

c9768fb157f345598f2410fcab1d8b0a.png

⑤云主机cs_02配置文件关键接口信息

b79a1a38620a4b94a2cf27774d62ca75.png

 

4.OpenStack如何查看虚拟路由器

(1)查看网络隔离环境

  1. [root@openstack ~]# ip netns
  2. qdhcp-8b5a5b08-5516-4928-b8b6-8e14476cad0f
  3. qdhcp-0edffd85-3d72-4c82-a73f-01115e32cb4b
  4. qdhcp-3fe9f084-e8f3-4b85-9edb-65db0d4e2679
  5. qdhcp-cd51a8fe-af2e-4e4d-9aaf-4e5874c24eca
  6. qrouter-26af4ac5-5aba-4cb3-bd34-58d1b3701a61

d7751a6d34074beca380b6fe7163d963.png

25aabcada67d48e282b4427e47303167.png

(2) bash命令进入虚拟路由器查看

  1. [root@openstack ~]# ip netns exec qrouter-26af4ac5-5aba-4cb3-bd34-58d1b3701a61 /bin/bash
  2. [root@openstack ~]# ip add show
  3. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
  4. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  5. inet 127.0.0.1/8 scope host lo
  6. valid_lft forever preferred_lft forever
  7. inet6 ::1/128 scope host
  8. valid_lft forever preferred_lft forever
  9. 14: qr-68faaa7e-cc: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
  10. link/ether fa:16:3e:ab:15:c2 brd ff:ff:ff:ff:ff:ff
  11. inet 172.25.2.254/24 brd 172.25.2.255 scope global qr-68faaa7e-cc
  12. valid_lft forever preferred_lft forever
  13. inet6 fe80::f816:3eff:feab:15c2/64 scope link
  14. valid_lft forever preferred_lft forever
  15. 15: qr-df3559a2-e7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
  16. link/ether fa:16:3e:02:a4:00 brd ff:ff:ff:ff:ff:ff
  17. inet 172.25.1.254/24 brd 172.25.1.255 scope global qr-df3559a2-e7
  18. valid_lft forever preferred_lft forever
  19. inet6 fe80::f816:3eff:fe02:a400/64 scope link
  20. valid_lft forever preferred_lft forever
  21. 16: qg-ff43c0db-46: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
  22. link/ether fa:16:3e:23:7b:27 brd ff:ff:ff:ff:ff:ff
  23. inet 192.168.199.84/24 brd 192.168.199.255 scope global qg-ff43c0db-46
  24. valid_lft forever preferred_lft forever
  25. inet 192.168.199.87/32 brd 192.168.199.87 scope global qg-ff43c0db-46
  26. valid_lft forever preferred_lft forever
  27. inet 192.168.199.82/32 brd 192.168.199.82 scope global qg-ff43c0db-46
  28. valid_lft forever preferred_lft forever
  29. inet6 fe80::f816:3eff:fe23:7b27/64 scope link
  30. valid_lft forever preferred_lft forever
  31. [root@openstack ~]# route -n
  32. Kernel IP routing table
  33. Destination Gateway Genmask Flags Metric Ref Use Iface
  34. 0.0.0.0 172.25.2.254 0.0.0.0 UG 0 0 0 tapc64270af-df
  35. 172.25.2.0 0.0.0.0 255.255.255.0 U 0 0 0 tapc64270af-df
  36. [root@openstack ~]# exit
  37. exit

 

查看IP信息

5e12dc62403f45aeb06a7015eaa2dc13.png

c08aa15925344ddb9a6aa31a3c767e96.png

查看路由信息

a6ba8f97ce8b41058df8e170484aac8b.png788fd9de98094a419ddc1802a8406e96.png

5.OpenStack如何查看虚拟DHCP服务器

 (1)查看

  1. [root@openstack ~]# ip netns
  2. qdhcp-8b5a5b08-5516-4928-b8b6-8e14476cad0f
  3. qdhcp-0edffd85-3d72-4c82-a73f-01115e32cb4b
  4. qdhcp-3fe9f084-e8f3-4b85-9edb-65db0d4e2679
  5. qdhcp-cd51a8fe-af2e-4e4d-9aaf-4e5874c24eca
  6. qrouter-26af4ac5-5aba-4cb3-bd34-58d1b3701a61

d7751a6d34074beca380b6fe7163d963.png

25aabcada67d48e282b4427e47303167.png

(2) bash命令进入第1个DHCP服务器查看

  1. [root@openstack ~]# ip netns exec qdhcp-3fe9f084-e8f3-4b85-9edb-65db0d4e2679 /bin/bash
  2. [root@openstack ~]# route -n
  3. Kernel IP routing table
  4. Destination Gateway Genmask Flags Metric Ref Use Iface
  5. 0.0.0.0 192.168.199.2 0.0.0.0 UG 0 0 0 tap2d46a37a-12
  6. 192.168.199.0 0.0.0.0 255.255.255.0 U 0 0 0 tap2d46a37a-12
  7. [root@openstack ~]# ip add show
  8. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
  9. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  10. inet 127.0.0.1/8 scope host lo
  11. valid_lft forever preferred_lft forever
  12. inet6 ::1/128 scope host
  13. valid_lft forever preferred_lft forever
  14. 18: tap2d46a37a-12: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
  15. link/ether fa:16:3e:bb:04:3c brd ff:ff:ff:ff:ff:ff
  16. inet 192.168.199.80/24 brd 192.168.199.255 scope global tap2d46a37a-12
  17. valid_lft forever preferred_lft forever
  18. inet6 fe80::f816:3eff:febb:43c/64 scope link
  19. valid_lft forever preferred_lft forever
  20. [root@openstack ~]# exit
  21. exit

查看路由信息52f3266a625c40c6b16230146a99c603.pngbbf851d69af54d048ce9875cf07c9046.png查看IP信息

2f0bb60e202d4a05948e1268571696b6.png0d02fe31843f4bd1ad49da742870fd17.png

(3) bash命令进入第2个DHCP服务器查看

  1. [root@openstack ~]# ip netns exec qdhcp-cd51a8fe-af2e-4e4d-9aaf-4e5874c24eca /bin/bash
  2. [root@openstack ~]# route -n
  3. Kernel IP routing table
  4. Destination Gateway Genmask Flags Metric Ref Use Iface
  5. 172.25.3.0 0.0.0.0 255.255.255.0 U 0 0 0 tap1a095310-18
  6. [root@openstack ~]# ip add show
  7. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
  8. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  9. inet 127.0.0.1/8 scope host lo
  10. valid_lft forever preferred_lft forever
  11. inet6 ::1/128 scope host
  12. valid_lft forever preferred_lft forever
  13. 19: tapc64270af-df: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
  14. link/ether fa:16:3e:07:89:b5 brd ff:ff:ff:ff:ff:ff
  15. inet 172.25.2.101/24 brd 172.25.2.255 scope global tapc64270af-df
  16. valid_lft forever preferred_lft forever
  17. inet6 fe80::f816:3eff:fe07:89b5/64 scope link
  18. valid_lft forever preferred_lft forever
  19. [root@openstack ~]# exit
  20. exit

查看路由信息600d69d3d6474edc96f72a61d0bf7675.png

10b81f552c4b46f884c14fde10e01e05.png查看IP信息

2f0bb60e202d4a05948e1268571696b6.png

b19d12d3a3db48a0bdd536019105dbe1.png

(4) bash命令进入第3个DHCP服务器查看

  1. [root@openstack ~]# ip netns exec qdhcp-8b5a5b08-5516-4928-b8b6-8e14476cad0f /bin/bash
  2. [root@openstack ~]# route -n
  3. Kernel IP routing table
  4. Destination Gateway Genmask Flags Metric Ref Use Iface
  5. 0.0.0.0 172.25.1.254 0.0.0.0 UG 0 0 0 tapd441263b-ea
  6. 172.25.1.0 0.0.0.0 255.255.255.0 U 0 0 0 tapd441263b-ea
  7. [root@openstack ~]# ip add show
  8. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
  9. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  10. inet 127.0.0.1/8 scope host lo
  11. valid_lft forever preferred_lft forever
  12. inet6 ::1/128 scope host
  13. valid_lft forever preferred_lft forever
  14. 20: tapd441263b-ea: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
  15. link/ether fa:16:3e:ed:ef:77 brd ff:ff:ff:ff:ff:ff
  16. inet 172.25.1.101/24 brd 172.25.1.255 scope global tapd441263b-ea
  17. valid_lft forever preferred_lft forever
  18. inet6 fe80::f816:3eff:feed:ef77/64 scope link
  19. valid_lft forever preferred_lft forever
  20. [root@openstack ~]# exit
  21. exit

查看路由信息aa25e9e8155c4d4bad068818eeecfa40.png

bb166cb1a0694f95a2ff04fca1464bb5.png查看IP信息

bb60877012f54de8a1e48c9ad88a6340.png

460c1e906fe44edbaf8ae1e7e94416c9.png

(5) bash命令进入第4个DHCP服务器查看

  1. [root@openstack ~]# ip netns exec qdhcp-0edffd85-3d72-4c82-a73f-01115e32cb4b /bin/bash
  2. [root@openstack ~]# route -n
  3. Kernel IP routing table
  4. Destination Gateway Genmask Flags Metric Ref Use Iface
  5. 0.0.0.0 172.25.2.254 0.0.0.0 UG 0 0 0 tapc64270af-df
  6. 172.25.2.0 0.0.0.0 255.255.255.0 U 0 0 0 tapc64270af-df
  7. [root@openstack ~]# ip add show
  8. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
  9. link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  10. inet 127.0.0.1/8 scope host lo
  11. valid_lft forever preferred_lft forever
  12. inet6 ::1/128 scope host
  13. valid_lft forever preferred_lft forever
  14. 19: tapc64270af-df: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN qlen 1000
  15. link/ether fa:16:3e:07:89:b5 brd ff:ff:ff:ff:ff:ff
  16. inet 172.25.2.101/24 brd 172.25.2.255 scope global tapc64270af-df
  17. valid_lft forever preferred_lft forever
  18. inet6 fe80::f816:3eff:fe07:89b5/64 scope link
  19. valid_lft forever preferred_lft forever
  20. [root@openstack ~]# exit
  21. exit

查看路由信息d72d8b700b1347be9d650356f88e6961.pngba1a716f22f541938f45398b1d4776bc.png查看IP信息

2f0bb60e202d4a05948e1268571696b6.png7ab32ec9a167452c9a785eb6bb2e4d5c.png

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/331396
推荐阅读
相关标签
  

闽ICP备14008679号