The Routing Table

A routing table is a set of rules, often viewed in a 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. See below a Routing Table:

The entry corresponding to the default gateway configuration is a network destination of 0.0.0.0 with a network mask (netmask) of 0.0.0.0. The Subnet Mask of the default route is always 255.255.255.255.

Each entry in the routing table consists of the following entries:

  1. Network ID: The network ID or destination corresponding to the route.
  2. Subnet Mask: The mask that is used to match a destination IP address to the network ID.
  3. Next Hop: The IP address to which the packet is forwarded
  4. Outgoing Interface: Outgoing interface the packet should go out to reach the destination network.
  5. Metric: A common use of the metric is to indicate the minimum number of hops (routers crossed) to the network ID.

Task: Create a Setup so that you can ping google but not able to ping Facebook from the same system.

  • Check Routing Table using command, “route -n”.
  • Try to ping google.com and facebook.com. You must be able to ping them. Write down their IP’s.
  • Now Delete the Default Gateway using the command, “route del-net 0.0.0.0”.
  • Now try to ping google.com and facebook.com. You must not be able to ping them.
  • Now add a rule in the routing table so that you can ping google.com but not facebook.com by using the command, route add -net <google’s IP> netmask 255.255.255.0 gw <gateway-IP> enp0s3”.
  • Now you will be able to ping google.com but not facebook.com.

Note: Add the default rule back to the routing table so that you can connect to the Internet by using the command, “route add -net 0.0.0.0 netmask 0.0.0.0 gw <gateway-IP> enp0s3”.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

{UPDATE} Bubble Monster - Win the bubble world Hack Free Resources Generator

SIEM Security: Accelerate Phishing Detection and Incident Response

Learn How to Hack

The Road to Ransomware Resilience, Part 2: Behavior Analysis

GCP: Do not suffer anymore from Key Leaks!

Change your grades on Blackboard

Understanding cyber attacks as the biggest threat to your business is crucial.

Why DevOps and Security Should Go Hand in Hand?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Karan Agrawal

Karan Agrawal

More from Medium

Learn VueJS from scratch — Part 3

VueJS Events and Rendering

Ruby Active Record Migrations: Database Control

Installing Opigno 3.x on Ubuntu 20.04LTS

Getting Started with the CLI