vanutsteen.nl => nerds only A blog on rails, php, computing, my bass guitar and stuff

3 useful route commands

on in Linux

To route an ip address through a (vpn) connection:

1
2
          <div>
            <div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1

2 3

sudo route add -net XX.192.85.XX netmask 255.255.255.255 gw 192.168.1.1
sudo route add -net 10.76.122.0 netmask 255.255.255.0 gw 192.168.1.1
route -n

1
2
          </div>
        </figure>

Or maybe add a whole range / subnet:

1
2
          <div>
            <div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td class="code"><pre>sudo route add -net 95.170.89.0 netmask 255.255.255.224 gw 10.76.122.152<span class="w">

1
2
          </div>
        </figure>

Or maybe dynamic?

1
2
          <div>
            <div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1</pre></td><td class="code"><pre>route add -net 95.170.89.0 netmask 255.255.255.224 gw <span class="sb">`</span>ip addr show ppp0 | awk <span class="s1">'/inet/{print$2}'</span><span class="sb">`</span><span class="w">

1
2
          </div>
        </figure>

Comments