OpenStack Rocky : Configure Neutron Network (VXLAN)2019/08/20 |
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 has 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 | | Open vSwitch | | Open vSwitch | | 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 108: add a value to tenant_network_types tenant_network_types = vxlan
# line 155: uncomment and change flat_networks = physnet1
systemctl restart neutron-api neutron-rpc-server |
[2] | Change settings on Network Node. |
# add bridge and add the anonymous interface above to the bridge port root@network:~# ovs-vsctl add-br br-eth1 root@network:~# ovs-vsctl add-port br-eth1 eth1
root@network:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini # line 108: add a value to tenant_network_type tenant_network_types = vxlan
# line 155: change [ml2_type_flat] ..... ..... flat_networks = physnet1
# line 204: confirm setting [ml2_type_vxlan] vni_ranges = 1:1000
root@network:~#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini # line 97: add [agent]
prevent_arp_spoofing = True
# line 109: uncomment tunnel_types = vxlan # line 195: uncomment and change bridge_mappings = physnet1:br-eth1
for service in l3-agent dhcp-agent metadata-agent openvswitch-agent; do systemctl restart neutron-$service done |
[3] | Change settings on Compute Node. |
root@node01:~#
vi /etc/neutron/plugins/ml2/ml2_conf.ini # line 108: add a value to tenant_network_type tenant_network_types = vxlan
# line 155: change [ml2_type_flat] ..... ..... flat_networks = physnet1
# line 204: confirm setting [ml2_type_vxlan] vni_ranges = 1:1000
root@node01:~#
vi /etc/neutron/plugins/ml2/openvswitch_agent.ini # line 97: add [agent]
prevent_arp_spoofing = True
# line 109: uncomment tunnel_types = vxlan systemctl restart neutron-openvswitch-agent |
[4] | Create a Virtual router. It's OK to work on any node. (This example is on Control Node) |
root@dlp ~(keystone)# openstack router create router01 +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2019-08-20T04:03:33Z | | description | | | distributed | False | | external_gateway_info | None | | flavor_id | None | | ha | False | | id | 735e5f7f-8c98-46c6-86b6-a7dc94602958 | | name | router01 | | project_id | 087b251e194c4962bc916e48694db744 | | revision_number | 0 | | routes | | | status | ACTIVE | | tags | | | updated_at | 2019-08-20T04:03:33Z | +-------------------------+--------------------------------------+ |
[5] | Create internal network and associate with the router above. |
# create internal network root@dlp ~(keystone)# openstack network create int_net --provider-network-type vxlan +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2019-08-20T04:03:51Z | | description | | | dns_domain | None | | id | 0b5e9fa8-b57f-47c0-af13-debc989baa28 | | ipv4_address_scope | None | | ipv6_address_scope | None | | is_default | False | | is_vlan_transparent | None | | mtu | 1450 | | name | int_net | | port_security_enabled | True | | project_id | 087b251e194c4962bc916e48694db744 | | provider:network_type | vxlan | | provider:physical_network | None | | provider:segmentation_id | 56 | | qos_policy_id | None | | revision_number | 1 | | router:external | Internal | | segments | None | | shared | False | | status | ACTIVE | | subnets | | | tags | | | updated_at | 2019-08-20T04:03:51Z | +---------------------------+--------------------------------------+ # create subnet in the internal network root@dlp ~(keystone)# openstack subnet create subnet1 --network int_net \ --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 | 2019-08-20T04:04:35Z | | description | | | dns_nameservers | 10.0.0.10 | | enable_dhcp | True | | gateway_ip | 192.168.100.1 | | host_routes | | | id | c900d81a-1eda-4d90-b900-a06005f975d2 | | ip_version | 4 | | ipv6_address_mode | None | | ipv6_ra_mode | None | | name | subnet1 | | network_id | 0b5e9fa8-b57f-47c0-af13-debc989baa28 | | project_id | 087b251e194c4962bc916e48694db744 | | revision_number | 0 | | segment_id | None | | service_types | | | subnetpool_id | None | | tags | | | updated_at | 2019-08-20T04:04:35Z | +-------------------+--------------------------------------+ # set internal network to the router above root@dlp ~(keystone)# openstack router add subnet router01 subnet1
|
[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 ext_net +---------------------------+--------------------------------------+ | Field | Value | +---------------------------+--------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2019-08-20T04:05:12Z | | description | | | dns_domain | None | | id | 60c664d6-d7fd-4009-9888-74801655b422 | | ipv4_address_scope | None | | ipv6_address_scope | None | | is_default | False | | is_vlan_transparent | None | | mtu | 1500 | | name | ext_net | | port_security_enabled | True | | project_id | 087b251e194c4962bc916e48694db744 | | 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 | 2019-08-20T04:05:12Z | +---------------------------+--------------------------------------+ # create subnet in external network root@dlp ~(keystone)# openstack subnet create subnet2 \ --network ext_net --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 | 2019-08-20T04:05:38Z | | description | | | dns_nameservers | 10.0.0.10 | | enable_dhcp | False | | gateway_ip | 10.0.0.1 | | host_routes | | | id | 578a2608-e20f-4985-9ded-f9ecbfc1ef34 | | ip_version | 4 | | ipv6_address_mode | None | | ipv6_ra_mode | None | | name | subnet2 | | network_id | 60c664d6-d7fd-4009-9888-74801655b422 | | project_id | 087b251e194c4962bc916e48694db744 | | revision_number | 0 | | segment_id | None | | service_types | | | subnetpool_id | None | | tags | | | updated_at | 2019-08-20T04:05:38Z | +-------------------+--------------------------------------+ # set gateway to the router above root@dlp ~(keystone)# openstack router set router01 --external-gateway ext_net |
[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 of 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 | +--------------------------------------+-------------+--------------------------------------+ | 39496f8c-77b0-4bae-b151-a4014ef4f253 | network | 60c664d6-d7fd-4009-9888-74801655b422 | +--------------------------------------+-------------+--------------------------------------+ # RBAC details (all projects can access only for access_as_external) root@dlp ~(keystone)# openstack network rbac show 39496f8c-77b0-4bae-b151-a4014ef4f253 +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | action | access_as_external | | id | 39496f8c-77b0-4bae-b151-a4014ef4f253 | | name | None | | object_id | 60c664d6-d7fd-4009-9888-74801655b422 | | object_type | network | | project_id | 087b251e194c4962bc916e48694db744 | | target_project_id | * | +-------------------+--------------------------------------+ # show network list root@dlp ~(keystone)# openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 0b5e9fa8-b57f-47c0-af13-debc989baa28 | int_net | c900d81a-1eda-4d90-b900-a06005f975d2 | | 60c664d6-d7fd-4009-9888-74801655b422 | ext_net | 578a2608-e20f-4985-9ded-f9ecbfc1ef34 | +--------------------------------------+---------+--------------------------------------+ # show project list root@dlp ~(keystone)# openstack project list +----------------------------------+-----------+ | ID | Name | +----------------------------------+-----------+ | 087b251e194c4962bc916e48694db744 | admin | | 6de0ab5f5ae24824820df0ab890bd84f | hiroshima | | af821885c5934a9395aeabe996751847 | service | +----------------------------------+-----------+ # grant [access_as_shared] permission for [int_net] to [hiroshima] project root@dlp ~(keystone)# netID=$(openstack network list | grep int_net | 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 | 17fb895f-a3c8-4f84-a97a-12d4cb0fa245 | | name | None | | object_id | 0b5e9fa8-b57f-47c0-af13-debc989baa28 | | object_type | network | | project_id | 087b251e194c4962bc916e48694db744 | | target_project_id | 6de0ab5f5ae24824820df0ab890bd84f | +-------------------+--------------------------------------+ |
[8] | Login with a user who is in the project you granted access permission to internal network and Create and boot an instance. |
# show flavor list debian@dlp ~(keystone)$ openstack flavor list +----+----------+------+------+-----------+-------+-----------+ | ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public | +----+----------+------+------+-----------+-------+-----------+ | 0 | m1.small | 2048 | 10 | 0 | 1 | True | +----+----------+------+------+-----------+-------+-----------+ # show image list debian@dlp ~(keystone)$ openstack image list +--------------------------------------+----------+--------+ | ID | Name | Status | +--------------------------------------+----------+--------+ | 2f489eea-ca80-471d-b450-31664cd284b1 | Debian10 | active | +--------------------------------------+----------+--------+ # show network list debian@dlp ~(keystone)$ openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 0b5e9fa8-b57f-47c0-af13-debc989baa28 | int_net | c900d81a-1eda-4d90-b900-a06005f975d2 | | 60c664d6-d7fd-4009-9888-74801655b422 | ext_net | 578a2608-e20f-4985-9ded-f9ecbfc1ef34 | +--------------------------------------+---------+--------------------------------------+ # create a security group for instances debian@dlp ~(keystone)$ openstack security group create secgroup01 +-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ | created_at | 2019-08-20T04:08:39Z | | description | secgroup01 | | id | 7b89d209-e2b2-4a46-ab6e-f5333d626c75 | | name | secgroup01 | | project_id | 6de0ab5f5ae24824820df0ab890bd84f | | revision_number | 1 | | rules | created_at='2019-08-20T04:08:39Z', direction='egress', ethertype='IPv4', id='a43c625f-3a53-4cf0-87bf-af046c417fa3', updated_at='2019-08-20T04:08:39Z' | | | created_at='2019-08-20T04:08:39Z', direction='egress', ethertype='IPv6', id='d284c326-5238-4c40-89d5-e0e41302bb92', updated_at='2019-08-20T04:08:39Z' | | tags | [] | | updated_at | 2019-08-20T04:08:39Z | +-----------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+ # 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 | 83:e8:e9:da:28:a1:c9:be:b6:07:37:6a:79:94:f8:c5 | | name | mykey | | user_id | 2af053ff367b47fc9e1a9139c29340b6 | +-------------+-------------------------------------------------+debian@dlp ~(keystone)$ netID=$(openstack network list | grep int_net | awk '{ print $2 }')
debian@dlp ~(keystone)$
debian@dlp ~(keystone)$ openstack server create --flavor m1.small --image Debian10 --security-group secgroup01 --nic net-id=$netID --key-name mykey Debian_10
openstack server list +--------------------------------------+-----------+--------+------------------------+----------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-----------+--------+------------------------+----------+----------+ | ca63556d-5adc-4183-a2de-476da9f71780 | Debian_10 | ACTIVE | int_net=192.168.100.10 | Debian10 | m1.small | +--------------------------------------+-----------+--------+------------------------+----------+----------+ |
[9] | Assign floating IP address to the Instance above. |
debian@dlp ~(keystone)$ openstack floating ip create ext_net +---------------------+--------------------------------------+ | Field | Value | +---------------------+--------------------------------------+ | created_at | 2019-08-20T04:34:43Z | | description | | | dns_domain | None | | dns_name | None | | fixed_ip_address | None | | floating_ip_address | 10.0.0.219 | | floating_network_id | 60c664d6-d7fd-4009-9888-74801655b422 | | id | 21ae9ddc-203f-4aaf-99b1-cbdb8fe6c8d6 | | name | 10.0.0.219 | | port_details | None | | port_id | None | | project_id | 6de0ab5f5ae24824820df0ab890bd84f | | qos_policy_id | None | | revision_number | 0 | | router_id | None | | status | DOWN | | subnet_id | None | | tags | [] | | updated_at | 2019-08-20T04:34:43Z | +---------------------+--------------------------------------+debian@dlp ~(keystone)$ openstack server add floating ip Debian_10 10.0.0.219 # confirm settings debian@dlp ~(keystone)$ openstack floating ip show 10.0.0.219 +---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Field | Value | +---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | created_at | 2019-08-20T04:34:43Z | | description | | | dns_domain | None | | dns_name | None | | fixed_ip_address | 192.168.100.10 | | floating_ip_address | 10.0.0.219 | | floating_network_id | 60c664d6-d7fd-4009-9888-74801655b422 | | id | 21ae9ddc-203f-4aaf-99b1-cbdb8fe6c8d6 | | name | 10.0.0.219 | | port_details | admin_state_up='True', device_id='ca63556d-5adc-4183-a2de-476da9f71780', device_owner='compute:nova', mac_address='fa:16:3e:e0:b1:9f', name='', network_id='0b5e9fa8-b57f-47c0-af13-debc989baa28', status='ACTIVE' | | port_id | d835a1d1-2963-4d0c-be65-0e8ac14b23ca | | project_id | 6de0ab5f5ae24824820df0ab890bd84f | | qos_policy_id | None | | revision_number | 2 | | router_id | 735e5f7f-8c98-46c6-86b6-a7dc94602958 | | status | ACTIVE | | subnet_id | None | | tags | [] | | updated_at | 2019-08-20T04:36:38Z | +---------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+debian@dlp ~(keystone)$ openstack server list +--------------------------------------+-----------+--------+------------------------------------+----------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-----------+--------+------------------------------------+----------+----------+ | ca63556d-5adc-4183-a2de-476da9f71780 | Debian_10 | ACTIVE | int_net=192.168.100.10, 10.0.0.219 | Debian10 | 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 | 2019-08-20T04:37:38Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | 8cec4a91-e491-4cb2-8871-09b8fcf1c436 | | name | None | | port_range_max | None | | port_range_min | None | | project_id | 6de0ab5f5ae24824820df0ab890bd84f | | protocol | icmp | | remote_group_id | None | | remote_ip_prefix | 0.0.0.0/0 | | revision_number | 0 | | security_group_id | 7b89d209-e2b2-4a46-ab6e-f5333d626c75 | | updated_at | 2019-08-20T04:37:38Z | +-------------------+--------------------------------------+ # permit SSH debian@dlp ~(keystone)$ openstack security group rule create --protocol tcp --dst-port 22:22 secgroup01 +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | created_at | 2019-08-20T04:37:53Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | 5531ce0e-4725-414a-9a0c-52624bf566bf | | name | None | | port_range_max | 22 | | port_range_min | 22 | | project_id | 6de0ab5f5ae24824820df0ab890bd84f | | protocol | tcp | | remote_group_id | None | | remote_ip_prefix | 0.0.0.0/0 | | revision_number | 0 | | security_group_id | 7b89d209-e2b2-4a46-ab6e-f5333d626c75 | | updated_at | 2019-08-20T04:37:53Z | +-------------------+--------------------------------------+debian@dlp ~(keystone)$ openstack security group rule list +--------------------------------------+-------------+-----------+------------+--------------------------------------+--------------------------------------+ | ID | IP Protocol | IP Range | Port Range | Remote Security Group | Security Group | +--------------------------------------+-------------+-----------+------------+--------------------------------------+--------------------------------------+ | 0d96e5f5-f31c-4f38-87ce-3c9161c67d79 | None | None | | 3d6fa089-5901-4fe5-8bd1-e2421e2fa788 | 3d6fa089-5901-4fe5-8bd1-e2421e2fa788 | | 5531ce0e-4725-414a-9a0c-52624bf566bf | tcp | 0.0.0.0/0 | 22:22 | None | 7b89d209-e2b2-4a46-ab6e-f5333d626c75 | | 5e4efe2b-1024-4994-9153-94ee02931d5f | None | None | | None | 3d6fa089-5901-4fe5-8bd1-e2421e2fa788 | | 6ea9dd58-5e1f-438d-88b3-811aad1eaa2d | None | None | | 3d6fa089-5901-4fe5-8bd1-e2421e2fa788 | 3d6fa089-5901-4fe5-8bd1-e2421e2fa788 | | 7199a0ce-9e6b-485f-b0fe-62a6b0392671 | None | None | | None | 3d6fa089-5901-4fe5-8bd1-e2421e2fa788 | | 8cec4a91-e491-4cb2-8871-09b8fcf1c436 | icmp | 0.0.0.0/0 | | None | 7b89d209-e2b2-4a46-ab6e-f5333d626c75 | | a43c625f-3a53-4cf0-87bf-af046c417fa3 | None | None | | None | 7b89d209-e2b2-4a46-ab6e-f5333d626c75 | | d284c326-5238-4c40-89d5-e0e41302bb92 | None | None | | None | 7b89d209-e2b2-4a46-ab6e-f5333d626c75 | +--------------------------------------+-------------+-----------+------------+--------------------------------------+--------------------------------------+ |
[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 | +--------------------------------------+-----------+--------+------------------------------------+----------+----------+ | ca63556d-5adc-4183-a2de-476da9f71780 | Debian_10 | ACTIVE | int_net=192.168.100.10, 10.0.0.219 | Debian10 | m1.small | +--------------------------------------+-----------+--------+------------------------------------+----------+----------+debian@dlp ~(keystone)$ ssh debian@10.0.0.219 The authenticity of host '10.0.0.219 (10.0.0.219)' can't be established. ECDSA key fingerprint is SHA256:Xhng+j/ONxzdPTcoEnGmhJeY6aPyCL/AWUPln+5vrAw. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '10.0.0.219' (ECDSA) to the list of known hosts. Linux debian-10 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) 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-10:~$ # just logined |
Sponsored Link |
|