Hard, ย onย  Linux,ย Containers,ย Networking Submissions: 9/20

Your task is to reproduce the Docker bridge network from the picture below. This is it, this is the challenge.

Docker bridge network visualized.

Create two network namespaces representing two containers.

Hint 1 ๐Ÿ’ก

Don't know where to start? Try solving this simpler challenge first: Create a Linux Network Namespace.

Connect the two network namespaces with the host network namespace using virtual Ethernet pairs.

Hint 2 ๐Ÿ’ก

Solving the Connect Two Network Namespaces challenge first might help you here.

Add the bridge interface, configure it, and connect the host ends of the virtual Ethernet pairs to the bridge.

Assign IP addresses to the container ends of the virtual Ethernet pairs and configure the routing to allow the host and the containers to communicate. 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 ๐Ÿ’ก

The challenge you may want to solve first ๐Ÿ‘‰ Connect Multiple Network Namespaces.

Set up Network Address Translation (NAT) on the host to allow the containers to communicate with the outside world.

Hint 4 ๐Ÿ’ก

Set Up Network Address Translation (NAT) for a Container is a good challenge to solve first.

Hint N ๐Ÿ’ก

The knowledge gap is too big? No worries, we got you covered! After following the How Container Networking Works - Building a Linux Bridge Network From Scratch tutorial you will be able to solve this challenge with ease.

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