Hard, ย onย  Linux,ย Containers,ย Networking Submissions: 18/62

This is a more advanced continuation of the Connect Two Network Namespaces problem.

Multiple Linux network namespaces trying to intercommunicate.

Your task is to create two network namespaces, netns0 and netns1, add a virtual Ethernet device to each of them, and configure the devices such that the host and the containers can communicate with each other.

Hint 1 ๐Ÿ’ก

Not sure how to create a network namespace? Check out the Create a Network Namespace challenge.

Now, you need to create two virtual Ethernet pairs, i.e. four virtual Ethernet devices.

Hint 2 ๐Ÿ’ก

This part is fully covered in the Connect Two Network Namespaces challenge. You may want to solve that one first.

Finally, provision the network namespaces with IP addresses and configure the routing to allow the host and the containers to intercommunicate. At any given moment:

  • The host should be able to ping netns0.
  • The host should be able to ping netns1.
  • netns0 should be able to ping the host.
  • netns1 should be able to ping the host.
  • netns0 should be able to ping netns1.
  • netns1 should be able to ping netns0.
Hint 3 ๐Ÿ’ก

It might be that an extra network device is needed to make the setup work. The clue is in the tag list of this challenge ๐Ÿ˜‰

Hint 4 ๐Ÿ’ก

Most of the routing rules will be added automagically as soon as that missing network device is created, and the IP addresses are assigned for every participating network device. But there is one rule that you will need to add manually for both netns0 and netns1 - the default route.

Hint 5 ๐Ÿ’ก

Too hard? No worries! The How Container Networking Works: a Docker Bridge Network From Scratch tutorial has a step-by-step guide on how to solve this challenge.

Categories:ย Linux,ย Containers,ย Networking
Discussion:ย  Discord

Level up your server-side game โ€” Join 6,600 engineers who receive insightful learning materials straight to their inbox