Create a setup that would ping Google but not Facebook from same system

Create a setup that would ping Google but not Facebook from same system

Content of this Blog

  • Basic Concepts
  • Setup Procedure


Basic Concepts

Before understanding procedure required for the setup, let’s understand the basic terminologies regarding the same

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.
  • It contains the information necessary to forward a packet along the best path toward its destination. Each packet contains information about its origin and destination.
  • When a packet is received, a network device examines the packet and matches it to the routing table entry providing the best match for its destination. The table then provides the device with instructions for sending the packet to the next hop on its route across the network.

Netmask

  • 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.

Gateway

  • Gateway is a network connecting device that can be used to connect two devices in two different networks implementing different networking protocols and overall network architecture.

route command

  • route command in Linux is used to set up static routes to specific hosts or networks via an interface and for showing or updating the IP/kernel routing table.



Prerequisite

? You Need One VM(Virtual Machine) (Here I am using Redhat VM in VirtualBox)that has internet connectivity.


Solution ??

? Here we need to add the Rule in our OS.??.


Step-1)Check how many Rules are there

route -n
No alt text provided for this image

Here you can see there are some rules added, so if we want some customization for our setup, First we have to remove the 0.0.0.0 rule.


Step-2)Removing Rule

route del -net 0.0.0.0
No alt text provided for this image


As You can see 0.0.0.0 removed from the destination

  • Now if you tried to ping 172.217.167.0 (GOOGLE IP) it won’t work because we have removed 0.0.0.0
  • Add a new entry to the routing table that that makes google.com pingable and makes facebook.com not pingable and then check the routing table, observe the difference
No alt text provided for this image


  • Here we need to type Google Ip in the net, after that netmask and finally, we have to type Gateway.
No alt text provided for this image


  • As you can see we are pinging Google Ip.
No alt text provided for this image


  • grep command obtains the output from nslookup command and uses regular expression to obtain IPv4 address, and then tail -1 command is used to obtain the IP required in this case. sed command is used to convert the IP address obtained to CIDR format.

THANKS FOR READING!!!!

要查看或添加评论,请登录

Robin Kumar的更多文章

  • Docker+HTTPD+Python

    Docker+HTTPD+Python

    This Blog is about: Installing and Setting up Docker Running a Docker Container with Exposed Port Setting up httpd…

  • Expanding and reducing the capacity of Static Partitions

    Expanding and reducing the capacity of Static Partitions

    What is a static partition? Static(Fixed) Partitioning: ->According to geek for geeks This is the oldest and simplest…

  • Automating processes using Python

    Automating processes using Python

    What is Automation? It is the use of technology to accomplish a task with as little human interaction as possible.In…

  • PROVINDING ELASTICITY TO HADOOP CLUSTER USING LINUX LVM

    PROVINDING ELASTICITY TO HADOOP CLUSTER USING LINUX LVM

    Logical Volume Manager LVM for short..

  • Case Study: How Nokiya Using Kubernetes ?

    Case Study: How Nokiya Using Kubernetes ?

    What is Kubernetes? Kubernetes is a portable, extensible, open-source platform for managing containerized workloads and…

  • Case Study Of Netflix

    Case Study Of Netflix

    Four Reasons They Choose Amazon’s Cloud as Our Computing Platform One year ago, none of Netflix’s customer traffic was…

  • BIG DATA

    BIG DATA

    What is BIG DATA? Introduction, Types, Characteristics & Example In order to understand 'Big Data', you first need to…

  • Mlops_task1: integration of | Jenkins | Docker | Github |

    Mlops_task1: integration of | Jenkins | Docker | Github |

    Job_1 If Developer push to dev branch then Jenkins will fetch from dev and deploy on the dev-docker environment. Job_2…

社区洞察

其他会员也浏览了