OpenStack Victoria : Neutron Network (VXLAN)2021/08/31 |
Configure virtual networking by OpenStack Network Service (Neutron).
For example, configure VXLAN 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) |
[1] | Change settings on Control Node. |
root@dlp ~(keystone)#
vi /etc/neutron/plugins/ml2/ml2_conf.ini # line 139 : confirm setting tenant_network_types = vxlan # line 174 : change [ml2_type_flat] ..... ..... flat_networks = physnet1
# line 222 : confirm setting vni_ranges = 1:100 systemctl restart neutron-api neutron-rpc-server |
[2] | Change settings on Network Node. |
root@network:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini # line 139 : confirm setting tenant_network_types = vxlan # line 174 : change [ml2_type_flat] ..... ..... flat_networks = physnet1
# line 222 : confirm setting vni_ranges = 1:100
root@network:~#
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini # line 136 : add [agent]
prevent_arp_spoofing = True
# line 162 : add [linux_bridge]
physical_interface_mappings = physnet1:eth1
# line 225 : uncomment enable_vxlan = true
root@network:~#
vi /etc/neutron/dhcp_agent.ini # line 68 : add
dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf
for service in l3-agent dhcp-agent metadata-agent linuxbridge-agent; do systemctl restart neutron-$service done |
[3] | Change settings on Compute Node. |
root@node01:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini # line 139 : confirm setting tenant_network_types = vxlan # line 174 : change [ml2_type_flat] ..... ..... flat_networks = physnet1
# line 222 : confirm setting vni_ranges = 1:100
root@node01:~#
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini # line 136 : add [agent]
prevent_arp_spoofing = True
# line 225 : uncomment enable_vxlan = true systemctl restart neutron-linuxbridge-agent |
[4] | Create a Virtual router. It's OK to work on any node. (example below is on Control Node) |
root@dlp ~(keystone)# openstack router create router01 +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2021-08-31T23:44:09Z | | description | | | distributed | False | | external_gateway_info | null | | flavor_id | None | | ha | False | | id | 91eeffee-49ba-4328-aaae-7b652fd7dfef | | name | router01 | | project_id | 14c0b23f6f574380b9687f326debf0fe | | revision_number | 1 | | routes | | | status | ACTIVE | | tags | | | updated_at | 2021-08-31T23:44:09Z | +-------------------------+--------------------------------------+ |
[5] | Create internal network and associate with the router above. |
# create internal network root@dlp ~(keystone)# openstack network create private --provider-network-type vxlan +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2021-08-31T23:44:30Z | | description | | | dns_domain | None | | id | f30adecb-7c0b-4829-a5bd-d0836b3bffe2 | | ipv4_address_scope | None | | ipv6_address_scope | None | | is_default | False | | is_vlan_transparent | None | | mtu | 1450 | | name | private | | port_security_enabled | True | | project_id | 14c0b23f6f574380b9687f326debf0fe | | provider:network_type | vxlan | | provider:physical_network | None | | provider:segmentation_id | 1 | | qos_policy_id | None | | revision_number | 1 | | router:external | Internal | | segments | None | | shared | False | | status | ACTIVE | | subnets | | | tags | | | updated_at | 2021-08-31T23:44:31Z | +---------------------------+--------------------------------------+ # create subnet for internal network root@dlp ~(keystone)# openstack subnet create private-subnet --network private \ --subnet-range 192.168.100.0/24 --gateway 192.168.100.1 \ --dns-nameserver 10.0.0.10 +----------------------+--------------------------------------+ | Field | Value | +----------------------+--------------------------------------+ | allocation_pools | 192.168.100.2-192.168.100.254 | | cidr | 192.168.100.0/24 | | created_at | 2021-08-31T23:46:07Z | | description | | | dns_nameservers | 10.0.0.10 | | dns_publish_fixed_ip | None | | enable_dhcp | True | | gateway_ip | 192.168.100.1 | | host_routes | | | id | b2892d90-0b42-4785-b666-15688d9aaa5d | | ip_version | 4 | | ipv6_address_mode | None | | ipv6_ra_mode | None | | name | private-subnet | | network_id | f30adecb-7c0b-4829-a5bd-d0836b3bffe2 | | prefix_length | None | | project_id | 14c0b23f6f574380b9687f326debf0fe | | revision_number | 0 | | segment_id | None | | service_types | | | subnetpool_id | None | | tags | | | updated_at | 2021-08-31T23:46:07Z | +----------------------+--------------------------------------+ # set subnet to the router above root@dlp ~(keystone)# openstack router add subnet router01 private-subnet
|
[6] | Create external network and associate with the router above. |
# create external network root@dlp ~(keystone)# openstack network create \ --provider-physical-network physnet1 \ --provider-network-type flat --external public +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2021-08-31T23:46:41Z | | description | | | dns_domain | None | | id | 70d34670-7e68-4605-816b-244634a0a323 | | ipv4_address_scope | None | | ipv6_address_scope | None | | is_default | False | | is_vlan_transparent | None | | mtu | 1500 | | name | public | | port_security_enabled | True | | project_id | 14c0b23f6f574380b9687f326debf0fe | | provider:network_type | flat | | provider:physical_network | physnet1 | | provider:segmentation_id | None | | qos_policy_id | None | | revision_number | 1 | | router:external | External | | segments | None | | shared | False | | status | ACTIVE | | subnets | | | tags | | | updated_at | 2021-08-31T23:46:41Z | +---------------------------+--------------------------------------+ # create subnet for external network root@dlp ~(keystone)# openstack subnet create public-subnet \ --network public --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 --no-dhcp +----------------------+--------------------------------------+ | Field | Value | +----------------------+--------------------------------------+ | allocation_pools | 10.0.0.200-10.0.0.254 | | cidr | 10.0.0.0/24 | | created_at | 2021-08-31T23:47:01Z | | description | | | dns_nameservers | 10.0.0.10 | | dns_publish_fixed_ip | None | | enable_dhcp | False | | gateway_ip | 10.0.0.1 | | host_routes | | | id | 103cd703-3fc3-429a-a68b-52643757c619 | | ip_version | 4 | | ipv6_address_mode | None | | ipv6_ra_mode | None | | name | public-subnet | | network_id | 70d34670-7e68-4605-816b-244634a0a323 | | prefix_length | None | | project_id | 14c0b23f6f574380b9687f326debf0fe | | revision_number | 0 | | segment_id | None | | service_types | | | subnetpool_id | None | | tags | | | updated_at | 2021-08-31T23:47:01Z | +----------------------+--------------------------------------+ # set gateway to the router above root@dlp ~(keystone)# openstack router set router01 --external-gateway public |
[7] | By default, it's possible to access for all projects to external network, but for internal network, only admin projects can access to it, so grant access permission for internal network to a project you'd like to let users in the project use. |
# show network RBAC list root@dlp ~(keystone)# openstack network rbac list +--------------------------------------+-------------+--------------------------------------+ | ID | Object Type | Object ID | +--------------------------------------+-------------+--------------------------------------+ | de912fb5-8fef-482a-adcb-dc99be94a70c | network | 70d34670-7e68-4605-816b-244634a0a323 | +--------------------------------------+-------------+--------------------------------------+ # RBAC details # all projects can access only to [access_as_external] root@dlp ~(keystone)# openstack network rbac show de912fb5-8fef-482a-adcb-dc99be94a70c +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | action | access_as_external | | id | de912fb5-8fef-482a-adcb-dc99be94a70c | | name | None | | object_id | 70d34670-7e68-4605-816b-244634a0a323 | | object_type | network | | project_id | 14c0b23f6f574380b9687f326debf0fe | | target_project_id | * | +-------------------+--------------------------------------+ # show network list root@dlp ~(keystone)# openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 70d34670-7e68-4605-816b-244634a0a323 | public | 103cd703-3fc3-429a-a68b-52643757c619 | | f30adecb-7c0b-4829-a5bd-d0836b3bffe2 | private | b2892d90-0b42-4785-b666-15688d9aaa5d | +--------------------------------------+---------+--------------------------------------+ # show project list root@dlp ~(keystone)# openstack project list +----------------------------------+-----------+ | ID | Name | +----------------------------------+-----------+ | 14c0b23f6f574380b9687f326debf0fe | admin | | 1718217eee4b4f2ea143d65122864fe0 | service | | cba75a02a921457db62b660f3d0b57c4 | hiroshima | +----------------------------------+-----------+ # grant [access_as_shared] permission for [private] to [hiroshima] project root@dlp ~(keystone)# netID=$(openstack network list | grep private | awk '{ print $2 }') root@dlp ~(keystone)# prjID=$(openstack project list | grep hiroshima | awk '{ print $2 }') root@dlp ~(keystone)# openstack network rbac create --target-project $prjID --type network --action access_as_shared $netID +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | action | access_as_shared | | id | e9c6a173-4b40-41dd-89d0-34ff7b4cbcb3 | | name | None | | object_id | f30adecb-7c0b-4829-a5bd-d0836b3bffe2 | | object_type | network | | project_id | 14c0b23f6f574380b9687f326debf0fe | | target_project_id | cba75a02a921457db62b660f3d0b57c4 | +-------------------+--------------------------------------+ |
[8] | Login with a user who is in the project you granted access permission to internal network and Create and boot an instance. |
# 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 | +--------------------------------------+---------+--------------------------------------+ | 70d34670-7e68-4605-816b-244634a0a323 | public | 103cd703-3fc3-429a-a68b-52643757c619 | | f30adecb-7c0b-4829-a5bd-d0836b3bffe2 | private | b2892d90-0b42-4785-b666-15688d9aaa5d | +--------------------------------------+---------+--------------------------------------+ # create a security group for instances debian@dlp ~(keystone)$ openstack security group create secgroup01 +-----------------+-------------------------------------------------------------------------+ | Field | Value | +-----------------+-------------------------------------------------------------------------+ | created_at | 2021-08-31T23:50:58Z | | description | secgroup01 | | id | f7c62a05-57cf-4057-9063-064d9e8f19ac | | name | secgroup01 | | project_id | cba75a02a921457db62b660f3d0b57c4 | | revision_number | 1 | | rules | created_at='2021-08-31T23:50:58Z', direction='egress', ethertype='..... | | | created_at='2021-08-31T23:50:58Z', direction='egress', ethertype='..... | | stateful | True | | tags | [] | | updated_at | 2021-08-31T23:50:58Z | +-----------------+-------------------------------------------------------------------------+ # 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 | e9:49:9f:bf:73:1d:1a:39:48:91:c5:a1:43:ff:07:df | | name | mykey | | user_id | 62a91aa559f64acab11861ed7cd51ecc | +-------------+-------------------------------------------------+debian@dlp ~(keystone)$ netID=$(openstack network list | grep private | 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 | +--------------------------------------+-----------+--------+-------------------------+----------+----------+ | 86981ae7-d713-414f-966c-ac22387a3226 | Debian-11 | ACTIVE | private=192.168.100.211 | Debian11 | m1.small | +--------------------------------------+-----------+--------+-------------------------+----------+----------+ |
[9] | Assign floating IP address to the Instance above. |
debian@dlp ~(keystone)$ openstack floating ip create public +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | created_at | 2021-08-31T23:55:56Z | | description | | | dns_domain | None | | dns_name | None | | fixed_ip_address | None | | floating_ip_address | 10.0.0.249 | | floating_network_id | 70d34670-7e68-4605-816b-244634a0a323 | | id | 037fba2b-d0a4-425f-a3ee-d3891f03ae27 | | name | 10.0.0.249 | | port_details | None | | port_id | None | | project_id | cba75a02a921457db62b660f3d0b57c4 | | qos_policy_id | None | | revision_number | 0 | | router_id | None | | status | DOWN | | subnet_id | None | | tags | [] | | updated_at | 2021-08-31T23:55:56Z | +---------------------+--------------------------------------+
debian@dlp ~(keystone)$
openstack server add floating ip Debian-11 10.0.0.249
# confirm settings debian@dlp ~(keystone)$ openstack floating ip show 10.0.0.249 +---------------------+------------------------------------------------------------------------+ | Field | Value | +---------------------+------------------------------------------------------------------------+ | created_at | 2021-08-31T23:55:56Z | | description | | | dns_domain | None | | dns_name | None | | fixed_ip_address | 192.168.100.211 | | floating_ip_address | 10.0.0.249 | | floating_network_id | 70d34670-7e68-4605-816b-244634a0a323 | | id | 037fba2b-d0a4-425f-a3ee-d3891f03ae27 | | name | 10.0.0.249 | | port_details | admin_state_up='True', device_id='86981ae7-d713-414f-966c-ac22387..... | | port_id | 748fe8d9-19e5-473e-8031-1b195ef8f548 | | project_id | cba75a02a921457db62b660f3d0b57c4 | | qos_policy_id | None | | revision_number | 2 | | router_id | 91eeffee-49ba-4328-aaae-7b652fd7dfef | | status | ACTIVE | | subnet_id | None | | tags | [] | | updated_at | 2021-08-31T23:56:31Z | +---------------------+------------------------------------------------------------------------+debian@dlp ~(keystone)$ openstack server list +--------------------------------------+-----------+--------+-------------------------------------+----------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-----------+--------+-------------------------------------+----------+----------+ | 86981ae7-d713-414f-966c-ac22387a3226 | Debian-11 | ACTIVE | private=192.168.100.211, 10.0.0.249 | Debian11 | m1.small | +--------------------------------------+-----------+--------+-------------------------------------+----------+----------+ |
[10] | 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-31T23:57:50Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | 2cf2d179-19e6-487a-8ed0-a4cf74f96add | | 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 | f7c62a05-57cf-4057-9063-064d9e8f19ac | | tags | [] | | updated_at | 2021-08-31T23:57:50Z | +-------------------+--------------------------------------+ # permit SSH debian@dlp ~(keystone)$ openstack security group rule create --protocol tcp --dst-port 22:22 secgroup01 +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | created_at | 2021-08-31T23:58:04Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | bb7f1afb-851e-4c1c-84db-4adbf7f438fc | | 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 | f7c62a05-57cf-4057-9063-064d9e8f19ac | | tags | [] | | updated_at | 2021-08-31T23:58:04Z | +-------------------+--------------------------------------+debian@dlp ~(keystone)$ openstack security group rule list secgroup01 +--------------------------------------+-------------+-----------+-----------+------------+-----------------------+ | ID | IP Protocol | Ethertype | IP Range | Port Range | Remote Security Group | +--------------------------------------+-------------+-----------+-----------+------------+-----------------------+ | 2cf2d179-19e6-487a-8ed0-a4cf74f96add | icmp | IPv4 | 0.0.0.0/0 | | None | | 32cc619d-72e8-4f64-86b5-434a4135dad1 | None | IPv6 | ::/0 | | None | | 56316681-731f-413c-9b50-cc9cb5f61442 | None | IPv4 | 0.0.0.0/0 | | None | | bb7f1afb-851e-4c1c-84db-4adbf7f438fc | tcp | IPv4 | 0.0.0.0/0 | 22:22 | None | +--------------------------------------+-------------+-----------+-----------+------------+-----------------------+ |
[11] | It's possible to login to the Instance to connect to the floating IP address with SSH like follows. |
debian@dlp ~(keystone)$ openstack server list +--------------------------------------+-----------+--------+-------------------------------------+----------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-----------+--------+-------------------------------------+----------+----------+ | 86981ae7-d713-414f-966c-ac22387a3226 | Debian-11 | ACTIVE | private=192.168.100.211, 10.0.0.249 | Debian11 | m1.small | +--------------------------------------+-----------+--------+-------------------------------------+----------+----------+debian@dlp ~(keystone)$ ssh debian@10.0.0.249 The authenticity of host '10.0.0.249 (10.0.0.249)' can't be established. ECDSA key fingerprint is SHA256:97kilq+UUx4mUedQ6gdw+gKIf/D1ZumKK1DrhRbOmAo. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '10.0.0.249' (ECDSA) to the list of known hosts. Linux debian-11 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-11:~$ # logined |
Sponsored Link |