Networking in Linux : Routing Table and much more …….

Divyaansh Jain
4 min readMar 14, 2021

Network Routing: Network routing is the process of selecting a path across one or more networks. The principles of routing can apply to any type of network, from telephone networks to public transportation. In packet-switching networks, such as the Internet, routing selects the paths for IP packets to travel from their origin to their destination. These Internet routing decisions are made by specialized pieces of network hardware called routers.

Routing Table: routing table is a set of rules, often viewed in table format, that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. All IP-enabled devices, including routers and switches, use routing tables.

Network Gateway: A gateway is a network node that forms a passage between two networks operating with different transmission protocols. Gateways serve as an entry and exit point for a network as all data must pass through or communicate with the gateway prior to being routed. In most IP-based networks, the only traffic that does not go through at least one gateway is traffic flowing among nodes on the same local area network (LAN) segment.

Now, we know the basic terminologies, let’s create something interesting now……….

A Setup so that can ping google but not able to ping Facebook from same system

Let’s take this down step by step:

  1. Use the command ifconfig enp0s3to see your system’s IP and use the command route -n to see the routing table of your system.

[ Note: Here, enp0s3 is my Network Interface Card(NIC) ]

2. Now use the command nslookup www.google.com to see the address of google server and use command ping {IP of Google server} .

3. Similarly, execute the command nslookup www.facebook.com to see the address of Facebook server and ping {IP of Facebook server} to check connectivity.

4. We will delete an entry from the routing table. Use command route -n to check the internet gateway in the table. Now, for deleting the entry, use the command route del -net 0.0.0.0/0 .

5. Now, try to ping both Google and Facebook servers again.

6. Now, we have to add an entry in the routing table such that the internet gateway will only ping Google not Facebook and for that we use the command route add -net 142.250.76.0/24 gw 192.168.43.1 enp0s3 . Here, 192.168.43.1 is my internet gateway and 142.250.76.0/24 is the IPs of Google servers.

7. Now, lastly ping both Google server and Facebook server. You will see that the system is able to ping to Google but not Facebook.

And the setup is finally done………………

I will discuss some technologies in the further blogs, till then have a read at this.

Signing off

Link for my LinkedIn profile:

--

--