Wednesday, November 3, 2010

Accessing router settings from LINUX

Simply opening your browser and going to http://192.168.1.1 will not get to the settings page. Atleast that was the case with me (on Reliance ADSL with ZXDSL 831 Series).

My ifconfig said:

eth0      Link encap:Ethernet  HWaddr 00:19:D1:3C:74:6E
          inet addr:123.*.*.*  Bcast:123.237.135.255  Mask:255.255.248.0
          inet6 addr: fe80::219:*:*:*/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10950498 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6864372 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7221735642 (6887.1 Mb)  TX bytes:1314931540 (1254.0 Mb)
          Interrupt:20 Memory:90300000-90320000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:46637 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46637 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4759514 (4.5 Mb)  TX bytes:4759514 (4.5 Mb)
 So, that means that my ip shown is not a LOCAL address (I am not behind NAT).

To access router which is probably 192.168.1.1, I would have to be in the same class of ip address as the router. Thats it.

A quick command to do that is:
sudo ifconfig eth0:1 192.168.1.10 netmask 255.255.255.0
Now, my ifconfig looks something like:

eth0      Link encap:Ethernet  HWaddr 00:19:D1:3C:74:6E  
          inet addr:123.237.*.*  Bcast:123.237.135.255  Mask:255.255.248.0
          inet6 addr: fe80::219:*:*:*/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8628562 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5663529 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6011401968 (5732.9 Mb)  TX bytes:1037953220 (989.8 Mb)
          Interrupt:20 Memory:90300000-90320000 

eth0:1    Link encap:Ethernet  HWaddr 00:19:D1:3C:74:6E  
          inet addr:192.168.1.10  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:20 Memory:90300000-90320000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:37184 errors:0 dropped:0 overruns:0 frame:0
          TX packets:37184 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3305323 (3.1 Mb)  TX bytes:3305323 (3.1 Mb)


Now, that I am in the class & my routing table looks like:-

shadyabhi@ArchLinux ~ $ ip route show
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.10 
123.237.128.0/21 dev eth0  proto kernel  scope link  src 123.237.133.161  metric 1 
default via 123.237.128.1 dev eth0  proto static 
shadyabhi@ArchLinux ~ $ 
 Thats it. Now, you can access your router page through browser.

No comments:

Post a Comment