{"id":5256,"date":"2025-02-28T06:34:26","date_gmt":"2025-02-28T06:34:26","guid":{"rendered":"https:\/\/www.liainfraservices.com\/blog\/?p=5256"},"modified":"2025-04-05T18:25:51","modified_gmt":"2025-04-05T18:25:51","slug":"how-to-create-and-manage-network-namespaces-in-a-linux-using-netns","status":"publish","type":"post","link":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/","title":{"rendered":"What is Network Namespace in Linux?"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 8<\/span> <span class=\"rt-label rt-postfix\">min read<\/span><\/span><div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 3,072<\/span><\/div>\n<p class=\"wp-block-paragraph\"><strong>Understanding Network Interfaces in Linux<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Onboard &amp; PCI slot<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Onboard: When the interface is integrated directly into motherboard<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PCI: Its an external card integrated into motherboard<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"297\" src=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-9.33.30-AM.png\" alt=\"\" class=\"wp-image-5266\" srcset=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-9.33.30-AM.png 647w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-28-at-9.33.30-AM-300x138.png 300w\" sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The ethernet names are changed, During physical days, we used eth0, eth1 as a name for ethernet card and the link name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But, due to virtualization, now even the links names are changed based on types of interface &amp; Physical topology<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdmFL-KXnid2taz8imNIBDV9NUahjmm9fejEftiioPgjvmdW8AzJYRIzIeeitH4LP7Nya0n1qlQkQFKoko2A2lXtcw6SOHqB_lQOKubhfxp7RhcGnCaGdgpcJ3ykSR5kzWgqC8WJA?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><span style=\"text-decoration: underline;\">Based on Types of <strong>Interfaces<\/strong>:<\/span><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ex: Ethernet interface begins with <code>en<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WLAN interface begins with <code>wl<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WWAN interface begins with <code>ww<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><span style=\"text-decoration: underline;\">Based on Physical <strong>Topology<\/strong>:<\/span><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If there is \u201c<strong><code>oN<\/code><\/strong>\u201d \u2013 Its an <code>(o)onboard<\/code> card &amp; (<code>N<\/code>): Number of Device<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : ex: eno1 \u2013 Its an onboarded Ethernet and its on Device 1, means on 1<sup>st<\/sup> slot<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If there is \u201c<strong><code>sN<\/code><\/strong>\u201d &#8211;&nbsp; s: It\u2019s a PCI pluggable device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : ex: ens4 : PCI slotted Ethernet card and its on 4<sup>th<\/sup> sloth or 4<sup>th<\/sup> device.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdtSWHIIp6B6RYZBLrq50W9gVmghm8qSdMRm8Bs9cJaoZX_MN4IoQdiMCyJzN0wJ5WXYdFoUeopO-dCNaHGoxdAyDaaFdWHyXgoH7ZdSzgq9mnW1sI771qJCuNia9nUEyCFwmzu?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">To list the interfaces attached to a server: <code>ip link<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To check if there is any IP attached to these interface : <code>ip a show&nbsp;<\/code> [ ip address show]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To see the info about a specific interface :<code>ip link show ens4<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To know the traffic pass through that interface: (Check the stats -s) :<code><kbd> ip -s link show ens4<\/kbd><\/code> <em>[ Very important command for real life troubleshooting]<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">: it has these metrices like<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>TX<\/code>: no of packet transmitted out<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>RX<\/code>: no of packet Received<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Error\/drop<\/code>: these shows how many packets are dropped etc<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To check if the host can communicate with other host on different network<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For that we need to check the host route table : <code>route -n<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">o &nbsp; This gives the info, about the gateway through which the traffic would pass through<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If there is no route, we have to add the route<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">o &nbsp; <code>ip route add destination_network via router_gateway<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ex: Host IP: 192.168.1.4 wants to communicate with host 192.168.5.4<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">o&nbsp; <code>&nbsp;ip route add 192.168.5.0\/24 via 192.168.1.0<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">o&nbsp; <code>&nbsp;ip route add default via 192.168.1.0<\/code> # Default is same as 0.0.0.0(Internet)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Host wants to connect to another host, but is unable to remember the IP, so it&#8217;s good to remember using some name and for that DNS server is needed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">DNS records are stored in <code>\/etc\/resolv.conf<\/code> file on each host<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, the host is connected to internet and lot of services are running in the host, like nginx, ftp etc<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfOQrUc4cdRphUT3dsZWEezo19jmWxxTHPb11qukxCh0HGIVmy_qDBJ6idrs6Axj1erIK56UbJrLXX2d6o5OBXzcc-UUeI1s-ImmSqGhtIkyaC8vEzs4S7hTLj3WR9ZPVuZYlJ3Wg?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How to check the services and their ports which are opened in the host: <code>netstat -tulnp<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; &nbsp; But, netstat command became old and now ss command is used<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; &nbsp; <code>ss<\/code> : show socket&nbsp; [ socket statistics]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; &nbsp; check all socket info for all traffic for TCP : <code>ss -ta<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, far we have seen only the LIST of Network, but to do any modification, we would need a service like <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">NetworkManager<\/mark> or <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">systemd-networkd.service<\/mark><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check if the service is loaded : <code>systemctl list-units --type=service | grep -i \"network\"<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To manage the networks like create, edit, list new connections, we need a tool which belongs to NetworkManager service<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>nmcli&nbsp;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The IP configurations are not directly done on the interfaces. To understand how that works, we need to understand a very important concept about <strong>Connection<\/strong> &amp; <strong>Device<\/strong> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Device Vs Connection<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXc36hc5TD6EtlhOoZx_NBY4Eu0Ie4TydYQ3nniBBt7fAdTp5u7Yb3sLQ0QXXMUDA_fkdaSo5fyTgSAaFRRPnZ707X2i7DbYuIs7CGOsEtEQWJAhw9ZxemNPPvl2WZ87EybYtGMUxg?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\" style=\"width:380px;height:auto\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Device<\/strong>: Device is the physical interface like en01, but we don\u2019t assign IPs to the device these days directly<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Connection<\/strong>: It\u2019s a software component, where we assign the IP, Subet, DNS etc<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And then we attach the connection to LAN card, so its decoupled now,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Connection can be assigned to any LAN, one at a time.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdRZQwCNco6AmblIUVXWs6VzsCVX5P9Tj-bpOOeBU2cW_8Fxr5Ms-u1Kunxazrai6LuoAu2YymvUNhJkLV-ldjFJIwTiC283OE5dirZlaaxybx2nde0MICz2aBzOF1D-jZM1RUVBg?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So, we can have many connections created with different configurations and attach them to LAN when needed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How to see the list of connections: <code>nmcli con show<\/code> [con = connection]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How to check the info about a particular connection : <code>nmcli con show connection_name<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; &nbsp; ipv4.method \u2013 This shows if its static or dynamic IP assigned<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Lets uncover some critical commands and concepts related to connection and how that is attached to an interface<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How to create a new connection:\u00a0<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>nmcli con add con-name my_connection ifname eth0 type ethernet<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How to modify the existing connection:\u00a0<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>nmcli connection modify my_connection ipv4.method manual ipv4.address 192.168.1.19\/32 ipv4.gateway 192.169.1.1 ipv4.dns 192.168.1.1<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How to connect the connection with the ethernet device<\/strong>: <code>nmcli connection up my_connection<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>To check the status of all network interface<\/strong> : <code>nmcli dev status<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Docker Networking &amp; Namespace Isolation<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the below section, I am trying to show how a container runtime engine like Docker isolates the network using network namespace in a Linux Kernel based Host:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have got some fair understanding on the Networking on Linux host, lets understand how the networking works for the isolated namespace called containers<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As we know, when we work with Linux, most of the process run on the global namespace, but if some process needs isolation, we can use namespace for that, <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For an example: <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Filesystem: chroot<br>Network : ip netns<br>Process : unshare PID<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">List of all namespace : <code>lsns -t pid<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, when we create a container, its in its own namespace and it does not have any communication in or out. To establish connection, we have to use the concept that we have seen above, like creating interfaces, making them up and the add an IP and route, but for that we would need to create the network namespace using netns.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, whatever we would see below are the manual way of isolating the network in its own namespace and then attaching the interface and enabling connection, but, please note, docker or other container runtime engine is making it easier by providing the simple commands. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Docker network works on CNM (container Network model), when we install docker in Host, it automatically creates the default network (docker0) and it uses bridge driver.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To check that: <code>nmcli con show<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To check more about the connection: <code>nmcli con show docker0<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To check its link and ip : <code>ip link show &amp; ip a show<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How to find more info about docker : docker info<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How to check more about the docker bridge network : <code>brctl show<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXfTzq_riOFep3LDqOwvCAEMFXRb4ER9_hLM2nMDZ1ldGCHXxXqyqbhK_6DFLwfyw1KhIZX45CYk4375PqP_YKYoiDv-nrOvrJu8kaBZIyNS4eFyDr-Is200uBo0I4oZToFDOd4Krw?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">We can see that, It does not have any interface attached.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But, the moment we create a container, it creates a veth interface connecting the container to the docker0 network.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdet9At1EZ3j8r_03dHmDBAIGmTMFpWlKwvONZmgyLJ3DdC935Y7zWnpLuiXWfGPVTmTXLi7hVEFIZtHEBnc5Du6Az-Z7KfJrirmtEWFD_ipxhnSSxa-NSgKX6XeU1tuZGdZMpvmQ?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">But, from the inside of the container, it assumes that it created two interfaces, loopback and eth0 interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since the container is connected to docker0 network, so it gets the IP in this network range<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdPqhdte1e3jXqGn4cAXwUKuCYvZPsifb6xrrlyJuoKp3ZhPGjhpyXlgpQIKyP1Sk6TWIKiwP51drmVZZ5Y7rxb_riwFCN4zWrCsSGb5haWKsrNDpt4d70rSuNzq3f10Da_kpjqDA?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXcSD9HLTxIqnLfnac6eS5HLZQJdHu31Dq4WaNhpTKIC1tG4uxRjdHFgy1yTd6KGih6lMktuEMM4MSGOSvXFJe35U0CGueNdWstNpreBSqSem4akiWPTCKAG2R9lQf0AtUnUO57x?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Docker can create a bridge network using a bridge driver<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>: docker network create -d bridge my_doc_bridge<br>: Delete: docker network rm my_doc_bridge<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But, even the Linux also can create a bridge network<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>: sudo ip link add Linux_bridge type bridge<br>: Delete: sudo ip link delete my_bridge type bridge<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Linux uses namespace to isolate the container:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXdkmz92hWwtinxxg8e_3JONddVwbawDW6N7OZBUtmsbVVTBRQocBrnL6HfpAglZBrt2sDjvgEYZ5Od-_5z5FXDwtgGRDwY9Bi0TUOx4zPaK1xDunBG7mxIIDXvjig_tdEc-_XQBOA?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">How to create a process namespace: <code>sudo unshare -f --pid --mount-proc bash<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>this creates a container with isolated process<\/li>\n\n\n\n<li>&nbsp;ps -ef shows only one process from inside the container<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Before we jump into network isolation, we need to <strong>understand what VLAN IS<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"282\" src=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/vLAN-Networking-1024x282.png\" alt=\"\" class=\"wp-image-5258\" srcset=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/vLAN-Networking-1024x282.png 1024w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/vLAN-Networking-300x82.png 300w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/vLAN-Networking-768x211.png 768w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/vLAN-Networking-1536x422.png 1536w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/vLAN-Networking-2048x563.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Network devices like laptops, printers in one LAN are connected by a switch and all can communicate among each other, because all share the same broadcast domain.<\/li>\n\n\n\n<li>But, as the network grows, the network traffic management and security is a concern, so we designate few ports for one set of devices and other for other set, so that the traffic from one host does not broadcast to all available hosts on the switch, instead it can retain its broadcast traffic within its designated virtual LAN.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How to create a network namespace [ ip netns]<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>sudo ip netns add isolated_net<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-rt.googleusercontent.com\/docsz\/AD_4nXcku50nPF1ampTHjzRBOf4-VKBvrW6pXAgHXOxWsLx-RH_R7rKsafZkZ0b73-EnvC4LB6EC8Zna9ULtye8vzBFUf7RUvtspSXnuedLwtuUD-MM6CF2mMnxdFA6IFPzwUmy6lMtIlA?key=hcIzsKghoZXk8ecJ8Vy5Iw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">How to list the isolated network: <code>ip netns list<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For more help:<code> ip netns help<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How to perform any task inside that isolated network: we need to use <strong>exec<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">How to see the interface info : <code>sudo ip netns exec isolated_net ip link<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The isolated network has only one device \u201clo\u201d and its down and its only for loopback.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But, to make the isolated nw to communicate with outside, we need a way to connect them both with a virtual ethernet cable which obviously has two interfaces<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>So, now lets create that virtual ethernet with two interfaces peered<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>On our host:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Create Two Virtual Interfaces:&nbsp;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>create two virtual interfaces veth1 &amp; veth2 and if we peer them, they are virtually connected.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ip link add veth1 type veth peer name veth2<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>List the new interface on the host: <code>ip link list<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Add one interface to Host and other interface to the new isolated Network<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ip link set veth2 netns isolated_net #<\/code> Added the veth2 interface to the isolated nw<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check the isolated network and we can see the new interface is set to that now<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ip netns exec isolated_net ip link<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Now, we have to bring the isolated interface up<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;i<code>p netns exec isolated_net ip link set dev veth2 up<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But, since the lowerlayer is down, so we have to&nbsp; bring the peer interface on host also up :&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Bring up the host interface<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ip link set dev veth1 up<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now the interface inside the isolated nw is also up :&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ip netns exec isolated_net ip link<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Assign an IP to the Isolated Interface<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ip netns exec isolated_net ip addr add 192.168.1.4\/24 dev veth2<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Assign IP to the host interface:<\/strong>&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>ip addr add 192.168.1.5\/24 dev veth01<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Check the communication:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Able to communicate from host to virtual host: <code>ip addr add 192.168.1.2\/24 dev veth01<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From isolated network to host nw: <code>ip netns exec isolated_net ping -c 2 192.168.1.2<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is exactly what docker does when we create a container using <code>docker run<\/code> command.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It automatically does all these manual work for us and get the container connected with docker internal network docker0 through veth<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><span style=\"text-decoration: underline;\">Some useful handy command  to manage network in Linux.<\/span><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Step<\/td><td>Task<\/td><td>Command<\/td><\/tr><tr><td>1<\/td><td>Check available network interfaces<\/td><td><code>ip link<\/code><\/td><\/tr><tr><td>2<\/td><td>Create a new virtual network device (veth, bridge, etc.)<\/td><td><code>ip link add &lt;name&gt; type &lt;type&gt;<\/code><\/td><\/tr><tr><td>3<\/td><td>Bring the newly created device up<\/td><td><code>ip link set &lt;name&gt; up<\/code><\/td><\/tr><tr><td>4<\/td><td>Assign an IP address to an interface<\/td><td>i<code>p addr add &lt;ip_address&gt;\/&lt;subnet&gt; dev &lt;interface&gt;<\/code><\/td><\/tr><tr><td>5<\/td><td>View assigned IP addresses<\/td><td><code>ip a show<\/code><\/td><\/tr><tr><td>6<\/td><td>Attach a veth device to a network namespace<\/td><td><code>ip link set &lt;interface&gt; netns &lt;namespace&gt;<\/code><\/td><\/tr><tr><td>7<\/td><td>Create a new Network Namespace<\/td><td><code>ip netns add &lt;net_name&gt; &amp;&amp; ip netns list<\/code><\/td><\/tr><tr><td>8<\/td><td>Execute commands inside the namespace (check networking)<\/td><td><code>ip netns exec &lt;namespace&gt; ip link<\/code><\/td><\/tr><tr><td>9<\/td><td>Set default gateway (routing)<\/td><td><code>ip route add default via &lt;gateway&gt;<\/code><\/td><\/tr><tr><td>10<\/td><td>Verify routes<\/td><td><code>route -n <\/code>OR<code> ip route show<\/code><\/td><\/tr><tr><td>11<\/td><td>Delete a device<\/td><td><code>ip link delete &lt;interface&gt;<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 8<\/span> <span class=\"rt-label rt-postfix\">min read<\/span><\/span>3,072 Understanding Network Interfaces in Linux Onboard &amp; PCI slot &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Onboard: When the interface is integrated directly into motherboard &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PCI: Its an external card integrated into motherboard The<\/p>\n","protected":false},"author":1,"featured_media":5325,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"footnotes":""},"categories":[972],"tags":[],"class_list":["post-5256","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is Network Namespace in Linux? - Blog | Liainfraservices<\/title>\n<meta name=\"description\" content=\"What is network namespace in Linux, what is netns, Linux network namespace, how to create network namespace using netns\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Network Namespace in Linux? - Blog | Liainfraservices\" \/>\n<meta property=\"og:description\" content=\"What is network namespace in Linux, what is netns, Linux network namespace, how to create network namespace using netns\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog | Liainfraservices\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-28T06:34:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-05T18:25:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Containers-and-Network-Namespace-in-Linux.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2240\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Partho\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Partho\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/\"},\"author\":{\"name\":\"Partho\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/person\\\/b5a729cb152dd3bc7f07550ca9d223e4\"},\"headline\":\"What is Network Namespace in Linux?\",\"datePublished\":\"2025-02-28T06:34:26+00:00\",\"dateModified\":\"2025-04-05T18:25:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/\"},\"wordCount\":1470,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/Containers-and-Network-Namespace-in-Linux.png\",\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/\",\"name\":\"What is Network Namespace in Linux? - Blog | Liainfraservices\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/Containers-and-Network-Namespace-in-Linux.png\",\"datePublished\":\"2025-02-28T06:34:26+00:00\",\"dateModified\":\"2025-04-05T18:25:51+00:00\",\"description\":\"What is network namespace in Linux, what is netns, Linux network namespace, how to create network namespace using netns\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/Containers-and-Network-Namespace-in-Linux.png\",\"contentUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/02\\\/Containers-and-Network-Namespace-in-Linux.png\",\"width\":2240,\"height\":1260,\"caption\":\"Containers and Network Namespace in Linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\",\"item\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/category\\\/linux\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"What is Network Namespace in Linux?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\",\"name\":\"Blog | Liainfraservices\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\",\"name\":\"Blog | Liainfraservices\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/lia-logo-b-e1635340384244.png\",\"contentUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/lia-logo-b-e1635340384244.png\",\"width\":308,\"height\":96,\"caption\":\"Blog | Liainfraservices\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/person\\\/b5a729cb152dd3bc7f07550ca9d223e4\",\"name\":\"Partho\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"caption\":\"Partho\"},\"description\":\"Partho Das, founder of Lia Infraservices, has 15+ years of expertise in cloud solutions, DevOps, and infrastructure security. He provides consultation on architecture planning, DevOps setup, Kubernetes, and cloud migrations. Partho holds multiple AWS and Azure certifications, along with CISCO CCNA &amp; CCNP. Connect on LinkedIn\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/partho-dev\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is Network Namespace in Linux? - Blog | Liainfraservices","description":"What is network namespace in Linux, what is netns, Linux network namespace, how to create network namespace using netns","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/","og_locale":"en_US","og_type":"article","og_title":"What is Network Namespace in Linux? - Blog | Liainfraservices","og_description":"What is network namespace in Linux, what is netns, Linux network namespace, how to create network namespace using netns","og_url":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/","og_site_name":"Blog | Liainfraservices","article_published_time":"2025-02-28T06:34:26+00:00","article_modified_time":"2025-04-05T18:25:51+00:00","og_image":[{"width":2240,"height":1260,"url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Containers-and-Network-Namespace-in-Linux.png","type":"image\/png"}],"author":"Partho","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Partho","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/#article","isPartOf":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/"},"author":{"name":"Partho","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/person\/b5a729cb152dd3bc7f07550ca9d223e4"},"headline":"What is Network Namespace in Linux?","datePublished":"2025-02-28T06:34:26+00:00","dateModified":"2025-04-05T18:25:51+00:00","mainEntityOfPage":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/"},"wordCount":1470,"commentCount":0,"publisher":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/#primaryimage"},"thumbnailUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Containers-and-Network-Namespace-in-Linux.png","articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/","url":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/","name":"What is Network Namespace in Linux? - Blog | Liainfraservices","isPartOf":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/#primaryimage"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/#primaryimage"},"thumbnailUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Containers-and-Network-Namespace-in-Linux.png","datePublished":"2025-02-28T06:34:26+00:00","dateModified":"2025-04-05T18:25:51+00:00","description":"What is network namespace in Linux, what is netns, Linux network namespace, how to create network namespace using netns","breadcrumb":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/#primaryimage","url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Containers-and-Network-Namespace-in-Linux.png","contentUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2025\/02\/Containers-and-Network-Namespace-in-Linux.png","width":2240,"height":1260,"caption":"Containers and Network Namespace in Linux"},{"@type":"BreadcrumbList","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-create-and-manage-network-namespaces-in-a-linux-using-netns\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.liainfraservices.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Linux","item":"https:\/\/www.liainfraservices.com\/blog\/category\/linux\/"},{"@type":"ListItem","position":3,"name":"What is Network Namespace in Linux?"}]},{"@type":"WebSite","@id":"https:\/\/www.liainfraservices.com\/blog\/#website","url":"https:\/\/www.liainfraservices.com\/blog\/","name":"Blog | Liainfraservices","description":"","publisher":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.liainfraservices.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.liainfraservices.com\/blog\/#organization","name":"Blog | Liainfraservices","url":"https:\/\/www.liainfraservices.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2021\/10\/lia-logo-b-e1635340384244.png","contentUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2021\/10\/lia-logo-b-e1635340384244.png","width":308,"height":96,"caption":"Blog | Liainfraservices"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/person\/b5a729cb152dd3bc7f07550ca9d223e4","name":"Partho","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","caption":"Partho"},"description":"Partho Das, founder of Lia Infraservices, has 15+ years of expertise in cloud solutions, DevOps, and infrastructure security. He provides consultation on architecture planning, DevOps setup, Kubernetes, and cloud migrations. Partho holds multiple AWS and Azure certifications, along with CISCO CCNA &amp; CCNP. Connect on LinkedIn","sameAs":["https:\/\/www.linkedin.com\/in\/partho-dev\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/comments?post=5256"}],"version-history":[{"count":28,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5256\/revisions"}],"predecessor-version":[{"id":5338,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5256\/revisions\/5338"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/media\/5325"}],"wp:attachment":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/media?parent=5256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/categories?post=5256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/tags?post=5256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}