Related Items  

Linux and Windows Support  


Login or Register  

If you wish to contribute an article, please login or register.

Add static route with destination


linux 128Q. I have 5 IP addresses from my provider, however, I can only access 1. When I try to access the others internally, they time out.

Another scenario: I would like to access a different subnet. (eg from How can this be done?

A. You need to add the gateway for particular IPs (or IP range) manually, to the routing table. (This exercise assumes that you are running a linux based router).

route -n

Will produce something like this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface          UG    100    0        0 eth0 U     0      0        0 eth0     U     0      0        0 vnet0

Assuming you have another IP address you would like to route through, here's what to do:

route add -net netmask gw

This will produce the following route -n output:

Kernel IP routing table
Destination           Gateway                Genmask             Flags     Metric Ref Use Iface                        UG         100 0 0 eth0            U           0 0 0 eth0                  U           0 0 0 vnet0 UGH     0 0 0 eth0

 If you want to route an entire subnet (eg:, not just one IP address, you can do the following:

route add -net netmask gw


Add your comment

Your name:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
yvComment v.1.24.0
Copyright © 1999 - 2016 Virtual Helpme | r | Original Template: Allrounder