Docker (and the like) gives the containerized application the illusion of running in a dedicated network environment. This is achieved by using Linux network namespaces that provide a fully isolated set of network devices, IP protocol stacks, routing tables, firewall rules, etc., for each container.

In this challenge, you'll need to create a new network namespace manually and then inspect its network interfaces.
First, create a new network namespace called my-net-ns
.
Hint 1 💡
There are multiple ways to create a network namespace.
For instance, you can use the unshare
command or the ip netns
command.
man unshare
and man ip-netns
are your friends.
Now, list the network interfaces of the my-net-ns
namespace.
How many interfaces a freshly created network namespace has?
Store the output of ip link ls
in the /tmp/my-net-ns-interfaces.txt
file.
Hint 2 💡
To list interfaces of a network namespace, you need to execute the ip link ls
command in that namespace.
Hint 3 💡
Again, there are multiple ways to execute a command in a network namespace.
You can either nsenter
it or use the ip netns exec
utility.
Try man nsenter
or man ip-netns
for more information.
Level up your Server Side game — Join 9,500 engineers who receive insightful learning materials straight to their inbox