Testing virtual interface inside a multihost VxLAN one-to-one (unicast) or one-to-multi (multicast)

12 09 2016

– First of all, enable ip forward:

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

– Set up the VxLAN:

For unicast, define the local and remote IPs:
ip link add vxlan1 type vxlan id 42 remote 10.1.1.1 local 10.1.1.2 dev eth0 dstport 4789

For multicast, define the IP for the multicast group:
ip link add vxlan1 type vxlan id 42 group 239.1.1.1 dev eth0 dstport 4789

– Bring up the VxLAN:

ip link set up dev vxlan1

– Create the bridge and bring it up:

ip link add name br0 type bridge
ip link set br0 up

– Create the virtual ethernet interface, a veth pair, and bring up one side:

ip link add veth0 type veth peer name veth1
ip link set veth0 up

– Create the namespace and include the other side of the veth pair:

ip netns add blue
ip link set veth1 netns blue

– Set an IP address to the veth1 and bring it up, the same for lo:

ip netns exec blue ifconfig veth1 192.168.1.1/24 up
ip netns exec blue ip link set dev lo up

– Include the VxLAN and the veth interface into the bridge:

ip link set vxlan1 master br0
ip link set veth0 master br0

– If you choose the unicast way, repeat this process in the other hosts changing the “remote” and “local” IPs in the set up VxLAN step and the veth IP address when set up the veth1 address (in this example 192.168.1.3). You can only set up a one-to-one configuration.

– If you choose multicast, repeat the same process in each host changing only the veth IP address when set up the veth1 address (in this example 192.168.1.3). More than one host can register into the multicast group without problem.

– Test conectivity between different hosts:

Host1:
ip netns exec blue ping 192.168.1.3
PING 192.168.1.3 (192.168.1.3) 56(84) bytes of data.
64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=0.313 ms

ip netns exec blue traceroute 192.168.1.3
traceroute to 192.168.1.3 (192.168.1.3), 30 hops max, 60 byte packets
1 192.168.1.3 (192.168.1.3) 0.329 ms 0.273 ms 0.253 ms

Host2:
ip netns exec green ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.234 ms

ip netns exec green traceroute 192.168.1.1
traceroute to 192.168.1.1 (192.168.1.1), 30 hops max, 60 byte packets
1 192.168.1.1 (192.168.1.1) 0.256 ms 0.230 ms 0.209 ms

– View VxLAN information:

bridge fdb show dev vxlan1
00:00:00:00:00:00 dst 10.1.1.1 via eth0 self permanent
36:33:16:6a:4f:8b dst 10.1.1.1 self
36:33:16:6a:4f:8b vlan 0 master br0
b2:1f:24:b9:1a:39 vlan 0 master br0 permanen

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: