DEV Community

Rajit Paul
Rajit Paul

Posted on

Linux Routing - Basic Terminologies, Adding and deleting routes

Alt Text


imagecredits-cdn.nextgov.com

Routing:

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.

Route Tables:

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.

Gateway

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
Imagecredits- Computingforgeeks.com

IP address

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.

Netmask

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
imagecredits- computerhope.com

Network Interface Card

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

Let's look into a simple use-case

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

Deleting all the routes from System B and C only adding a route for system A -

Alt Text

ip route del 0.0.0.0/0 via 192.168.29.1 dev enp0s3 - Quad Route




ip route del 192.168.29.0/24 via 0.0.0.0 dev enp0s3 - LAN Route




route add -net 192.168.29.180 netmask 255.255.255.255 dev enp0s3 - Add Route to System A




Alt Text

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.


⚡ Thanks for Reading ⚡

Top comments (0)