# how to find gateway ip?

## scuzzo

Say your on a network, and you got a nat'd ip like 10.20.80.170 , how could you find out what the gateway computer's ip? I tried traceroute.

root@slax:~# traceroute gentoo.org

traceroute to gentoo.org (204.74.99.100), 30 hops max, 38 byte packets

 1  10.20.80.254 (10.20.80.254)  0.356 ms  0.255 ms  0.182 ms

 2  10.20.101.1 (10.20.101.1)  0.492 ms  0.215 ms  0.182 ms

 3  * * *

 4  * * *

 5  * * *

 6  *

But got nowhere.

----------

## enigma_0Z

If you are behind a NAT, then the second host that tracerout returns should be the gateway (the IP address usually ends in one, and begins with the first one, two, or three octets of your IP address (depending on your network))

[edit]

Oh yeah, and does your network have a DHCP (dynamic host configuration protocaul) server? if it does, then the DHCP server will give you an IP and all the info you need to connect to the rest of the network.

[/edit]

----------

## scuzzo

Edit: What I meant to say is that I want the real IP not a nat'd ip or a fake ip or anything liek 198.168.1.1

Also I cant seem to find an ifconfig option that displays all the ipaddress info stuff, like in windows you have ipconfig /all

----------

## synfin0

If you're looking for the real ip that your address is eventually NAT'd to, then use a web-based IP detection page like http://checkip.dyndns.org/.

----------

## enigma_0Z

and if the above doesn't work, you may be able to find it in the configuration of the NAT. If you are on a corporate network, then perhaps you can ask your network administrator

----------

## kpack

www.whatismyip.com

----------

## pjp

Is this for a personal/home device, such as a Linksys DSL/Cable modem?

----------

## scuzzo

1. What if there was no internet access.....

2. This is for in general.

----------

## Nossie

Are you even sure you are NATed ?

What internet services CAN you use ?

----------

## nobspangle

There is no way of telling what your public address is unless you are connected to the Internet (this is a bit of contradiction because you can't have a public address unless you are connected to the Internet) or you have access to the NAT router.

----------

## pjp

 *scuzzo wrote:*   

> 1. What if there was no internet access.....
> 
> 2. This is for in general.

 "in general" probably doesn't have a single solution.  It likely depends on your hardware.

Example.

----------

## scuzzo

well on the network that I am on right now, I do have internet access and whatismyip.com gave me the answer I wanted, but I wanted to know if there was a command I could use in the shell to find out rather than using a website.

----------

## nobspangle

as I said before no, because the only box on your network that knows your public IP is the one connected to the Internet, ie the final router. Unless you have access to that box you can't find out the address.

----------

## bone

[quote="scuzzo"]well on the network that I am on right now, I do have internet access and whatismyip.com gave me the answer I wanted, but I wanted to know if there was a command I could use in the shell to find out rather than using a website.[/quote]

From a shell you could use a text based web browser to goto www.whatsmyip.com (or any of those types of www pages) and get your IP.

----------

