Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

OpenStack practice (9): Open vSwitch implementation of floating IP

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Architecture diagram:

Environment:

Openstack version of pike Control Node Host openstack-controller (ubuntu 16.04.5) 172.27.34.37 esn160, ens192, ens224

Compute node host openstack-computer (ubuntu 16.04.5) 172.27.34.38 Universe 138esn160, ens192vxlan100

Centos01 (172.27.100.5, floating ip172.27.34.11) vxlan101

Centos02 (172.27.101.22 minute ip172.27.34.12)

For details of ubuntu installation, please see the full record of Ubuntu16.04.5 installation in lvm mode.

For more information on openstack installation, please see: OpenStack practice (1): build p version of OpenStack by DevStack under Ubuntu16.04

The test contents of this paper are as follows:

Instance centos01 and centos02 can communicate with each other

Instances centos01 and centos02 can access the public network

Floating ip configuration, which assigns floating ip to instance, and the public network can access the instance directly.

Intranet configuration

The private network uses vxlan and is configured as follows:

Stack@openstack-controller:~$ source devstack/openrc admin adminstack@openstack-controller:~$ view / etc/neutron/plugins/ml2/ml2_ conf.ini [ml2] tenant_network_types = vxlanextension_drivers = port_securitymechanism_drivers = openvswitch,l2populationtype_drivers = local,flat,vlan,gre,vxlan, Geneve [agent] tunnel_types = vxlanl2_population = True [ovs] datapath_type = systembridge_mappings = tunnel_bridge = br-tunlocal_ip = 172.27.34.137

Compute node local_ip=172.27.34.138, others are the same.

Take effect after restart

Stack@openstack-controller:~$ sudo systemctl restart devstack@q*

VXLAN creation

Create vxlan100 and vxlan101

Graphical mode

Create vlan100

The network name is vxlan100 and the segment id is 100.

The subnet is 172.27.100.0amp 24.

Activate DHCP

Creation completed

Command mode

Create a network vxlan101

Stack@openstack-controller:~$ openstack network create-- provider-network-type vxlan-- provider-segment 101-- project admin vxlan101

Create a subnet subnet172.27.101.0

Stack@openstack-controller:~$ openstack subnet create-- network vxlan101-- subnet-range 172.27.101.0 subnet172.27.101.0 24-- gateway 172.27.101.1

External network configuration

The public network uses flat, and the configuration is as follows

Execute at the control node

Stack@openstack-controller:~$ view / etc/neutron/plugins/ml2/ml2_ conf.ini [ml2 _ type_flat] flat_networks = externalt [ovs] bridge_mappings = externaltt:br-ens224

Create a bridge br-ens224 and bridge the physical network card ens224 to the br-ens224

Stack@openstack-controller:~$ sudo ovs-vsctl add-br br-ens224stack@openstack-controller:~$ sudo ovs-vsctl add-port br-ens224 ens224

Restart network services

Stack@openstack-controller:~$ sudo systemctl restart devstack@q*

Create a public network ext_net_flat

Stack@openstack-controller:~$ openstack network create-provider-network-type flat-provider-physical-network externaltt-project admin-external ext_net_flat

Create a subnet subnet172.27.34.0

Stack@openstack-controller:~$ openstack subnet create-- network ext_net_flat-- subnet-range 172.27.34.0 24-- gateway 172.27.34.1-- no-dhcp subnet172.27.34.0

View the created network

Stack@openstack-controller:~$ openstack network list

Create a rout

Create a routing router_100_101

Stack@openstack-controller:~$ openstack router create-project admin router_100_101

Connect the router to the external network

Stack@openstack-controller:~$ openstack router set router_100_101-external-gateway ext_net_flat

Connect the router to the subnet

Stack@openstack-controller:~$ openstack router add subnet router_100_101 subnet172.27.101.0stack@openstack-controller:~$ openstack router add subnet router_100_101 subnet172.27.100.0

View routing information

Stack@openstack-controller:~$ openstack router list

Create an instance

Make a mirror image

Upload media CentOS-7-x86_64-GenericCloud-1809.qcow2c to / tmp directory, download address: http://cloud.centos.org/centos/7/images/

Generate a mirror centos7

Stack@openstack-controller:/tmp$ openstack image create centos7-file CentOS-7-x86_64-GenericCloud-1809.qcow2c-disk-format qcow2-container-format bare-public

Create a new key pair

Create a new key pair centos7

Stack@openstack-controller:~$ mkdir keysstack@openstack-controller:~$ cd keysstack@openstack-controller:~/keys$ openstack keypair create centos7 > centos7.pemstack@openstack-controller:~/keys$ chmod 600 centos7.pemstack@openstack-controller:~/keys$ lltotal 12drwxrwxr-x 2 stack stack 4096 Jan 24 10:53. / drwxr-xr-x 27 stack stack 4096 Jan 24 10:52.. /-rw- 1 stack stack 1680 Jan 24 10:53 centos7.pem

View key pair

Stack@openstack-controller:~$ nova keypair-list

Create a security group

Create a security group centos7

Stack@openstack-controller:~$ openstack security group create centos7

New rules allow ping and ssh

Stack@openstack-controller:~$ openstack security group rule create-protocol icmp centos7stack@openstack-controller:~$ openstack security group rule create-protocol TCP-dst-port 22 centos7

View security groups and rules

Stack@openstack-controller:~$ openstack security group liststack@openstack-controller:~$ openstack security group rule list centos7

Create an instance

Create an instance centos01

Stack@openstack-controller:~$ nova boot-flavor m1.small-image centos7-availability-zone nova:openstack-controller-nic net-name=vxlan100-key-name centos7-security-groups centos7 centos01

Flavor chooses m1.small, compute node selects openstack-controller, and network selects vxlan100.

Create an instance centos02

Stack@openstack-controller:~$ nova boot-flavor m1.small-image centos7-availability-zone nova:openstack-controller-nic net-name=vxlan101-key-name centos7-security-groups centos7 centos02

Flavor chooses m1.small, compute node selects openstack-controller, and network selects vxlan101.

View the created instance

Stack@openstack-controller:~$ nova list

Create a floating ip

Create floating IP

Create floating IP 172.27.34.11 Compact 12

Stack@openstack-controller:~$ openstack floating ip create-- project admin-- floating-ip-address 172.27.34.11 ext_net_flatstack@openstack-controller:~$ openstack floating ip create-- project admin-- floating-ip-address 172.27.34.12 ext_net_flatstack@openstack-controller:~$ openstack floating ip list

Floating ip Associated instance

The associated command is executed as follows

Stack@openstack-controller:~$ nova floating-ip-associate centos01 172.27.34.11 stack@openstack-controller:~$ nova floating-ip-associate centos02 172.27.34.12

View instance floating ip

Stack@openstack-controller:~$ nova list

test

Landing instance

Login instance centos01

Stack@openstack-controller:~/keys$ ssh-I centos7.pem centos@172.27.34.11

Ping external network

[centos@centos01 ~] $ping www.baidu.com

Ping centos02

[centos@centos01] $ping 172.27.101.22

Architecture diagram analysis

Port View

Vxlan100

Vxlan101

View Brid

Root@openstack-controller:~# ovs-vsctl show

Root@openstack-controller:~# brctl show

Patch port View

Patch port of br-int and br-tun

Br-int and br-tun are connected through patch port "patch-tun" and "br-tun"

Patch port of br-int and br-ens224

The two bridges br-int and br-ens224 are connected by int-br-ens224 and phy-br-ens224.

For details of Linux Bridge method, please see: OpenStack practice (4): implementing floating IP by Linux Bridge

Reference article:

Https://docs.openstack.org/zh_CN/user-guide/index.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report