Activities

May 2012
M T W T F S S
« Apr   Jun »
 123456
78910111213
14151617181920
21222324252627
28293031  

Adding Static route in Linux

We are using 2 ISP links in office network and being used for production hosting and business. Most of the users are connected to other low speed ISP chanel and used it for thier work. The ISP used for the hosting purpose has high speed access with limited usage. So Bandwidth is the major concern 🙁

Users need to access this server most of the time and found that they are accesing site hosted on other ISP link over the public network even though it is hosted on the same network.

ie

[root@rc-150 ~]# traceroute asd.com
traceroute to asd.com (222.116.40.115), 30 hops max, 40 byte packets
 1  192.168.0.9 (192.168.0.9)  0.233 ms  0.171 ms  0.142 ms
 2  Static-31.117.42.11.ip-dsl-tvm.eth.net (31.117.42.11)  36.758 ms  37.138 ms  36.604 ms
 3  203.200.137.9.ill-chn.static.vsnl.net.in (203.200.137.9)  40.564 ms  40.762 ms  40.805 ms
 4  59.165.191.37.man-static.vsnl.net.in (59.165.191.37)  46.678 ms  48.091 ms  49.278 ms
 5  59.165.191.37.man-static.vsnl.net.in (59.165.191.37)  50.458 ms  51.965 ms  53.178 ms
 6  172.31.35.133 (172.31.35.133)  74.284 ms  74.491 ms  81.142 ms
 7  121.240.1.202 (121.240.1.202)  352.706 ms  316.050 ms  316.192 ms
 8  202.56.223.74 (202.56.223.74)  294.785 ms  290.198 ms  291.008 ms
 9  * * *
10  ABTS-KK-Static-010.32.166.122.airtelbroadband.in (122.166.32.10)  286.991 ms  291.712 ms  291.141 ms
11  ABTS-KK-Static-046.32.166.122.airtelbroadband.in (122.166.32.46)  290.561 ms  292.322 ms  318.435 ms

Note that there are total 12 hopes and took 318.435 ms

Here is the trick

We are using linux sofware router (SQUID transperent proxy). Immediatlely I got some idea about after few minutes googling. So this is the point where I need divert all the traffic since all the users are using this router as gateway.

This is the command to add the route

#route add -net 222.116.40.115 netmask 255.255.255.255  gw 192.168.0.8 eth0

Here,
222.116.40.115 –> My Public Static IP
255.255.255.255 –> network mask
192.168.0.8 –> Router where other ISP connected.

Let’s see the new ping response time,

[root@rc-150 ~]# traceroute asd.com
traceroute to asd.com (222.116.40.115), 30 hops max, 40 byte packets
 1  192.168.0.9 (192.168.0.9)  0.197 ms  0.173 ms  0.171 ms
 2  asd.com (222.116.40.115)  1.485 ms  0.483 ms  0.473 ms

Just took least 2 hopes and 0.473 seconds rather than 318.435 ms response time 🙂 This will not happen if we have a router with routing protocol enabled like CISCO:-)

I used this mechanism when some of the sites/services are being blocked by other hosting company/network.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>