Clone
13
networks setup
wluhan edited this page 2016-08-17 15:31:23 +02:00
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1. Install necessary packages:

sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager qemu-system uvtool-libvirt uvtool

type sudo kvm-ok, to check whether you can use kvm engine. if it shows like followings, then you can use kvm, otherwise you need boot into BIOS to enable virtualization.

INFO: /dev/kvm exists
KVM acceleration can be used

1.1 MAAS/JuJu Installation if you use JOID (https://wiki.opnfv.org/display/joid/JOID+Home)

2. Setup networks.

Basically, four networks will be created in OpNFV, named Admin (PXE boot), Public (Internet), Management, Storage. Management and storage network can be vlan tagged. We set these four network as below (you can modify those addresses according to your environment):

  • Admin: 10.20.0.0/24
  • Public: 172.16.0.0/24
  • Management: 192.168.0.0/24 VLAN tag:101
  • Storage: 192.168.1.0/24 VLAN tag 102

To deploy OpNFV, you will need at least two isolated networks, here we create two bridges for the network: brfuel and brpublic.

  • Admin and management network is connected the same bridge brfuel.
  • Public and storage netwrok is connected to the same bridge brpublic.

Create bridge brfuel:

sudo brctl addbr brfuel

Assign IP address for admin network:

sudo ifconfig brfuel 10.20.0.1/24 up

Create a VLAN for management network:

sudo ip link add name brfuel.101 link brfuel type vlan id 101

Assign an IP for management network:

sudo ifconfig brfuel.101 192.168.0.201/24 up

Assign IP for public network:

sudo ifconfig brpublic 172.16.0.1/24 up

Create VLAN for storage network:

sudo ip link add name brpublic.102 link brpublic type vlan id 102

assign IP for storage network

sudo ifconfig brpublic.102 192.168.1.201/24 up

Check the route in your host machine, it should be like this (neglect iface docker0): image

3. Make brpublic and brfuel have the access to Internet

Bridge brpublic will be used by each VM to connect to internet. And the master uses brfuel to manage other nodes and connect to internet. Before we do NAT on host machine, make sure ip forwarding is enabled:

echo 1 > /proc/sys/net/ipv4/ip_forward

Assume physical interface eth0 on the host machine is connected to external network, add rules in iptables with following commands

/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth0 -o brpublic -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i brpublic -o eth0 -j ACCEPT

And also do make NAT on brfuel, with following commands:

/sbin/iptables -A FORWARD -i eth0 -o brfuel -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i brfuel -o eth0 -j ACCEPT

Now, network setup is done. You can set up a VM to make a quick test your settings.