This post shows how to create images to emulate two types of virtual network functions (VNFs) you may come across. These images may be useful, for example, if you are trying to set up virtual Customer Premises Equipment (vCPE), as described in the first post of this series, Enabling vCPE with OpenStack.
- The bump-in-the-wire operation, such as frame-forwarding (L2 VNF)
- Software routing (L3 VNF)
Bump! What was that?
Make sure bridge-utils
is installed on the VM, and configure the bridge by adding the following to /etc/network/interfaces:
auto eth0
iface eth0 inet manual
up ifconfig eth0 0.0.0.0
up ifconfig ip link set eth0 promisc on
auto eth1
iface eth1 inet manual
up ifconfig eth1 0.0.0.0
up ifconfig ip link set eth1 promisc on
auto br100
iface br100 inet manual
bridge_ports eth0 eth1
bridge_stp on
bridge_waitport 0
The eth0
and eth1
ip addresses are cleared and the interfaces are set to promiscuous mode, so that they accept all packets.
The bridge is then created, with the ports eth0
and eth1
added to it. All traffic entering the VM on eth0
will exit on eth1
, and vice versa.
A software router
/etc/sysctl.conf
file:
net.ipv4.ip_forward = 1
net.ipv4.conf.eth0.proxy_arp = 1
net.ipv4.conf.eth1.proxy_arp = 1
The IP addresses for the ports on the “router” should be the default routes for the LAN and WAN networks, which is done when the networks and ports are being created.
Add the images
Once you have saved these images in a safe place, add them to Glance so they can be used for booting VMs:
$ glance image-create --name bump_image --disk-format qcow2 --container-format bare --file ~/ubuntu-bump-in-the-wire.qcow2
$ glance image-create --name router_image --disk-format qcow2 --container-format bare --file ~/ubuntu-router.qcow2
Congratulations, you now have two images available in Glance, which can be used for booting VMs!
This post first appeared on the Intel Developer Zone blog. Superuser is always interested in community content, email: [email protected].
Cover Photo // CC BY NC
- Enabling vCPE with OpenStack – Create the networks - September 2, 2016
- Enabling vCPE with OpenStack: Prepping the VNFs - August 26, 2016
- Enabling vCPE with OpenStack: Network configuration - August 19, 2016