Linux Routing - Basic Terminologies, Adding and deleting routes
Tags: linux, routing
Published: 2021-03-27 09:39:27

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bld7s0m7geykz4y37ek2.jpg)
<br />
<i>imagecredits-cdn.nextgov.com</i>
<h3>Routing:</h3>
Network routing is the process of choosing a path across one or more networks. The principles of a network are the same and apply to any type of network from telephone networks to any transportation.
<br />
<h3>Route Tables:</h3>
Routers or gateways refer to the internal routing tables to make decisions on how to route the network packets along the network paths. A routing table has all the paths that the network packets might take to reach the destination.
<br />
<h3>Gateway</h3>
A gateway is also known as a router, acts as the key stopping point for data on its way to or from other networks. The gateway acts as an entry or exit point for the network as all data must pass through or communicate with the gateway before being routed. Traffic flowing among the same local network is the only traffic that doesn't flow through the gateway.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8kexolqxq3457qguhz6r.png)
<i>Imagecredits- Computingforgeeks.com</i>
<h3>IP address</h3>
The IP address is a number used to label devices connected to a network where the medium of communication is Internet Protocol. There are two versions of IP addresses: IPv4 and Ipv6. IPv4 is 32 bits long, whereas IPv6 is 128 bits long.
<br />
<h3>Netmask</h3>
A netmask is a 32-bit binary mask that is used to divide an IP address into subnets and specify the available hosts in the network. Netmasks are used for defining networking rules in firewalls and routers.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nhrs2e2j0yl6w9qwsx6q.png)
<i>imagecredits- computerhope.com</i>
<h3>Network Interface Card</h3>
NIC is a hardware component that helps a computer connect to a network. This card is a circuit board installed on a computer that provides a dedicated network connection to the computer. It is also known as Network Interface Controller, Network Adapter, or LAN Adapter.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zvh0tneeqymjk4bsi65w.jpg)
</br>
<h3>Let's look into a simple use-case</h3>
We need to create a network topology such that System A can ping to both system B and system C but B & C cannot ping to each other
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60ni8t86rtmuu1tamimr.png)
<br />
<h5>Deleting all the routes from System B and C only adding a route for system A - </h5>
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cs3vuvizrbibwyxr07nz.gif)
<b>ip route del 0.0.0.0/0 via 192.168.29.1 dev enp0s3 - <i>Quad Route</i></b>
<br />
<b>ip route del 192.168.29.0/24 via 0.0.0.0 dev enp0s3 - <i>LAN Route</i></b>
<br />
<b>route add -net 192.168.29.180 netmask 255.255.255.255 dev enp0s3 - <i>Add Route to System A</i></b>
<br />
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dw44qbhudlvhr8tqamjk.png)
<h4> We are able to ping from System A to System B & C as visible with the fping command but as we have only one route in System B and System C to System A, they won't be able to ping to one another.
<br />
<h2>⚡ Thanks for Reading ⚡</h2>