In this lab, we will be creating a namespace inside a Ubuntu host and try to send icmp
packets from outside the network.
1. First create a namespace ns1 and verify it is created
2. We will create a bridge br0 by which we get connected to the host.
3. We will create a virtual ethernet pair which will connect two device. Our ns1 and
bridge. Connect one end to ns1 and another end to the bridge.
4. Set ip address to bridge and the namespace’s end veth pair.
5. In the namespace, turn up the veth1 and loopback interface. Also check it can ping
to the bridge
6. As we will be using the Ubuntu host as a router to namespace. So we have to enable
ip forwarding in Ubuntu.
We can do it in another way, in /etc/[Link] uncomment the
net.ipv4.ip_forward=1
7. The ethernet adapter of Ubuntu host will be working as network address translator,
so we set up the NAT on the adapter.
For my system, ens33 is the ubuntu host ethernet adapter which connects it to the
main host windows.
8. To NAT the address space [Link]/24 to bridge and add forwarding rule between
br0 and veth1.
9. Now in the namespace, we will be adding default route or gateway to route every
packet on it from/to namespace.
10. From windows which is an outside network. It does not know anything about ns1 ip
[Link]. We will set a static route for [Link]/24 network. As the network
is in the Ubuntu system, we will tell windows to send the packet to Ubuntu if its for
the network [Link]/24.
[Link] MASK [Link] (/24) is for the network and [Link] is the ip
address of Ubuntu which will work as a router to the network.
11. Now we are able to ping from windows which is in outside of network
[Link]/24 to namespace