Packet routing with route command

Hey, everyone, how are you doing?

I’m posting a simple and very specific use of ‘route’ command. As always, I usually do not write too much for the sake of simplicity. 🙂

The problem statement is: You have one interface with IP address and the default gateway is Assuming you want to access another network, how to route packets via Well, if you wanna route the entire network, you can do the following command:

# route add -net netmask gw

After, if you type “route -n”, you will see something like this:

Kernel IP routing table
Destination     Gateway     Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 enp4s0   U     0      0        0 enp4s0   UG    0      0        0 enp4s0

Try ‘ping’ to any IP address in the network If everything is ok, so we’ve got success.

That’s all,


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s