openstack 命令行管理一 - br-ex 网络设定 (备忘)



理解:

openstack 内部网络结构如下

|------------  内部网络   ----------|    <- 虚拟路由 ->  |----- 外部网络 ------| 
[instance1 eth0]  ==== br-int                                                br-ext====== 物理eth0
[instance2 eth1]  =====/


确保打开网络转发功能

[root@station140 ~(keystone_admin)]# sysctl -p

net.ipv4.ip_forward = 1


cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
BOOTPROTO="none"
HWADDR="00:50:56:81:C6:5B" [必须具有正确的 MAC, 否则报错]
IPV6INIT="no"
MTU="1500"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
UUID="f3690b2c-7707-4be0-8f76-648cb64da30f"
#IPADDR=192.168.48.140
#NETMASK=255.255.255.0
#GATEWAY=192.168.48.1


cat /etc/sysconfig/network-scripts/ifcfg-br-ex

DEVICE=br-ex
IPADDR=192.168.48.140
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=192.168.48.1


生效方法, 必须一行执行, 否则网络断开 ssh 连接

ovs-vsctl add-port br-ex eth0; service network restart


查询网络地址(只显示部分信息)

[root@station140 ~(keystone_admin)]# ifconfig
br-ex     Link encap:Ethernet  HWaddr 00:50:56:81:C6:5B
          inet addr:192.168.48.140  Bcast:192.168.48.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fe81:c65b/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:32144 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24644 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:11952047 (11.3 MiB)  TX bytes:7386338 (7.0 MiB)

br-int    Link encap:Ethernet  HWaddr AA:98:12:BD:BD:49
          inet6 addr: fe80::a898:12ff:febd:bd49/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:270 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:23380 (22.8 KiB)  TX bytes:468 (468.0 b)

eth0      Link encap:Ethernet  HWaddr 00:50:56:81:C6:5B
          inet6 addr: fe80::250:56ff:fe81:c65b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17270550 errors:0 dropped:0 overruns:0 frame:0
          TX packets:25699 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:19175912632 (17.8 GiB)  TX bytes:7421019 (7.0 MiB)


你可能感兴趣的:(openstack)