Had been trying to create multiple vm containers and make them reachable from the existing infrastructure switches.
So basically I will explain about my host system
My host system has two interfaces em1 and em2. em1 is attached to two vlan switch ports 211 and 103. So my interface looks like em1, em1.211, em1.103 and em2. em2 is reachable through my network.
1)Networking via veth:
I created a bridge interface br0 and attached it with em1.211 and em1.103. Now the containers use veth to bridge with br0 using veth pair. The usual flow of data will be
from outer world to container
em1.x(picks up in promisc mode)->br0->host veth pair->container
from outer world to host
em2(picks up packet as em1 has no ip)->host
2)Networking via macvlan:
Macvlan is a kernel feature which allows an interface to have multiple hw address and ip. So by default macvlan creates a new interface(virtual of an existing interface) with hw and ip addr pairs and then moves that interface to containers. If the link interface is given as br0 for config file with network type being vlan, the data flow here will be
from outer world to container
em1.x->br0->macvlan of container
But between containers communication as host do arp request for a container's ip when a request comes from another container in the network. But the requested container is behind the host and wont receive the arp packet. Communication between host and container is possible with the second interface of the host.
If macvlan type is made bridged, then containers packets with in themselves will be broadcasted to all macvlan interface and thereby making communication between containers possible. This method helps to get rid of veth pair interfaces on the host system, but the kernel needs to remember hardware address of all containers for inter vm communications
Comments
Post a Comment