# how to find router real ip adress

## queen

I would like to know if a router has a real ip adress, and the ip itself in order to connect to the router. What utility i need for that? I want to connect wireless to the router.

----------

## ectospasm

You can look at all of the interfaces which are up using ifconfig (as root).  If any interface has an address as listed here, then it's a reserved IP address that is not supposed to be on the Internet.  Also, an IP address of 127.x.x.x is the loopback, and should be attached to the lo interface.

Edit:  This is all assuming you have shell access to the router, and it's running Linux.

HTH

----------

## queen

 *ectospasm wrote:*   

> You can look at all of the interfaces which are up using ifconfig (as root).  If any interface has an address as listed here, then it's a reserved IP address that is not supposed to be on the Internet.  Also, an IP address of 127.x.x.x is the loopback, and should be attached to the lo interface.
> 
> Edit:  This is all assuming you have shell access to the router, and it's running Linux.
> 
> HTH

 

I know the essid and the mac adress of the linksys router but nothing more. The pc connected to the router runs windows. I need to find the ip of the router. That's why i think that ifconfig in this case won't help.

----------

## opopanax

usually on home routers it's 192.168.1.1.

----------

## d4rkwingduck

Run a traceroute to an internet host or your ISP servers and look at the last private ip before you get your ISP's first public ip.

----------

## magic919

Check the default gateway on the Windows PC as it will be the router.  Use ipconfig on most flavours.

----------

## bluedevils

"Check the default gateway on the Windows PC as it will be the router. Use ipconfig on most flavours."

That will get the internal ip of the router and go to "whatismyip.com" to get the external IP

----------

## zerop2

route -n

do it work?

----------

## queen

 *bluedevils wrote:*   

> "Check the default gateway on the Windows PC as it will be the router. Use ipconfig on most flavours."
> 
> That will get the internal ip of the router and go to "whatismyip.com" to get the external IP

 

The default getway is not a problem. it's usually the same as the ip, except the last number which is 254. 

My problem is to find the ip of the router. Windows pc is not near me.

----------

## queen

 *zerop2 wrote:*   

> route -n
> 
> do it work?

 

Might work. Will try it today.

----------

## bluedevils

I'm getting confused.  Most consumer wireless routers have two main IPs.  One internal (the default gateway you use to get to the internet and to configure the router) and the external IP (the one that actually connects to the internet and has an IP that can be seen from the internet).  They are both IPs of the router.

The external IP can be determined from the console of the router (for many consumer wireless router it is a webpage at the default gateway IP) or if you have internet connection through the router "whatismyip.com".

 *queen wrote:*   

> 
> 
> The default getway is not a problem. it's usually the same as the ip, except the last number which is 254. 
> 
> My problem is to find the ip of the router. Windows pc is not near me.

 

----------

## SkizoidMan

http://www.whatismyip.org/ to know the 'external' address of the router

tracert.exe to find out the internal address (look at the first hop)

----------

## SkizoidMan

 *SkizoidMan wrote:*   

> http://www.whatismyip.org/ to know the 'external' address of the router
> 
> tracert.exe to find out the internal address (look at the first hop)

 

sorry, I meant traceroute, not tracert.exe.. been using windows lately.

----------

## queen

 *SkizoidMan wrote:*   

>  *SkizoidMan wrote:*   http://www.whatismyip.org/ to know the 'external' address of the router
> 
> tracert.exe to find out the internal address (look at the first hop) 
> 
> sorry, I meant traceroute, not tracert.exe.. been using windows lately.

 

tcpdump gave me warning about ipv4 not enabled and i didn't got any more information. traceroute didn't give me any information. route -n gave me 127.0.0.1 (which is the range of my localhost).  I have built in the kernel ipv6 but no ipv4. 

I found some tools which i will try, called arping and ettercap. Since i know the essid, mac adress, i think this will help me.

----------

## bluedevils

ummm....Is this router yours?  If it isn't, then it sounds like they have security measures like encryption or mac filtering put in place.  If it is a open wep or wpa, then it will allow you to attach to the router, but nothing more.  Are you sure the default gateway you see isn't something your interface defaults to when it can't find a dhcp server?

----------

## nevynxxx

This might be a stupid question.

Is this a router that is in place and in use? Or is it one that you are trying to set up and is not being used at the moment, like say, you bought it second hand?

If it is the first, the see above, they are all good suggestions, if it is the second, it is damn hard, and asking the manufacturer would be best bet.

Followed by unplug the computer from any other network, make a direct connection to the router, and then try pinging every "non-routable" IP address, changing your computer IP whenever you need to.....

----------

## bluedevils

Even if it is a second hand router, most manufacturers post manuals of their device and have a reset mechanism to set it back to default.

 *nevynxxx wrote:*   

> if it is the second, it is damn hard, and asking the manufacturer would be best bet.
> 
> Followed by unplug the computer from any other network, make a direct connection to the router, and then try pinging every "non-routable" IP address, changing your computer IP whenever you need to.....

 

----------

## Drunkula

How about....

```
lynx -dump -nolist http://ipid.shat.net/iponly/
```

----------

## queen

 *nevynxxx wrote:*   

> This might be a stupid question.
> 
> Is this a router that is in place and in use? Or is it one that you are trying to set up and is not being used at the moment, like say, you bought it second hand?
> 
> If it is the first, the see above, they are all good suggestions, if it is the second, it is damn hard, and asking the manufacturer would be best bet.
> ...

 

It's a router that is in place and in use. I find it through scan, encryption is off. I set the essid accordingly.

----------

## queen

 *Drunkula wrote:*   

> How about....
> 
> ```
> lynx -dump -nolist http://ipid.shat.net/iponly/
> ```
> ...

 

I tried something similar few days ago with no result. Here is the 2 scripts i tried:

#!/bin/bash

curl -s http://checkip.dyndns.org | awk '{print $6}' | awk ' BEGIN { FS = "<" } { print

$1 } '

here i didn't get any results because it can't connect to the url.

#!/usr/bin/perl

my $url = "http://www.whatismyip.com/";

my $html = `/usr/bin/curl -s -f $url`;

if ($html =~ /<TITLE>[^\d]*(\d+\.\d+\.\d+\.\d+)/i)

{

my $ipaddr = $1;

print $ipaddr;

print "\n"; # remove this line if newline at end not wanted

exit;

}

print STDERR "Failed to get IP address from $url\n";

exit;

}

and here i got failed to get IP adress from ......... because it fails in the curl -s -f. $html is empty. 

So, lynx and curl might be similar.

----------

## queen

 *bluedevils wrote:*   

> ummm....Is this router yours?  If it isn't, then it sounds like they have security measures like encryption or mac filtering put in place.  If it is a open wep or wpa, then it will allow you to attach to the router, but nothing more.  Are you sure the default gateway you see isn't something your interface defaults to when it can't find a dhcp server?

 

The router is of a friend of mine.  I lost the details and can't contact him now. encryption is off. I can set my wifi card to the mac adress of the router and set the essid of the router. When i use iwlist eth2 scan i get all the details of the router, except the ip. So, i need some way to find the ip. One of my ideas is to somehow extract from the mac adress the ip and then connect using this ip. 

I think this is similar like being able to connect in hot spots, but i don't know how to do it.

----------

## bluedevils

well the hotspots have dhcp setup.  If dhcp is setup on this router, then it will give you an address and give gateway settings to your computer (assuming you're set for dhcp).  If the router has mac address filtering, it will not give you any settings (dhcp or not).

If it is a static ip with no dhcp and no mac filtering, then I guess you need to pull the IP from the mac address or start trying things like 192.168.0.1  I'm not sure if arp would be of any use to you.

----------

## queen

 *bluedevils wrote:*   

> well the hotspots have dhcp setup.  If dhcp is setup on this router, then it will give you an address and give gateway settings to your computer (assuming you're set for dhcp).  If the router has mac address filtering, it will not give you any settings (dhcp or not).
> 
> If it is a static ip with no dhcp and no mac filtering, then I guess you need to pull the IP from the mac address or start trying things like 192.168.0.1  I'm not sure if arp would be of any use to you.

 

arping didn't help because it requires ip.  Thanks for the tip. Yes, i have dhcp.

----------

