Monday, February 8, 2016

OpenStack Provider Network- VLAN


OpenStack Provider Network- VLAN
Network configuration:
ovs-vsctl list-br
cat /etc/sysconfig/network-scripts/ifcfg-enp2s0
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex
DEVICE=enp2s0
NM_CONTROLLED=no
ONBOOT=yes
cat /etc/sysconfig/network-scripts/ifcfg-enp4s0
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex-34
DEVICE=enp4s0
NM_CONTROLLED=no
ONBOOT=yes
cat /etc/sysconfig/network-scripts/ifcfg-enp1s0
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
NM_CONTROLLED=no
NAME=enp1s0
UUID=8a026be9-dca0-4a66-982c-458ddb219adc
DEVICE=enp1s0
ONBOOT=yes
IPADDR=192.168.12.12
PREFIX=24
GATEWAY=192.168.12.254
DNS1=10.10.100.3
cat /etc/sysconfig/network-scripts/ifcfg-br-ex
DEVICE=br-ex
OVSBOOTPROTO=static
DNS1=10.10.100.3
IPADDR=192.168.31.34
NETMASK=255.255.255.0
MACADDR=00:50:43:00:45:3e
OVS_EXTRA=”set bridge $DEVICE other-config:hwaddr=$MACADDR”
NM_CONTROLLED=no
ONBOOT=yes
TYPE=OVSBridge
DEVICETYPE=ovs
cat /etc/sysconfig/network-scripts/ifcfg-br-ex-34
DEVICE=br-ex-34
OVSBOOTPROTO=static
DNS1=10.10.100.3
IPADDR=192.168.34.34
NETMASK=255.255.255.0
MACADDR=00:50:43:00:45:3e
OVS_EXTRA=”set bridge $DEVICE other-config:hwaddr=$MACADDR”
NM_CONTROLLED=no
ONBOOT=yes
TYPE=OVSBridge
DEVICETYPE=ovs
Add the VLAN ID while adding the port in Ovsbridge
ovs-vsctl add-port br-ex enp2s0 tag=231
ovs-vsctl add-port br-ex-34 enp4s0 tag=234
Verify the data flow with VLAN ID
ovs-ofctl dump-flows br-int
Edit the /etc/neutron/plugins/ml2/ml2_conf.ini file
make sure the below entries are available .
[ml2]
type_drivers = flat,vlan
tenant_network_types =
mechanism_drivers = openvswitch
[ml2_type_flat]
flat_networks = netvlan231,netvlan234
[ml2_type_vlan]
network_vlan_ranges = netvlan231:231:231,netvlan234:234:234
[securitygroup]
enable_security_group = True
enable_ipset = True
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
[ovs]
bridge_mappings = netvlan231:br-ex,netvlan234:br-ex-34
Edit the file /etc/neutron/dhcp_agent.ini and make sure the entries are there.
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
dhcp_delete_namespaces = True
verbose = True
dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf
Create Network
neutron net-create netvlan234 –shared –provider:network_type vlan –provider:segmentation_id 234 –provider:physical_network vlan234 –router:external
neutron subnet-create –name subnetvlan234 –gateway 192.168.34.254 –allocation-pool start=192.168.34.110,end=192.168.34.130 –enable-dhcp –dns-nameserver 10.10.100.3 netvlan234 192.168.34.0/24
neutron net-create netvlan231 –shared –provider:network_type vlan –provider:segmentation_id 231 –provider:physical_network netvlan231 –router:external
neutron subnet-create –name subnetvlan231 –gateway 192.168.31.254 –allocation-pool start=192.168.31.51,end=192.168.31.75 –enable-dhcp –dns-nameserver 10.10.100.3 netvlan231 192.168.31.0/24
Do the below change in the file /etc/nova/policy.json
“network:attach_external_network”: “rule:admin_api”
You just need to replace it with:
“network:attach_external_network”: “”
Since we will have multiple NICs with multiple subnet on the VMs, we would need to add the below script with changes to resolve routing issue.
Do the necessary changes as per the requirement
vim /etc/init.d/TenNetwork
#!/bin/bash
$logFile=/var/log/ten-network-log
ip route add 192.168.34.0/24 dev eth1 src 192.168.34.125 table TenNetwork
ip route add default via 192.168.34.254 dev eth1 table TenNetwork
ip route show 2>&1 >> $logFile
ip rule add from 192.168.34.125/32 table TenNetwork
ip rule add to 192.168.34.125/32 table TenNetwork
ip rule show 2>&1 >> $logFile
ip route show 2>&1 >> $logFile
chmod 700 /etc/init.d/TenNetwork
chkconfig TenNetwork on
chkconfig –list TenNetwork

No comments: