Adding a static route

Discussion in 'Linux, BSD and Other OS's' started by megamaced, Apr 22, 2008.

  1. megamaced

    megamaced Geek Geek Geek!

    Likes Received:
    0
    Trophy Points:
    36
    Hey guys, I am trying to add a static route (not persistant) using Ubuntu. I am connecting to another network via PPTP that uses the same IP address range as my network. When I connect to a computer that is located on the other network, I need the traffic to go through the VPN gateway, obviously.

    In Windows I could just do:

    route add <destination computer ip> mask 255.255.255.255 <ppp ip address>

    How would that command translate into UNIX speak?

    Ta
     
  2. Addis

    Addis The King

    Likes Received:
    91
    Trophy Points:
    48
    Don't know if this is what you're looking for, but there's a route program in linux anyway. Wtih similar syntax to your example, take a look at that if you haven't already.
     
  3. Anti-Trend

    Anti-Trend Nonconformist Geek

    Likes Received:
    118
    Trophy Points:
    63
    To list routes:
    Code:
    route -n
    You can add a new static route with `route add`. For example, if you have an IP on 192.168.2.0/24 and you wanted a route to 192.168.240.0/24, you could add a static route like so:
    Code:
    route add -net 192.168.240.0 netmask 255.255.255.0 gw 192.168.2.1
    ...assuming the router providing the route is 192.168.2.1.
     
  4. megamaced

    megamaced Geek Geek Geek!

    Likes Received:
    0
    Trophy Points:
    36
    Thanks mate, that works perfectly with a "sudo" at the beginning ;)
     
  5. Anti-Trend

    Anti-Trend Nonconformist Geek

    Likes Received:
    118
    Trophy Points:
    63
    [ot]
    Every time an Ubuntu user runs the `sudo` command, a naked molerat is conceived.[/ot]
     

Share This Page