Obtaining router external address

Barnaby Jeans bjeans-0li6OtcxBFHby3iVrkZq2A at public.gmane.org
Fri Apr 22 20:56:15 UTC 2005


Peter,

If you have enabled SNMP on your router and set the appropriate
community name then you should be able to execute the following
(assuming you have the Net-SNMP utils)

snmpwalk -c COMMUNITY_NAME -v 1 ROUTER_INTERNAL_IP ipAdEntAddr

If you have every setup correctly you should get something similar to
the following:

IP-MIB::ipAdEntAddr.x.x.x.x = IpAddress: x.x.x.x
IP-MIB::ipAdEntAddr.192.168.1.1 = IpAddress: 192.168.1.1 

You should get 2 addresses back, one is obviously the internal address
of your router (which a quick grep -v  would remove) and the other one
(with the x.x.x.x) will be the external IP of the router.

If you want to get creative and see what other information is available,
simply re-run the command leaving off the ipAdEntAddr piece (snmpwalk -c
community_name -v 1 router_ip)

Hope this helps.

Barnaby

-- 
Barnaby Jeans
IT Pro Advisor 

Microsoft Canada 	

phone: 905-363-8395
cell: 416-553-2197

email: bjeans-0li6OtcxBFHby3iVrkZq2A at public.gmane.org
messenger: bjeans-sDcR4YYMLqo2WLoE0AsyOQC/G2K4zDHf at public.gmane.org	 

Barnaby's Canadian IT Pro WebLog -
http://blogs.technet.com/Barnaby_Jeans/

-----Original Message-----
From: owner-tlug-lxSQFCZeNF4 at public.gmane.org [mailto:owner-tlug-lxSQFCZeNF4 at public.gmane.org] On Behalf Of Peter
Sent: April 22, 2005 3:28 PM
To: tlug-lxSQFCZeNF4 at public.gmane.org
Subject: [TLUG]: Obtaining router external address


Hi all,

we had this thread about getting the address of the router from the lan
side. Solutions involving parsing the response of an external site were
recorded. I am using such a solution. However, someone said he can
obtain it using SNMP. I just tried and I can't on my router. Would the
person like to share that information here ?

thanks,
Peter
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns How to
UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list