Command line utility to get external IP address

User avatar
John Gray
PlatinumLounger
Posts: 5401
Joined: 24 Jan 2010, 08:33
Location: A cathedral city in England

Re: Command line utility to get external IP address

Post by John Gray »

Interesting, but almost totally incomprehensible, results!

With the VPN connected, a couple more Interfaces, the VPN and another Microsoft ISATAP Adapter.
And a whole lot more in the IPv4 Route Table.

And my "Network" now has "Internet Access" back...

IPCONFIG says
with VPN connected:-

Windows IP Configuration
PPP adapter One's VPN:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 192.168.0.56
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 0.0.0.0


and with the VPN disconnected:-

Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 192.168.11.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.11.1
John Gray

Venison is quiet deer, and quite dear.

User avatar
Argus
GoldLounger
Posts: 3081
Joined: 24 Jan 2010, 19:07

Re: Command line utility to get external IP address

Post by Argus »

John Gray wrote:And Windows 7 doesn't seem to have a telnet command.
I think you can find Telnet under "Turn Windows features on or off", Control Panel. (Same as in Vista, I think.)
John Gray wrote:And I've tried several other web addresses, but they are not PINGable, so I suspect my router doesn't allow ICMP out.
Or perhaps your software firewall; there could be differences between operating systems, post Windows XP (i.e. Vista and 7). :hairout:
http://www.howtogeek.com/howto/windows- ... -firewall/" onclick="window.open(this.href);return false;
http://social.msdn.microsoft.com/Forums ... 728cd5db1/" onclick="window.open(this.href);return false;
There are some more threads and articles out there; I haven't checked this closer. Sorry, close to dinner. :smile:
Byelingual    When you speak two languages but start losing vocabulary in both of them.

User avatar
StuartR
Administrator
Posts: 12577
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Command line utility to get external IP address

Post by StuartR »

John Gray wrote:Interesting, but almost totally incomprehensible, results!...
Each row of the table shows the following information
  • Network Destination and Netmask. These two define a range of IP addresses. For example 127.0.0.0 255.0.0.0 means any IP address that starts 127., regardless of the remaining numbers
  • Gateway is the IP address of the gateway that packets should be sent to
  • Interface is the IP address of the local device that should be used to send the packets
  • Metric is used to separate out multiple possible routes. If there is more than one valid route that could be used for a particular destination then the one with the lowest metric will be used.
Here is an example with (a bit of) explanation

Code: Select all

Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0    192.168.1.254     192.168.1.64     10
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.1.0    255.255.255.0         On-link      192.168.1.64    266
     192.168.1.64  255.255.255.255         On-link      192.168.1.64    266
    192.168.1.255  255.255.255.255         On-link      192.168.1.64    266
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link      192.168.1.64    266
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link      192.168.1.64    266
This is on a laptop that has an IP Address of 192.168.1.64 on the local network, the only other interface it has is 127.0.0.1 which is the internal loopback address inside the TCP/IP software.

Some packets will be sent directly to the local network without being sent to the default gateway address. These are coded by
  • The bottom two lines (matching the EXACT address 255.255.255.255). The interface 192.168.1.64 will be used because this has the lowest metric.
  • The next two lines (matching addresses starting 224, 225, ... up to 255) also being sent via 192.168.1.64
  • The next three lines, which match anything sent to an address starting 192.168.1. These are packets sent to other things on my home network, such as my printer
The next few lines say that all packets sent to addresses starting 127. should be sent directly, via the loopback interface

Finally the very top line says that everything else will be sent to the default gateway (192.168.1.254) via the interface at 192.168.1.64)
StuartR