OpenStack Victoria : Neutron Network (FLAT)2021/08/31 |
Configure virtual networking by OpenStack Network Service (Neutron).
For example, configure FLAT type of networking on here.
Before it, Configure basic settings on Control Node, Network Node, Compute Node.
Furthermore, this example is based on the environment that Network Node and Compute Node have 2 network interfaces.
And also [eth1] is up without IP Address, refer to here of [1] to up anonymous interface. ------------+---------------------------+---------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ Control Node ] | | [ Network Node ] | | [ Compute Node ] | | | | | | | | MariaDB RabbitMQ | | L2 Agent | | Libvirt | | Memcached httpd | | L3 Agent | | Nova Compute | | Keystone Glance | | Metadata Agent | | L2 Agent | | Nova API | | | | | | Neutron Server | | | | | | Metadata Agent | | | | | +-----------------------+ +-----------+-----------+ +-----------+-----------+ eth1|(UP with no IP) eth1|(UP with no IP) |
[1] | Change settings like follows on both Network Node and Compute Node. |
root@network:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini # line 174 : change [ml2_type_flat] ..... ..... flat_networks = physnet1
root@network:~#
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini # line 162 : add [linux_bridge]
physical_interface_mappings = physnet1:eth1
systemctl restart neutron-linuxbridge-agent |
[2] | Create network. It's OK to work on any node. (example below is on Control Node) |
root@dlp ~(keystone)#
projectID=$(openstack project list | grep service | awk '{print $2}') # create network named [sharednet1] root@dlp ~(keystone)# openstack network create --project $projectID \ --share --provider-network-type flat --provider-physical-network physnet1 sharednet1 Created a new network: +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2021-08-31T08:42:39Z | | description | | | dns_domain | None | | id | b5cbb9ab-9600-413e-bdf0-fb3749213367 | | ipv4_address_scope | None | | ipv6_address_scope | None | | is_default | False | | is_vlan_transparent | None | | mtu | 1500 | | name | sharednet1 | | port_security_enabled | True | | project_id | 1718217eee4b4f2ea143d65122864fe0 | | provider:network_type | flat | | provider:physical_network | physnet1 | | provider:segmentation_id | None | | qos_policy_id | None | | revision_number | 1 | | router:external | Internal | | segments | None | | shared | True | | status | ACTIVE | | subnets | | | tags | | | updated_at | 2021-08-31T08:42:39Z | +---------------------------+--------------------------------------+ # create subnet [10.0.0.0/24] in [sharednet1] root@dlp ~(keystone)# openstack subnet create subnet1 --network sharednet1 \ --project $projectID --subnet-range 10.0.0.0/24 \ --allocation-pool start=10.0.0.200,end=10.0.0.254 \ --gateway 10.0.0.1 --dns-nameserver 10.0.0.10 Created a new subnet: +----------------------+--------------------------------------+ | Field | Value | +----------------------+--------------------------------------+ | allocation_pools | 10.0.0.200-10.0.0.254 | | cidr | 10.0.0.0/24 | | created_at | 2021-08-31T08:43:01Z | | description | | | dns_nameservers | 10.0.0.10 | | dns_publish_fixed_ip | None | | enable_dhcp | True | | gateway_ip | 10.0.0.1 | | host_routes | | | id | 4ccef7c3-7318-4479-b372-e52d96e189f3 | | ip_version | 4 | | ipv6_address_mode | None | | ipv6_ra_mode | None | | name | subnet1 | | network_id | b5cbb9ab-9600-413e-bdf0-fb3749213367 | | prefix_length | None | | project_id | 1718217eee4b4f2ea143d65122864fe0 | | revision_number | 0 | | segment_id | None | | service_types | | | subnetpool_id | None | | tags | | | updated_at | 2021-08-31T08:43:01Z | +----------------------+--------------------------------------+ # confirm settings root@dlp ~(keystone)# openstack network list +--------------------------------------+------------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+------------+--------------------------------------+ | b5cbb9ab-9600-413e-bdf0-fb3749213367 | sharednet1 | 4ccef7c3-7318-4479-b372-e52d96e189f3 | +--------------------------------------+------------+--------------------------------------+ |
[3] | Create and start a Virtual machine Instance with the network just created above. |
# confirm available [flavor] list debian@dlp ~(keystone)$ openstack flavor list +----+----------+------+------+-----------+-------+-----------+ | ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public | +----+----------+------+------+-----------+-------+-----------+ | 0 | m1.small | 2048 | 10 | 0 | 1 | True | +----+----------+------+------+-----------+-------+-----------+ # confirm available image list debian@dlp ~(keystone)$ openstack image list +--------------------------------------+----------+--------+ | ID | Name | Status | +--------------------------------------+----------+--------+ | 773971b3-b4be-4b07-aa06-fe8ca76b395d | Debian11 | active | +--------------------------------------+----------+--------+ # confirm available network list debian@dlp ~(keystone)$ openstack network list +--------------------------------------+------------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+------------+--------------------------------------+ | b5cbb9ab-9600-413e-bdf0-fb3749213367 | sharednet1 | 4ccef7c3-7318-4479-b372-e52d96e189f3 | +--------------------------------------+------------+--------------------------------------+ # create a security group for instances debian@dlp ~(keystone)$ openstack security group create secgroup01 +-----------------+---------------------------------------------------------------------------+ | Field | Value | +-----------------+---------------------------------------------------------------------------+ | created_at | 2021-08-31T09:11:50Z | | description | secgroup01 | | id | 3917ede8-a357-46cd-af3c-df112b7c4193 | | name | secgroup01 | | project_id | cba75a02a921457db62b660f3d0b57c4 | | revision_number | 1 | | rules | created_at='2021-08-31T09:11:50Z', direction='egress', ethertype='IP..... | | | created_at='2021-08-31T09:11:50Z', direction='egress', ethertype='IP..... | | stateful | True | | tags | [] | | updated_at | 2021-08-31T09:11:50Z | +-----------------+---------------------------------------------------------------------------+ # create a SSH keypair for connecting to instances debian@dlp ~(keystone)$ ssh-keygen -q -N "" Enter file in which to save the key (/home/debian/.ssh/id_rsa): # add public-key debian@dlp ~(keystone)$ openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey +-------------+-------------------------------------------------+ | Field | Value | +-------------+-------------------------------------------------+ | fingerprint | ef:8a:e6:db:00:11:30:dd:02:b1:b6:b0:9f:2d:57:02 | | name | mykey | | user_id | 62a91aa559f64acab11861ed7cd51ecc | +-------------+-------------------------------------------------+debian@dlp ~(keystone)$ netID=$(openstack network list | grep sharednet1 | awk '{ print $2 }')
debian@dlp ~(keystone)$
debian@dlp ~(keystone)$ openstack server create --flavor m1.small --image Debian11 --security-group secgroup01 --nic net-id=$netID --key-name mykey Debian-11
openstack server list +--------------------------------------+-----------+--------+-----------------------+----------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-----------+--------+-----------------------+----------+----------+ | e2144a46-183e-481e-8b40-5bf517b1431a | Debian-11 | ACTIVE | sharednet1=10.0.0.254 | Debian11 | m1.small | +--------------------------------------+-----------+--------+-----------------------+----------+----------+ |
[4] | Configure security settings for the security group you created above to access with SSH and ICMP. |
# permit ICMP debian@dlp ~(keystone)$ openstack security group rule create --protocol icmp --ingress secgroup01 +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | created_at | 2021-08-31T09:15:02Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | 45c81656-5cb9-4199-9ffc-8a1657e79e17 | | name | None | | port_range_max | None | | port_range_min | None | | project_id | cba75a02a921457db62b660f3d0b57c4 | | protocol | icmp | | remote_group_id | None | | remote_ip_prefix | 0.0.0.0/0 | | revision_number | 0 | | security_group_id | 3917ede8-a357-46cd-af3c-df112b7c4193 | | tags | [] | | updated_at | 2021-08-31T09:15:02Z | +-------------------+--------------------------------------+ # permit SSH debian@dlp ~(keystone)$ openstack security group rule create --protocol tcp --dst-port 22:22 secgroup01 +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | created_at | 2021-08-31T09:15:17Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | 84b92a0d-0237-47ae-a175-d2bce07475f4 | | name | None | | port_range_max | 22 | | port_range_min | 22 | | project_id | cba75a02a921457db62b660f3d0b57c4 | | protocol | tcp | | remote_group_id | None | | remote_ip_prefix | 0.0.0.0/0 | | revision_number | 0 | | security_group_id | 3917ede8-a357-46cd-af3c-df112b7c4193 | | tags | [] | | updated_at | 2021-08-31T09:15:17Z | +-------------------+--------------------------------------+debian@dlp ~(keystone)$ openstack security group rule list secgroup01 +--------------------------------------+-------------+-----------+-----------+------------+-----------------------+ | ID | IP Protocol | Ethertype | IP Range | Port Range | Remote Security Group | +--------------------------------------+-------------+-----------+-----------+------------+-----------------------+ | 1e25e933-e2cd-47a6-b729-7d19ba8b59e8 | None | IPv4 | 0.0.0.0/0 | | None | | 45c81656-5cb9-4199-9ffc-8a1657e79e17 | icmp | IPv4 | 0.0.0.0/0 | | None | | 84b92a0d-0237-47ae-a175-d2bce07475f4 | tcp | IPv4 | 0.0.0.0/0 | 22:22 | None | | efca3489-674f-4bba-8a7a-29eb5ead212d | None | IPv6 | ::/0 | | None | +--------------------------------------+-------------+-----------+-----------+------------+-----------------------+ |
[5] | Login to Instance. |
debian@dlp ~(keystone)$ ssh debian@10.0.0.254
The authenticity of host '10.0.0.254 (10.0.0.254)' can't be established.
ECDSA key fingerprint is SHA256:InwJlXliarVPnOMqwbUgb9rMo7qY6TeFMbbqoGUOm94.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.0.0.254' (ECDSA) to the list of known hosts.
Linux debian 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian@debian:~$ # logined
|
Sponsored Link |