Docker (and the like) give the containerized application an illusion of having 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 and inspect its network interfaces. How many interfaces a freshly created network namespace has?
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 and store the output 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,000 engineers who receive insightful learning materials straight to their inbox