Introduction to Installation Architecture
The purpose of this paper is to build an environment of SDN, such as Neutron (Openvswitch + GRE), to learn how it works, to simulate the core principles, such as: the same tenant custom network instance interoperability, manually for instance distribution floating IP and other phase Content. <ignore_js_op>
Virtual network
You need to create a new 3 virtual network Net0, Net1, and Net2, which are configured in virtual box as follows.
- Net0:
- Network Name:virtualbox host-only Ethernet adapter#2
- Purpose:administrator/management Network
- IP block:10.20.0.0/24
- Dhcp:disable
- Linux Device:eth0
- Net1:
- Network Name:virtualbox host-only Ethernet adapter#3
- Purpose:public Network
- Dhcp:disable
- IP block:172.16.0.0/24
- Linux device:eth1
- Net2:
- Network Name:virtualbox host-only Ethernet adapter#4
- Purpose:storage/private Network
- Dhcp:disable
- IP block:192.168.4.0/24
- Linux Device:eth2
Copy Code
Virtual machines
You need to create a new 2 virtual machine VM1 and VM2, which are configured as follows.
- VM1:
- Name:network1
- Vcpu:1
- memory:1g
- disk:30g
- Network:net1,net2,net3
- VM2:
- Name:compute1
- Vcpu:1
- memory:1g
- disk:30g
- Networks:net1,net2,net3
Copy Code
Linux Interface Settings
- Network1
- eth0:10.20.0.201 (Management Network)
- eht1:172.16.0.201 (Public/external Network)
- eht2:192.168.4.201 (Private Network,gre tunning)
- Compute1
- ETH0:10.20.0.202 (Management Network)
- EHT1: (Disabled)
- eht2:192.168.4.202 (Private Network,gre tunning)
Copy Code
Simulating the installation of network nodes (NETWORK1)
Analog Network node-related implementation, such as L3, dhcp-agent implementation, in order to simulate the multi-node network situation, here also simulates a compute node, the simulation M2 Openvswitch implementation, the above run Instance1.
Network Interface Configuration
- Vi/etc/sysconfig/network-scripts/ifcfg-eth0
- Device=eth0
- Type=ethernet
- Onboot=yes
- Nm_controlled=yes
- Bootproto=static
- ipaddr=10.20.0.201
- netmask=255.255.255.0
- Vi/etc/sysconfig/network-scripts/ifcfg-eth1
- Device=eth1
- Type=ethernet
- Onboot=yes
- Nm_controlled=yes
- Bootproto=static
- ipaddr=172.16.0.201
- netmask=255.255.255.0
- Vi/etc/sysconfig/network-scripts/ifcfg-eth2
- Device=eth2
- Type=ethernet
- Onboot=yes
- Nm_controlled=yes
- Bootproto=static
- ipaddr=192.168.4.201
- netmask=255.255.255.0
Copy Code
Restart Network Service
- Service Network restart
Copy Code
Install the package that needs to be used
- Yum install libvirt openvswitch python-virtinst Xauth tigervnc-y
Copy Code
Remove the default Libvirt network for easy and clear analysis of network conditions
- Virsh Net-destroy Default
- Virsh Net-autostart--disable Default
- Virsh net-undefine Default
Copy Code
Set Allow Ipforwarding
- Vi/etc/sysctl.conf
- Net.ipv4.ip_forward=1
- Net.ipv4.conf.all.rp_filter=0
- Net.ipv4.conf.default.rp_filter=0
Copy Code
Immediate effect
- Sysctl-p
Copy Code
Start Openvswitch
- Service Openvswitch Start
- Chkconfig Openvswitch on
Copy Code
Create a Linux Bridge
- Brctl ADDBR Qbr01
- IP link Set Qbr01 up
Copy Code
Create a instance and connect to Qbr01 Bridge, the network Interface section is configured as follows
- <interface type= ' bridge ' >
- <source bridge= ' Qbr01 '/>
- <target dev= ' tap01 '/>
- <model type= ' Virtio '/>
- <driver name= ' Qemu '/>
- <address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x03 ' function= ' 0x0 '/>
- </interface>
Copy Code
You can refer to the attachment./gre/instance1.xml Create
- CP ~/gre//var/tmp/
- Cd/var/tmp/gre
- MV Cirros-0.3.0-x86_64-disk.img instance1.img
- Virsh Define Instance1.xml
- Virsh start Instance1
- Virsh Vncdisplay Instance1
- vncviewer:0
Copy Code
After you start the console, login to add the IP address 192.168.1.11
- IP addr Add 192.168.1.11/24 dev eth0
- Route add default GW 192.168.1.1
Copy Code
Create an internal bridge br-int, simulate OpenStack integrated bridge
- Ovs-vsctl ADD-BR Br-int
- Ovs-vsctl add-port br-int gre0--set interface gre0 Type=gre options:remote_ip=192.168.4.202
Copy Code
Create a Veth peer, connect the Linux bridge ' Qbr01 ' and Openvswich Bridge ' Br-ini '
- IP link Add qvo01 type Veth peer name Qvb01
- Brctl addif Qbr01 QVB01
- Ovs-vsctl Add-port Br-int qvo01
- Ovs-vsctl Set Port qvo01 tag=100
- IP link Set qvb01 up
- IP link Set qvo01 up
Copy Code
Check out the Br-int on NETWORK1 now.
- Ovs-vsctl Show
Copy Code
Simulating installation compute nodes (COMPUTE1)
Network Interface Configuration
- Vi/etc/sysconfig/network-scripts/ifcfg-eth0
- Device=eth0
- Type=ethernet
- Onboot=yes
- Nm_controlled=yes
- Bootproto=static
- ipaddr=10.20.0.202
- netmask=255.255.255.0
- Vi/etc/sysconfig/network-scripts/ifcfg-eth1
- Device=eth1
- Type=ethernet
- Onboot=yes
- Nm_controlled=yes
- Bootproto=static
- ipaddr=172.16.0.202
- netmask=255.255.255.0
- Vi/etc/sysconfig/network-scripts/ifcfg-eth2
- Device=eth2
- Type=ethernet
- Onboot=yes
- Nm_controlled=yes
- Bootproto=static
- ipaddr=192.168.4.202
- netmask=255.255.255.0
Copy Code
Restart Network Service
- Service Network restart
Copy Code
Install the package that needs to be used
- Yum install libvirt openvswitch python-virtinst Xauth tigervnc
Copy Code
Remove the Libvirt default network
- Virsh Net-destroy Default
- Virsh Net-autostart--disable Default
- Virsh net-undefine Default
Copy Code
Set Allow Ipforwarding
- Vi/etc/sysctl.conf
- Net.ipv4.ip_forward=1
- Net.ipv4.conf.all.rp_filter=0
- Net.ipv4.conf.default.rp_filter=0
Copy Code
Immediate effect
- Sysctl-p
Copy Code
Start Openvswitch
- Service Openvswitch Start
- Chkconfig Openvswitch on
Copy Code
Create a Linux Bridge
- Brctl ADDBR Qbr02
- IP link Set qbr02 up
Copy Code
Create a VM and connect to the Qbr02
On the GRE directory to the COMPUTE1 node, you can refer to the attachment./gre/instance2.xml Create
- CP ~/gre//var/tmp/
- Cd/var/tmp/gre
- MV Cirros-0.3.0-x86_64-disk.img instance2.img
- Virsh Define Instance2.xml
- Virsh Start Instance2
- Virsh Vncdesplay Instance2
- vncviewer:0
Copy Code
After you start the console, login to add IP to know 192.168.1.12
- IP addr Add 192.168.1.12/24 dev eth0
- Route add default GW 192.168.1.1
Copy Code
Create an internal bridge br-int, simulate OpenStack integrated bridge
- Ovs-vsctl ADD-BR Br-int
- Ovs-vsctl add-port br-int gre0--set interface gre0 Type=gre options:remote_ip=192.168.4.201
Copy Code
Create a Veth peer, connect the Linux bridge ' Qbr02 ' and Openvswich Bridge ' Br-ini '
- IP link Add qvo02 type Veth peer name qvb02
- Brctl addif Qbr02 QVB02
- Ovs-vsctl Add-port Br-int qvo02
- Ovs-vsctl Set Port qvo02 tag=100
- IP link Set qvb02 up
- IP link Set qvo02 up
Copy Code
Check out the Br-int on NETWORK1 now.
- Ovs-vsctl Show
Copy Code
Check if the Instance1 can be connected to the INSTANCE2 console
- Ping 192.168.1.11
Copy Code
Access to private network of tenants through networking Namespace
Add a namespace,dhcp01 to isolate the tenant network.
- IP netns Add dhcp01
Copy Code
192.168.1.0/24 for a private network, creating a DHCP service in the namespace Dhcp01
- Ovs-vsctl add-port br-int TAPDHCP01--set interface Tapdhcp01 type=internal
- Ovs-vsctl Set Port Tapdhcp01 tag=100
- IP link set tapdhcp01 netns dhcp01
- IP netns exec dhcp01 IP addr add 192.168.1.2/24 dev tapdhcp01
- IP netns exec dhcp01 IP link set tapdhcp01 up
Copy Code
Check network connectivity, Access Instance1 and Instance2 in namespace
- IP netns exec dhcp01 ping 192.168.1.12
- IP netns exec dhcp01 ping 192.168.1.11
Copy Code
L3 router through Network Namespace and iptables
Ovs-vsctl ADD-BR Br-ex
Reconfigure Eth1 and Br-ex
- Vi/etc/sysconfig/network-scripts/ifcfg-eth1
- Device=eth1
- Onboot=yes
- Bootproto=none
- Promisc=yes
- mtu=1546
- Vi/etc/sysconfig/network-scripts/ifcfg-br-ex
- Device=br-ex
- Type=bridge
- Onboot=yes
- Bootproto=none
- ipaddr0=172.16.0.201
- Prefix0=24
Copy Code
Restart the Network Service
- Ovs-vsctl add-port br-ex eth1 && Service Network restart
Copy Code
Check the network for connectivity after configuration
- Ping 172.16.0.201
Copy Code
Add a Namespace,router01 for routing and floating IP assignment
- IP netns Add Router01
Copy Code
Add an interface to Br-int as a gateway to the private network 192.168.1.0/24
- Ovs-vsctl add-port br-int Qr01--set interface Qr01 type=internal
- Ovs-vsctl Set Port Qr01 tag=100
- IP link set Qr01 netns Router01
- IP netns exec router01 IP addr add 192.168.1.1/24 dev Qr01
- IP netns exec router01 IP link set qr01 up
- IP netns exec router01 IP link set lo up
Copy Code
Add an interface in Br-ex for private network 192.168.1.0/24 set next hop address
- Ovs-vsctl add-port Br-ex QG01--set interface qg01 type=internal
- IP link set qg01 netns Router01
- IP netns exec router01 IP addr add 172.16.0.100/24 dev qg01
- IP netns exec router01 IP link set qg01 up
- IP netns exec router01 IP link set lo up
Copy Code
Analog assignment floating IP access Instance1
assigning floating ip,172.16.0.101 to Instance1 192.168.1.11
- IP netns exec router01 IP addr add 172.16.0.101/32 dev qg01
- IP netns exec router01 iptables-t nat-a output-d 172.16.0.101/32-j DNAT--to-destination 192.168.1.11
- IP netns exec router01 iptables-t nat-a prerouting-d 172.16.0.101/32-j DNAT--to-destination 192.168.1.11
- IP netns exec router01 iptables-t nat-a postrouting-s 192.168.1.11/32-j SNAT--to-source 172.16.0.101
- IP netns exec router01 iptables-t nat-a postrouting-s 192.168.1.0/24-j SNAT--to-source 172.16.0.100
Copy Code
Test floating IP
- Ping 172.16.0.101
Copy Code
If you need to clear NAT chain
- Iptables-t nat-f
Neutron SDN Manual Implementation Manual