The Cube - Assimilating Technology

The Cube

Add static route

For Humans only


Add static route Print E-mail
I need to gain access to a network in the USA, from the UK. This network is a subnetwork to our own, but I cannot ping or access any machine on that network. The solution to this problem is to use route to add a new route from my machine to the new network.

My routing table before i started :

route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.254   0.0.0.0         UG    0      0        0 eth0

You can add static route using following command:

route add -net <network> netmask 255.255.255.0 gw <gateway>  dev <device>

I need to get to the 192.168.11.0 network, and i know our local gateway to that network is 192.168.0.20 so to do this I do the following:

route add -net 192.168.11.0 netmask 255.255.255.0 gw 192.168.0.20 dev eth0
Now my routing table looks like this:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.11.0    192.168.0.20    255.255.255.0   UG    0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         192.168.0.254   0.0.0.0         UG    0      0        0 eth0

and I can access the remote machines :)

 
Share on facebook