The Story Of My Experiments With Linux

Part 1 (Aadi Parva)

Time :  7 : 58  AM on a bright Sunday
Location :  My favorite Cafe at Kakinada

My favorite café in Kakinada was bustling with people ordering their favorite coffee. As I sat at an empty table with two chairs (lucky to have found one), I could hear people talking but I could barely understand what they were talking about. My favorite coffee was on the table. Suddenly, a person came and sat on the opposite side of my table. He didn’t get his coffee yet. He even didn’t take my permission to join, yet he started a discussion with me.

Stranger : (In a calm tone) You must help me.

Me : Excuse me! Do I know you? I haven’t seen you before. You just came out of nowhere and asked me for help.

Stranger : You will get your answers soon, provided you do me a favor.

Me : What sort of favor do you want me to do? If it’s a monetary favor, I’m sorry I can’t help.

Stranger : (Laughing out loud), I don’t need any monetary favors. I want you to endorse me. I want you to do a brand promotion for me.

Me : (Looking even more confused), Endorse you for what?? I don’t even know your name. I don’t know what you do. Infact, I don’t know anything about you

Stranger : Okay. That’s a reasonable ask. My name is Network Namespace and I belong to the Linux family.

Me : (With a bit relaxed tone), Ah I see. I know some of the members of Linux Family. But I haven’t heard about you.

Stranger : I agree. Just like you, a lot of developers don’t know me or my siblings.

Me : You have siblings too?

Stranger : Yes, we are total of 8 siblings (8 namespace types). Namely, Cgroup, IPC, Network, Mount, PID, Time, User and UTS.
(Wow. This guy is very interesting. Let’s hear more from him.)

Me : Okay Network Namespace. Tell me more about you then.

Net Namespace : Sure. I enable the developers to create and isolate network environments through virtualization.

Me : WAIT. WAIT. WAIT. WAIT. That’s too much to take in. Could you please explain in more simplified terms?

Net Namespace : (with a slight smile on the face). Sure. Before I explain about myself, let me explain about what Namespace is.

Imagine an apartment complex with two giant buildings. These two buildings have their own entrance/exit points, elevators and their own floors. These two buildings will have their own names too. Such as tower-1 and tower-2 for example. Yet, they share a common Gym, Swimming Pool, function hall, parking garage and other amenities. To put this in simple terms, these two distinct buildings are attached to the same physical complex.
Drawing the similarities with computer terms, the physical complex is the computer and namespaces (two or many) can reside in the same computer much like the apartment buildings and can have access to the computer resources in a shared or an exclusive manner.
(Okay. Seems like Namespace is just another type of Virtual Machine that runs inside physical machine!! To me, this guy doesn’t seem to be different than a regular virtual machine. Should I ask him this or wait till he finishes??)

Me : (Controlling my curiosity of drawing parallels with virtual machine) OKAY. Sounds interesting.

Net Namespace : Now, back to your first question (Who are you?). Imagine that you are working on a network project in which you need to simulate multiple hosts and each host needs to have its own routing table, firewall rules and different set of interfaces. What do you do?

Me : (Looks like this guy caught my curiosity). Mmmm. (With brooding eyes). I would go for some Virtual Machine technology (such as Oracle Virtual box or qemu’s VIrtual Machine) to bring up virtual machines and configure the routing table / firewall rules etc.

Net Namespace : Fair enough. But don’t you think it’s too much of a burden to create multiple virtual machines with each one consuming significant system memory and CPU?

Me : Yes. It is indeed a burden. Let’s say, to bring up 5 virtual machines with 1 core + 1GB RAM for each one, then I might run into CPU/memory related issues in my machine. But I could hardly think of an alternative.

Net Namespace : (with eyes full of pride) Well. I am the alternative. You can create multiple network namespaces within your system itself and configure each with their own routing tables, firewall rules etc. These namespaces are completely isolated, and you can think of them as hosts that are outside of your system.
(WAIT.. WHAT.. I thought these guys (namespaces) are just like virtual machines and especially this guy. But this guy is way better than virtual machine for most of the networking automation stuff)

Net Namespace : (waving at Stewart to get him a pen) To create a network namespace, you can use iproute2 package.

Here is the format : (Writing on the coffee table)
ip netns add namespace_name
Ex : ip netns add first_namespace

( I was really surprised how someone can write anything just like that on a coffee table!!! )

To view the list of network namespaces that you created, you can execute ip netns command.
If you want to add interfaces, routing tables and firewall rules, you can go into that particular namespace and execute the appropriate commands. To go into the shell of the namespace,
ip netns exec namespace_name /bin/sh
The above command will go into the namespace shell and you can execute commands of your choice. Alternatively, you can issue the command instead of going into the shell
ip netns exec namespace_name command_to_execute
Ex : ip netns exec first_namespace ip addr
Here we executed “ip addr” command inside the namespace.

Me : Sounds very simple. This will definitely enable the developers to simulate a lot of networking scenarios. I must admit that I regret not meeting you earlier. I wonder if someone is already using you in their technologies.

Net Namespace : (With pride) YES. I am the basis for Dockers, Kubernetes and Virtual Routing and Forwarding concepts. Also, there are lot of open-source projects that heavily rely on me. Mininet (http://mininet.org/) is one such example.

Me : WOW. I used dockers earlier, but I didn’t know that I am already using Network Namespaces. GREAT YAAR! C’mon tell me more about you then.

Net Namespace: (Smiling). But You haven’t given your word for endorsing me.

Me : WHY NOT. I’ll definitely introduce you to my colleagues who will be happy to meet you.

Net Namespace : Well. That’s great.

Me : But I have a question. This is a small coffee shop in a small town. You came out of nowhere to meet me here. I still couldn’t understand, how do you know me! How do you know that I am at this coffee shop. How do you know that I am working on projects that heavily rely on Linux?

Net Namespace : (Smiling mischievously) THEY CHOSE YOU!!!

Me : Who are THEY??

Net Namespace : You’ll get to know. Tell me something. How did you get into this coffee shop? And how did you order your coffee? How much did it cost and how is the taste?

(His questions sounded very simple to me. But I couldn’t remember anything. I started thinking hard to figure out how did it all happen. Actually, he was right. I have the coffee on my table but when did I order? I could hear loud noises of cars, trucks and people talking indistinctly. I could see the coffee cup but was unable to grab it. It was all strange and scary.
Suddenly the atmosphere in the coffee shop started changing. People started fading away including net namespace. I couldn’t find coffee on my table. I started breathing heavily. The only thing that I could sense is that one of my favorite songs is getting played in the background. The volume of the song started rising high. Now, I could sense my phone next to me. I swiped the phone, and the music stopped. I woke up suddenly and looked at my surroundings. It’s my regular bedroom and the time 8:00AM. So, I realized that my meeting with Network Namespace in the coffee shop WAS A DREAM!)

********** TO BE CONTINUED**********

********** PART-2 LOADING **********

Aditya Uppuluri

A Software Engineer who loves coding. And is passionate about VoIP, WebRTC, Leadership and Linux Networking. If you want to have a tea-time discussion regarding software engineering best practices, Object Oriented Programming and design patterns, then I am your tea-time friend.

About Nouveau Labs:

Nouveau Labs is actively engaged with multi-national companies to develop & support cloud based Zero Trust products. Engineering engagements include system engineering/evaluation, product development & support services. Nouveau Labs has been building and nurturing engineering teams to build cloud based secure access, multi-factor authentication, platform migration & AI/analytics features.

For further details, do contact us on contact@nouveau-labs.com

Comments are closed.