I would like to connect the root network namespace to my custom network namespace in my Ubuntu box. Here is my network diagram:
Basically my custom network namespace is the one who control the vm network (such as assigning IP, etc).
I would like to see if I can set up a veth pair such that other Host which is the same subnet of eth1 (10.0.1.0/24) can access to it.
I was trying to do ip link set command but no luck with that as the interface (qg-1ee92648-d5) that I want to connect to is in the custom network namespace
Here is my Host network configuration:
vagrant@ubuntu:~$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:cd:e0:99 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:cd:e0:a3 brd ff:ff:ff:ff:ff:ff
vagrant@ubuntu:~$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:cd:e0:99 brd ff:ff:ff:ff:ff:ff
inet 192.168.106.129/24 brd 192.168.106.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fecd:e099/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:cd:e0:a3 brd ff:ff:ff:ff:ff:ff
inet 10.0.1.10/24 brd 10.0.1.255 scope global eth1
valid_lft forever preferred_lft forever
My custom namespace configuration:
vagrant@ubuntu:~$ sudo ip netns exec qrouter-7646dc10-7727-41b4-addd-8d08888cd764 ip
link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: qr-d174c5e5-c7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether fa:16:3e:b3:cc:c2 brd ff:ff:ff:ff:ff:ff
3: qg-1ee92648-d5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether fa:16:3e:f2:1d:2f brd ff:ff:ff:ff:ff:ff
vagrant@ubuntu:~$ sudo ip netns exec qrouter-7646dc10-7727-41b4-addd-8d08888cd764 ip
addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: qr-d174c5e5-c7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether fa:16:3e:b3:cc:c2 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.1/24 brd 10.0.0.255 scope global qr-d174c5e5-c7
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:feb3:ccc2/64 scope link
valid_lft forever preferred_lft forever
3: qg-1ee92648-d5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether fa:16:3e:f2:1d:2f brd ff:ff:ff:ff:ff:ff
inet 10.0.1.102/24 brd 10.0.1.255 scope global qg-1ee92648-d5
valid_lft forever preferred_lft forever
inet 10.0.1.101/32 brd 10.0.1.101 scope global qg-1ee92648-d5
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fef2:1d2f/64 scope link
valid_lft forever preferred_lft forever
Best Answer
Refer to this step-by-step guide: http://www.opencloudblog.com/?p=66
For example (quote from above post) if you want to connect two namespaces with one linux bridge and two veth pairs, in order to realize a topology in this graph:
Please refer to original post for more details on OVS. Cheers