1. 环境准备
ECS网络
VMware修改host模式网络
node1、node2各添加一块网卡,连接到VMnet1
node1、node2修改eth1配置文件
[root@linux-node1 network-scripts]# cp ifcfg-eth0 ifcfg-eth1 [root@linux-node1 network-scripts]# vi ifcfg-eth1 NAME="eth1" ONBOOT=yes NETBOOT=yes BOOTPROTO=none TYPE=Ethernet DEFROUTE=yes IPV4_FAILURE_FATAL=no IPADDR=192.168.57.11 #node2改成192.168.57.12 PREFIX=24 [root@linux-node1 network-scripts]# ifup eth1 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5) [root@linux-node1 network-scripts]# ifconfig eth1 eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.57.11 netmask 255.255.255.0 broadcast 192.168.57.255 inet6 fe80::20c:29ff:fead:6265 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:ad:62:65 txqueuelen 1000 (Ethernet) RX packets 3 bytes 180 (180.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12 bytes 918 (918.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2. Neutron配置
2.1 编辑 etc/neutron/plugins/ml2/linuxbridge_agent.ini
,配置linuxbridge
[root@linux-node1 ~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini 138 physical_interface_mappings = public:eth0,internet:eth1
2.2 配置 /etc/neutron/plugins/ml2/ml2_conf.ini
[root@linux-node1 ~]# vim /etc/neutron/plugins/ml2/ml2_conf.ini flat_networks = public,internet
2.3 重启linuxbridge
[root@linux-node1 ~]# systemctl restart neutron-linuxbridge-agent.service
2.4 计算节点修改linuxbridge
配置文件
[root@linux-node2 network-scripts]# vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini 138 physical_interface_mappings = public:eth0,internet:eth1 [root@linux-node2 network-scripts]# systemctl restart neutron-linuxbridge-agent.servic
3. 创建网络
1.在控制节点上,加载 admin 凭证(需使用admin权限来创建)
[root@linux-node1 ~]# systemctl restart neutron-server #更改ml2配置需重启服务 [root@linux-node1 ~]# source admin-openstack.sh
2.创建网络
[root@linux-node1 ~]# neutron net-create --shared --provider:physical_network internet --provider:network_type flat internet-net Created a new network: +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | True | | availability_zone_hints | | | availability_zones | | | created_at | 2017-04-29T13:52:38 | | description | | | id | bb7b3982-cd78-4130-890d-2de1e0c6255c | | ipv4_address_scope | | | ipv6_address_scope | | | mtu | 1500 | | name | internet-net | | port_security_enabled | True | | provider:network_type | flat | | provider:physical_network | internet | | provider:segmentation_id | | | router:external | False | | shared | True | | status | ACTIVE | | subnets | | | tags | | | tenant_id | eac1d8e85417450bafe92987e5d56778 | | updated_at | 2017-04-29T13:52:38 | +---------------------------+--------------------------------------+
3.创建子网
[root@linux-node1 ~]# neutron subnet-create --name internet-subnet --allocation-pool start=192.168.57.100,end=192.168.57.200 --dns-nameserver 223.5.5.5 internet-net 192.168.57.0/24 Created a new subnet: +-------------------+------------------------------------------------------+ | Field | Value | +-------------------+------------------------------------------------------+ | allocation_pools | {"start": "192.168.57.100", "end": "192.168.57.200"} | | cidr | 192.168.57.0/24 | | created_at | 2017-04-29T13:56:23 | | description | | | dns_nameservers | 223.5.5.5 | | enable_dhcp | True | | gateway_ip | 192.168.57.1 | | host_routes | | | id | 82180df7-3e08-48ba-9051-2a183f577872 | | ip_version | 4 | | ipv6_address_mode | | | ipv6_ra_mode | | | name | internet-subnet | | network_id | bb7b3982-cd78-4130-890d-2de1e0c6255c | | subnetpool_id | | | tenant_id | eac1d8e85417450bafe92987e5d56778 | | updated_at | 2017-04-29T13:56:23 | +-------------------+------------------------------------------------------+
4.查看网络
[root@linux-node1 ~]# openstack network list +--------------------------------------+--------------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+--------------+--------------------------------------+ | f3006de4-de03-4bec-af7f-40d3791b645e | public-net | 0cf4b0dd-79de-44c4-be7c-ca6d8ee88f09 | | bb7b3982-cd78-4130-890d-2de1e0c6255c | internet-net | 82180df7-3e08-48ba-9051-2a183f577872 | +--------------------------------------+--------------+--------------------------------------+
5.创建阿里云ECS网络