Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Recently, I am trying to add a default gateway to my ubuntu machine to be able to send/receive packets from an another LAN through the router. However, everything I do the result is the following:

    vag@ubuntu:~$ route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.141.0   0.0.0.0         255.255.255.0   U     1      0        0 eth0
    x.y.z.w         0.0.0.0         255.255.0.0     U     1000   0        0 eth0
    0.0.0.0         192.168.141.2   0.0.0.0         UG    0      0        0 eth0

What I am trying to do (at least I think) is to create a line with the given information

    192.168.20.0    192.168.1.254   255.255.255.0  xx     xxx xxxx        xxxx

I don't want to have connection on the internet and this is what I think 0.0.0.0 Destination and gateway represent in the above table. I want just to connect to the LAN.

Any ideas?

share|improve this question

1 Answer 1

The command you have to run is:

sudo route add -net 192.168.20.0 netmask 255.255.255.0 gw 192.168.1.254
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.