1.准备工作
1.1.在控制节点与计算节点互相ping对方主机名与IP地址
1.2.在控制节点与计算节点删除NetworkManager软件包
yum remove NetworkManager -y
2.创建虚拟网络
2.1.创建网络
[[email protected] ~]# source admin-openrc [[email protected] ~]# openstack network create --share --external --provider-physical-network provider --provider-network-type flat vm-network +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2020-01-21T07:04:39Z | | description | | | dns_domain | None | | id | 3f003554-62fa-4b6a-b204-0a12b28d26af | | ipv4_address_scope | None | | ipv6_address_scope | None | | is_default | None | | is_vlan_transparent | None | | location | cloud=‘‘, project.domain_id=, project.domain_name=‘Default‘, project.id=‘a72c37c8aaaa45b5af3833acbc2cf1d4‘, project.name=‘admin‘, region_name=‘‘, zone= | | mtu | 1500 | | name | vm-network | | port_security_enabled | True | | project_id | a72c37c8aaaa45b5af3833acbc2cf1d4 | | provider:network_type | flat | | provider:physical_network | provider | | provider:segmentation_id | None | | qos_policy_id | None | | revision_number | 1 | | router:external | External | | segments | None | | shared | True | | status | ACTIVE | | subnets | | | tags | | | updated_at | 2020-01-21T07:04:39Z | +---------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
2.2.创建子网
[[email protected] ~]# openstack subnet create --network vm-network --allocation-pool start=172.17.0.225,end=172.17.0.230 --dns-nameserver 218.30.19.50 --gateway 172.17.0.1 --subnet-range 172.17.0.0/24 vm-subnetwork +-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | allocation_pools | 172.17.0.225-172.17.0.230 | | cidr | 172.17.0.0/24 | | created_at | 2020-01-21T07:11:23Z | | description | | | dns_nameservers | 218.30.19.50 | | enable_dhcp | True | | gateway_ip | 172.17.0.1 | | host_routes | | | id | d5ec9bb2-b1f5-4bb8-87e6-559001f07c5c | | ip_version | 4 | | ipv6_address_mode | None | | ipv6_ra_mode | None | | location | cloud=‘‘, project.domain_id=, project.domain_name=‘Default‘, project.id=‘a72c37c8aaaa45b5af3833acbc2cf1d4‘, project.name=‘admin‘, region_name=‘‘, zone= | | name | vm-subnetwork | | network_id | 3f003554-62fa-4b6a-b204-0a12b28d26af | | prefix_length | None | | project_id | a72c37c8aaaa45b5af3833acbc2cf1d4 | | revision_number | 0 | | segment_id | None | | service_types | | | subnetpool_id | None | | tags | | | updated_at | 2020-01-21T07:11:23Z | +-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
3.查看网络配置
[[email protected] ~]# openstack network list +--------------------------------------+------------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+------------+--------------------------------------+ | 3f003554-62fa-4b6a-b204-0a12b28d26af | vm-network | d5ec9bb2-b1f5-4bb8-87e6-559001f07c5c | +--------------------------------------+------------+--------------------------------------+ [[email protected] ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens192: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:0c:29:17:73:d4 brd ff:ff:ff:ff:ff:ff inet 172.17.0.211/24 brd 172.17.0.255 scope global noprefixroute ens192 valid_lft forever preferred_lft forever inet6 fe80::d176:ba69:c9a9:74b7/64 scope link noprefixroute valid_lft forever preferred_lft forever 3: tap1b5e2f47-47@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether ea:14:2b:c5:a3:3d brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet6 fe80::5241:6957:a3e7:cef3/64 scope link noprefixroute valid_lft forever preferred_lft forever 4: brq3f003554-62: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 link/ether 06:55:35:4e:5f:98 brd ff:ff:ff:ff:ff:ff inet 172.17.0.211/24 brd 172.17.0.255 scope global brq3f003554-62 valid_lft forever preferred_lft forever inet6 fe80::455:35ff:fe4e:5f98/64 scope link valid_lft forever preferred_lft forever [[email protected] ~]# systemctl restart network [[email protected] ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens192: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc mq master brq3f003554-62 state UP group default qlen 1000 link/ether 00:0c:29:17:73:d4 brd ff:ff:ff:ff:ff:ff inet 172.17.0.211/24 brd 172.17.0.255 scope global ens192 valid_lft forever preferred_lft forever inet6 fe80::b76a:73d4:31fe:f693/64 scope link noprefixroute valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe17:73d4/64 scope link valid_lft forever preferred_lft forever 3: tap1b5e2f47-47@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master brq3f003554-62 state UP group default qlen 1000 link/ether ea:14:2b:c5:a3:3d brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet6 fe80::5241:6957:a3e7:cef3/64 scope link noprefixroute valid_lft forever preferred_lft forever 4: brq3f003554-62: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 00:0c:29:17:73:d4 brd ff:ff:ff:ff:ff:ff inet 172.17.0.211/24 brd 172.17.0.255 scope global brq3f003554-62 valid_lft forever preferred_lft forever inet6 fe80::455:35ff:fe4e:5f98/64 scope link valid_lft forever preferred_lft forever
原文地址:https://www.cnblogs.com/dukun166/p/12221875.html
时间: 2024-10-08 22:35:30