Challenge, Hard,  on  LinuxContainersNetworking Submissions: 24/62

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.

Level up your Server Side game — Join 8,400 engineers who receive insightful learning materials straight to their inbox