<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mahbub Tito on Medium]]></title>
        <description><![CDATA[Stories by Mahbub Tito on Medium]]></description>
        <link>https://medium.com/@titocbd?source=rss-7f10fb1e960c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tJUceIuJtsyLFZBz</url>
            <title>Stories by Mahbub Tito on Medium</title>
            <link>https://medium.com/@titocbd?source=rss-7f10fb1e960c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 04:32:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@titocbd/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Create Network Namespaces and Connect two NS via Virtual Ethernet (Veth) Cable]]></title>
            <link>https://medium.com/@titocbd/how-to-create-network-namespaces-and-connect-two-ns-via-virtual-ethernet-veth-cable-48876eb5bcea?source=rss-7f10fb1e960c------2</link>
            <guid isPermaLink="false">https://medium.com/p/48876eb5bcea</guid>
            <category><![CDATA[veth]]></category>
            <category><![CDATA[network-namespace]]></category>
            <category><![CDATA[vagrant]]></category>
            <dc:creator><![CDATA[Mahbub Tito]]></dc:creator>
            <pubDate>Thu, 22 Jun 2023 19:12:02 GMT</pubDate>
            <atom:updated>2023-06-23T17:55:57.274Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Introduction:</blockquote><p>Network namespaces provide a powerful way to isolate network resources within a Linux system. By creating and connecting namespaces, you can simulate separate network environments and control network connectivity between them. In this blog post, we will explore how to create multiple namespaces and connect them to each other using Virtual Ethernet (Veth) Cable at Vagrant.</p><blockquote>What is Network Namespace?</blockquote><p>A network namespace is <strong>a logical copy of the network stack from the host system</strong>. Network namespaces are useful for setting up containers or virtual environments. Each namespace has its own IP addresses, network interfaces, routing tables etc.</p><p>One real-life example is where network namespaces are commonly used in containerization technology, such as <strong>Docker</strong> or <strong>Kubernetes</strong>. Containers provide lightweight, isolated environments for running applications, and network namespaces play a crucial role in enabling network isolation and connectivity for these containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*M6ujUWyaJdldbAMj9Ul8hw.jpeg" /><figcaption>Network Namespace</figcaption></figure><p>Now let’s try to create network namespaces and connect them by <strong>veth(virtual ethernet)</strong> cable.</p><blockquote>Prerequisites:</blockquote><ul><li>Basic familiarity with Linux and networking concepts.</li><li>VirtualBox &amp; Vagrant are installed on your machine. Help Link — (<a href="https://github.com/titocbd/install-vagrant-vitualbox-at-ubuntu">https://github.com/titocbd/install-vagrant-vitualbox-at-ubuntu</a>)</li></ul><blockquote>Creating Network Namespaces:</blockquote><p>→ Login into Vagrant then open a terminal and execute/run the following commands to create two network namespaces.</p><pre>sudo ip netns add red <br>sudo ip netns add blue</pre><p>→ Show the list of newly created Namespace:</p><pre>sudo ip netns list<br><br>Output: <br>blue <br>red</pre><p>→ Access to red Namespace:</p><pre>sudo ip netns exec red bash</pre><p>Then <strong>exit</strong> command to back root namespace.</p><blockquote><strong>Creating Virtual Ethernet Cable:</strong></blockquote><p>→ Create a virtual Ethernet cable (Veth) that connects the namespaces:</p><pre>sudo ip link add veth-red type veth peer name veth-blue<br><br>Show veth list:  sudo ip link list</pre><p>→ Set <strong>veth(virtual ethernet)</strong> cable to each network namespace.</p><pre>sudo ip link set veth-red netns red<br>sudo ip link set veth-blue netns blue</pre><p>→ Configuring IP Addresses</p><p>Assign IP addresses to the <strong>veth(virtual ethernet) </strong>interfaces within the respective namespaces.</p><pre>sudo ip netns exec red ip addr add 10.0.0.1/24 dev veth-red<br>sudo ip netns exec blue ip addr add 10.0.0.2/24 dev veth-blue</pre><p>→ Enable veth interfaces/cables</p><p>Execute/run the following commands to bring up <strong>veth(virtual ethernet) </strong>interfaces/cables</p><pre>sudo ip netns exec red ip link set dev veth-red up<br>sudo ip netns exec blue ip link set dev veth-blue up<br>OR<br>sudo ip -n red link set veth-red up<br>sudo ip -n blue link set veth-blue up</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*wejqKObKJA6wNxQ6lJO2hg.jpeg" /><figcaption>Virtual ethernet between two NS</figcaption></figure><blockquote>Testing connectivity:</blockquote><p>To test the connectivity, let’s open two terminals, one for each namespace:</p><p>Terminal 1 (for red):</p><pre>sudo ip netns exec red bash</pre><p>Terminal 2 (for blue):</p><pre>sudo ip netns exec blue bash</pre><p>In Terminal 1 (red), you can now ping the IP address of veth-blue in blue namespace:</p><pre>ping 10.0.0.2</pre><p>If everything is set up correctly, you should see successful ICMP echo replies from red NS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*ODVVkKOkHw5ExMhkPERoaw.png" /><figcaption>icmp replies from terminal 1</figcaption></figure><p>Same as from blue NS:</p><pre>ping 10.0.0.1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*eM90wn6yS6ZPrXpcjnCK2Q.png" /><figcaption>icmp replies from terminal 2</figcaption></figure><p>So, you have created two namespaces and successfully established communication between these originally isolated network namespaces via the Veth devices/pair created by you.</p><p>In this tutorial, we explore the concepts of network namespaces and virtual Ethernet (Veth) devices in Linux. We created isolated network environments and established communication between them and observe the traffic. These concepts are fundamental in network virtualization and isolation, providing a powerful toolset for various networking scenarios.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48876eb5bcea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservice Architecture example using Reactjs(Nextjs) Express Redis and Mysql]]></title>
            <link>https://medium.com/@titocbd/microservice-architecture-example-using-reactjs-nextjs-express-redis-and-mysql-5b8f3132970e?source=rss-7f10fb1e960c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b8f3132970e</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[redis-pub-sub]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Mahbub Tito]]></dc:creator>
            <pubDate>Wed, 14 Jun 2023 11:22:55 GMT</pubDate>
            <atom:updated>2023-06-14T11:22:55.265Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*auUhmZSnpbIeKZ7hJdYD3Q.jpeg" /><figcaption>Dataflow Diagram</figcaption></figure><p>Explanation:</p><ol><li>The nextjs client is the front end of the application and it communicates with the express backend service to get and post data to the worker server and the mysql database.</li><li>The express backend service is the middle layer of the application. When it receives a post request from the nextjs frontend, it publishes a message to the redis pub/sub. When it receives a get request from the nextjs frontend, it checks the redis cache for the data. If the data is not in the redis cache, it sends a request to the database to get the data and caches the data in the redis cache for future requests. If the data is in the redis cache, it sends the data to the nextjs frontend. It is also responsible for sending responses to the nextjs frontend.</li><li>The worker server is a microservice that subscribes to the redis pub/sub and receives messages from the backend service when a post request is made from the nextjs frontend. It is responsible for sending requests to the mysql database to store the data.</li></ol><p>Components:</p><ol><li>Frontend service by Nextjs</li><li>Backend service by Express</li><li>Worker (Nodejs) Server</li><li>Redis Cache and Pub/Sub</li><li>MySQL Database</li></ol><p>You can try it out yourself by cloning the repository and following the instructions below.</p><pre>git clone https://github.com/titocbd/microservice-architecture-example-using-reactjs-express-redis-and-mysql<br>cd microservice-architecture-example-using-reactjs-express-redis-and-mysql<br>docker-compose build<br>docker-compose up</pre><p>Now visit: <a href="http://localhost:3000/">http://localhost:3000/</a></p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b8f3132970e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>