Monday 17 February 2014

VRF & Linux Network Name Space

Introduction

As we know, VRF (Virtual Routing and Forwarding on Switch) and Linux Network Name Space (on Linux hosts) can be used to achieve Network Isolation. Lets see how we can use them together.

Setup 

























On the Linux Host there are two namespaces, namely red and blue.
Each of the namespace is connected to its own Linux Bridge (i.e Red Namespace is connected to Bridge_red  and Blue Namespace is connected to Bridge_Blue ). Virtual Interface (veth0) connected to each bridge is assigned the same ip address (10.70.70.12/24). This L3 Network isolation achieved on the same host by using Network Namespaces.


Bridge_red is connected to external interface eth5 via eth5.80(eth5.80 sends tagged packet with vlan value as 80).
Bridge_blue is connected to external interface eth5 via eth5.90(eth5.80 sends tagged packet with vlan value as 90).

Linux host is connected to external device (that has VRF capability). 10.70.70.14/24 is the ip address configured on both the blue and red vrf's.


Commands to Create Red Name Space



Commands to Create Blue Name Space



Commands to Create VRF on external device.




Communication from Linux host to external device (ie Network Namespace to VRF)

Here ping is initiated from the veth0(10.70.70.12) in the blue namespace to 10.70.70.14 (in the blue VRF)











Here ping is initiated from the veth0(10.70.70.12) in the red namespace to 10.70.70.14 (in the redVRF)








Tcpdump can be used on LinuxBridge interfaces to verify that traffic is indeed flowing to the correct VRF on the external device.

Network Isolation (L3,ip address isolation)  can be achieved by using Linux Network Namespaces and VRFs.Also, we have seen here how they can be interconnected.

Network Isolation is an important concept in multi-tenant cloud environment.





Wednesday 12 February 2014

Security Groups

Introduction

Security Groups are like ip filter rules that are applied to an instances networking.When an instance is launched one more Security Groups are applied on it. The rules within the security groups determine what traffic is allowed for that instance. Rules from all Security Groups associated to the instance are evaluated to determine if traffic can be allowed to or from that instance.

Setup 

A network by the name "test_net" having two VMS attached to it namely "test_1" and "test_2"
We are using LinuxBridge with VLAN Networking enabled. 

The output from "brctl-show" is as follows





















Creation of Security Group

Create a security-group having rules to allow all kind of traffic in both directions (ingress,egress).


Associate security group with VM instances

Now associate "TEST_SEC_GROUP_ALLOW_ALL" to both the VM instances test_1 and test_2

Communication between the two VM instances 

Ping as well as ssh is possible between the two VM instances as the applied security group is the least restrictive.


















Security group that allows only SSH

Create security group that allows only incoming SSH traffic, associate it to both VM instances.
Note: Remove the earlier security group from the VM instances. SSH means TCP on port 22.


Communication between VM's

We observe that VM's can communicate only using SSH, ping between the VM's fails.














Under the hood

"IP tables" are utilized to enforce Security Groups on the tap interfaces connected to the VM instances.
Here the rule "-A neutron-linuxbri-i3ab26719-5 -p tcp -m tcp --dport 22 -j RETURN"  accepts TCP traffic on destination port 22(SSH)




Monday 10 February 2014

VLAN Networking OpenStack

Introduction

Here, We will look at how to setup a network (based on VLAN). Connect VM instances to these networks. Make necessary configurations so that VM's can communicate with each other across different networks. We also try to figure out how the Linux Bridge is setup as we configure the Network and the Virtual Machines.

This would be extended later using an external switch/router in the subsequent blog.

Read this blog to understand about Linux Network Namespaces

Create Network.

Created a new network named "application_net" having subnet "103.103.103.0/24" and gateway ip address as "103.103.103.1". VM's created on this network would have ip address allocated from this subnet.



List the Network and Subnet details.

Use neutron commands to see the created and network and subnet-details.



Create two Virtual Machines  connected to the Network.

Create two VM's "app_1" and "app_2" connected to this newly created Network "application_net"


Bridge details and Network Topology.

Let's see what all has happened under the hood.

A new bridge(Linux Bridge) is created by the name "brq5cc1629c-7d" and there are tap/veth interfaces that gets attached to the bridge.There is tap interface for that gets attached to the bridge for every VM in the network.(application_net)























Communication between two VM's

The two VM's app_1 and app_2 will be able to ping each other, as they are on the same network (application_network)

Ping between VM's in application_net












Create another network and VMs

Lets create another network "db_net" with  VMS "db_1" and "db_2"  in that network.
These two VM's would be able to talk to each other. (as they are on the same Linux bridge).






















Communication between VM's between the two networks

VM (app_1) in application_network will not be able to ping VM(db_1) in db_network.
In order to achieve such a communication, the two bridges should be connected to a router(Physical/Virtual)






















Once the two bridges are connected to the router, the two VMS (from different networks) would be able to ping each other.


















Friday 7 February 2014

Linux Network NameSpaces


Introduction


Namespace : A class of elements (e.g. addresses, file locations, etc.) in which each element has a name unique to that class, although it may be shared with elements in other classes. (Definition)

Generally, Linux shares a single set of Network interfaces and routing tables across the entire Operating System. With Networking Namespace, its now possible for each Namespace to have its own routing table and other networking constructs.

Creating a Network Namespace



Listing the Namespace





Executing a command in a Namespace



Adding interfaces to a Namespace

Its not possible to add a physical interface(like eth0) to a Namespace. One needs to create a virtual interface and add it to the Namespace. Virtual interfaces are created in pairs. One of them can be added to the default Namespace and other to the newly created Namespace.

Creating pair of Virtual Interface

Lets create two virtual interfaces "veth0" and "veth_blue". virtual interfaces are created here in the default namespace.



Adding Virtual Interface to a Namespace



This command adds veth0 to Namespace blue, the other pair (veth_blue) is still present in the default namespace


Listing of default Namespace

This commands show the listing of default namespace, veth_blue is still present in the default namespace.


Listing of blue Namespace

veth0 has now moved to the blue Namespace.


Similar setup for Red Namespace

Adding veth0 to red Namespace and its peer (veth_red) remains in the default namespace.