0

I wish to ssh to a machine on my home network, so I intend to set up port forwarding. But how many routers are there between my home server and the external world (i.e. a global IP address)?

I am aware of the following chain: myServer -> routerA -> routerB -> phoneLine

Is there a way to determine how many hops in a route precede a global IP address?

Does every ISP give every subscriber a global IP address, or is it possible that my plan for port forwarding is doomed because the ISP controls a gateway between my routerB and the internet?

Update:

I fancied I could run traceroute and look through its output for an IP address that matched the address which www.whatismyip.com tells me I am, but oddly, there is no match. Whyever not? (There is, however, an address that differs by only 1 in the D block.)

2 Answers 2

1

Your public IP address should be on the equipment provided by your ISP. The simplest way to find it is with the Windows dos shell "tracert" command. Usage works as follows:

tracert www.gooogle.com

This will show you how many hops to the location specified, and the ip address of each hop. You'll see your local router, likely followed by a public IP address on your ISP provided equipment.

4
  • Thanks. I'm running traceroute on my (Linux) machine, but how do I know for sure that a given IP address in the output is global and not internal? (I guess that all the internal addresses I've seen fall in the 10 A block, but I don't suppose that external addresses about using that block.)
    – Jellicle
    Commented Mar 11, 2015 at 18:20
  • Private addresses fall in the following ranges, anything outside of that will be a public address:192.168.0.0 - 192.168.255.255, 172.16.0.0 - 172.31.255.255, 10.0.0.0 - 10.255.255.255.
    – Tom Damon
    Commented Mar 11, 2015 at 18:34
  • Ah. So anything in the private range will never be a public IP address?
    – Jellicle
    Commented Mar 11, 2015 at 18:36
  • Right. Private addresses are not accessible from the internet, only from your local area network, unless you enable port forwarding from your router.
    – Tom Damon
    Commented Mar 11, 2015 at 18:38
1

Please note: Routers are everywhere. What you should be worried about is NAT. “Real�� routers on the internet don’t use it.

Does every ISP give every subscriber a global IPv4 address...?

The answer to that question is, unfortunately, no, absolutely not. Many mobile phone providers don’t have the amount of IP addresses necessary to give every connected device its own address. Instead, they employ Carrier-grade NAT, which is basically a huge NAT router setup. An increasing number of regular ISPs also have to employ this method to provide service to their ever-increasing number of customers.

Tracing route to superuser.com [190.93.244.58]
over a maximum of 30 hops:

  1    <1 ms    <1 ms    <1 ms  192.168.2.1
  2    26 ms    25 ms    12 ms  HSI-KBW-095-208-060-001.hsi5.kabel-badenwuerttem    berg.de [95.208.60.1]
  3    24 ms     8 ms     8 ms  172.30.21.57
  4     8 ms     9 ms     9 ms  84.116.191.33
  5    10 ms    11 ms    29 ms  84.116.191.2
  6    12 ms    12 ms    10 ms  ffm-b1-link.telia.net [62.115.48.101]
  7    16 ms    14 ms    12 ms  ffm-bb1-link.telia.net [62.115.135.233]
  8    11 ms    17 ms    10 ms  ffm-b10-link.telia.net [62.115.137.141]
  9    14 ms    12 ms    16 ms  cloudflare-ic-302937-ffm-b10.c.telia.net [62.115    .35.226]
 10    11 ms    13 ms    14 ms  190.93.244.58

Trace complete.

On the very first hop, you can see my cable router, with its internal IP address 192.168.2.1. Now, while I do indeed have a IPv4 address assigned, it won’t be visible here. Instead, look at the next hop, #2: Its address is an Internet-routable IP address. From this, we can deduce that my router’s external IP is also Internet-routable.

If there were additional hops that contained non-Internet IP addresses, this would hint at a Carrier-grade NAT setup at your ISP.

Traceroute only returns the IP addresses “facing you”. That’s why you don’t get your router’s public IP address. Luckily, there’s plenty of web services available to figure that out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .