7 min readMar 14, 2021

Today in this blog we will be exploring some concepts of subnetting and routing table and create an interesting setup where our system can ping to Google but can't ping to Facebook at the same time .

Let's first understand some of the basic terminologies that help us in understanding this networking practical more accurately.

📌What is a routing table?

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

Routing Table provides the device with instructions for sending the packet to the next hop on its route across the network.

A routing table contains the information necessary to forward a packet along the best path toward its destination. Each packet contains information about its origin and destination. Routing Table provides the device with instructions for sending the packet to the next hop on its route across the network.

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.

📌What is Gateway?

A gateway is a hardware device that acts as a “gate” between two networks. It may be a router, firewall, server, or other devices that enable traffic to flow in and out of the network.

While a gateway protects the nodes within the network, it also a node itself. The gateway node is considered to be on the “edge” of the network as all data must flow through it before coming in or going out of the network. It may also translate data received from outside networks into a format or protocol recognized by devices within the internal network.

📌What is IP Address?

An IP address is a unique address that identifies a device on the internet or a local network. IP stands for “Internet Protocol,” which is the set of rules governing the format of data sent via the internet or local network.

How do IP addresses work:

If we want to understand why a particular device is not connecting in the way we would expect or we want to troubleshoot why our network may not be working, it helps understand how IP addresses work.

Internet Protocol works the same way as any other language, by communicating using set guidelines to pass information. All devices find, send, and exchange information with other connected devices using this protocol. By speaking the same language, any computer in any location can talk to one another.

The use of IP addresses typically happens behind the scenes. The process works like this:

  1. Our device indirectly connects to the internet by connecting at first to a network connected to the internet, which then grants our device access to the internet.
  2. When we are at home, that network will probably be our Internet Service Provider (ISP). At work, it will be our company network.
  3. Our IP address is assigned to our device by our ISP.
  4. Our internet activity goes through the ISP, and they route it back to us, using our IP address. Since they are giving us access to the internet, it is their role to assign an IP address to our device.
  5. However, our IP address can change. For example, turning our modem or router on or off can change it. Or we can contact your ISP, and they can change it for us.
  6. When we are out and about — for example, traveling — and we take our device with us, our home IP address does not come with us. This is because we will be using another network (Wi-Fi at a hotel, airport, or coffee shop, etc.) to access the internet and will be using a different (and temporary) IP address, assigned to you by the ISP of the hotel, airport or coffee shop.

There are two versions of IP addresses: IPv4 and IPv6.
Addresses in IPv4 are 32-bits long. This allows for a maximum of 4,294,967,296 (232) unique addresses
Addresses in IPv6 are 128-bits, which allows for 3.4 x 1038 (2128) unique addresses.

📌What is Netmask?

A Netmask is a 32-bit “mask” used to divide an IP address into subnets and specify the network’s available hosts.

Netmasks (or subnet masks) are a shorthand for referring to ranges of consecutive IP addresses in the Internet Protocol. They used for defining networking rules in e.g. routers and firewalls.

A netmask is a shorthand for describing a range of IP addresses. A netmask may describe just a single IP address: just the address

Or all possible IP addresses: all 4.3 billion addresses from to

More usefully, it does something in between: the IP addresses and

How to read a netmask?

The left-hand side of a netmask (e.g. specifies a host IP address. The right-hand side specifies (e.g. /32) how many digits of the host address are significant, when considered as a binary number. Non-significant bits in the binary form are treated as a wild-card.

For instance, in the netmask, the host address is This can be written in binary as 11000000.10101000.11111111.00000001. To match this netmask, an address must have match exactly 32 digits - i.e. have the same binary digit in each position. This means only one address will be matched by this pattern.

The netmask states that the last binary digit is not significant so will match two addresses: 11000000.10101000.11111111.00000000 and 11000000.10101000.11111111.00000001 (written more readably as and

Similarly states that the last two binary digits are not significant so will match four different addresses.

Task Description:

🎯Create a Setup so that we can ping Google but not able to ping Facebook from the same system.

🎯 In Linux, we use ifconfig command to see the IP address and netmask of the system.️

🎯 In Linux, we use the route -n command to see the route table of the system.️

🎯 In Linux, we use the ping command to check connectivity .️

Now, we check if our system can ping to Google or Facebook:



Here, we see that our system is successfully pinging to both Google and Facebook.

🎯 In Linux, we use nslookup command to see the ip address of any server .️

🎯 Now,we have to delete Quad Route(default route).

The default route in Internet Protocol Version 4 (IPv4) is designated as the zero-address in CIDR notation, often called the quad-zero route.

Now, if we again try to ping Google and Facebook its fail because we deleted the default rule from the routing table.

🎯 Now , we add the rule in routing table according to google’s ip so that google’s ip will come in that range/routing table and add internet gateway for it so that google is able to ping.

So, for this we write Google Ip in Destination and gateway will be localhost and write netmask

Now if we again ping to google as well as Facebook and we see that our system is able to ping google but it cant ping to Facebook at the same time.

The Wrap-Up

I have successfully created a setup where we can ping to google but cat ping to Facebook at the same time from a system.

In the upcoming days I am going to publish lots of articles on different automation Tools and other Technologies, So definitely follow me on Medium.

Here is my LinkedIn profile if u have any queries definitely comment below or DM me on Linkedin




I am tech enthusiast fascinated towards technology and its various disciplines including Big Data, Hadoop, Web Development, Competative Programming,ML,etc.