Author Topic: How To Find External IP From Behind A Router  (Read 1915 times)

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8838
  • Aurum nostrum non est aurum vulgi.
How To Find External IP From Behind A Router
« on: March 18, 2011, 07:49:30 PM »
If you are behind a router on your home network, and your ISP assigns you a dynamic IP, your machine would probably tell you your IP address is 192.168.1.88.

[user@localhost ~]$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1A:80:1B:1D:27
          inet addr:192.168.1.88  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: ****::***:****:****:****/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5153411 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22248630 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4411355917 (4.1 GiB)  TX bytes:3225482953 (3.0 GiB)
          Interrupt:16
[user@localhost ~]


Well, that's not exactly right. Here's what you can do:

[user@localhost ~]$ wget -qO - http://cfaj.freeshell.org/ipaddr.cgi
125.***.***.39
[user@localhost ~]$
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


Offline YouCanToo

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 5383
  • Location: Lebanon, OR., USA
    • Spreading the word.......
Re: How To Find External IP From Behind A Router
« Reply #1 on: March 18, 2011, 09:10:45 PM »
If you are behind a router on your home network, and your ISP assigns you a dynamic IP, your machine would probably tell you your IP address is 192.168.1.88.

[user@localhost ~]$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1A:80:1B:1D:27
          inet addr:192.168.1.88  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: ****::***:****:****:****/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5153411 errors:0 dropped:0 overruns:0 frame:0
          TX packets:22248630 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4411355917 (4.1 GiB)  TX bytes:3225482953 (3.0 GiB)
          Interrupt:16
[user@localhost ~]


Well, that's not exactly right. Here's what you can do:

[user@localhost ~]$ wget -qO - http://cfaj.freeshell.org/ipaddr.cgi
125.***.***.39
[user@localhost ~]$



You could just go to http://whatismyip.com and it will actually show you your public ip




Be sure to visit the NEW Knowledge Base


Linux is user-friendly- it's just picky who its friends are!

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: How To Find External IP From Behind A Router
« Reply #2 on: March 18, 2011, 09:16:41 PM »
Good to know both ways. :)

Offline Archie

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8838
  • Aurum nostrum non est aurum vulgi.
Re: How To Find External IP From Behind A Router
« Reply #3 on: March 18, 2011, 10:43:02 PM »
You could just go to http://whatismyip.com and it will actually show you your public ip


A user's browser pointing to http://whatismyip.com is certainly one of the few ways of doing it. Just as a user can easily type in a simple command on the terminal would accomplish the same thing. Freedom and choices.
« Last Edit: March 19, 2011, 05:11:12 AM by old-polack »
Since 2006 | LiCo 401868 | Bare Metal | What is necessary is never unwise. --Sarek, 2258.42


AndrzejL

  • Guest
Re: How To Find External IP From Behind A Router
« Reply #4 on: March 19, 2011, 04:11:40 AM »
I wrote this while back:

Quote
#!/bin/sh
external_ip=`curl http://www.whatismyip.com/faq/automation.asp`
echo "My IP address is: "$external_ip
echo "End!"

Regards.

Andy
« Last Edit: December 05, 2011, 06:12:49 AM by AndrzejL »

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: How To Find External IP From Behind A Router
« Reply #5 on: March 19, 2011, 04:12:15 AM »
......... Freedom and choices.

A big +1! :)

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11689
  • ----IOFLU----
Re: How To Find External IP From Behind A Router
« Reply #6 on: March 19, 2011, 05:20:32 AM »
I use:

----------------------------------------------------------------
#!/bin/bash
# Name: myip
# Author: O-P
# Purpose: Check current public IP address

curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'


-----------------------------------------------------------------

This is in ~/bin so it's in my $PATH. I type myip at a prompt, press the Enter key, and the number is displayed.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: How To Find External IP From Behind A Router
« Reply #7 on: March 19, 2011, 08:06:41 AM »
Some locations for checking IP addresses in addition to the command line methods

checkip.dnydns.org
www.showmyip.com
showip.net
www.displaymyip.com

Offline menotu

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 15515
  • ┌∩┐(◕_◕)┌∩┐
Re: How To Find External IP From Behind A Router
« Reply #8 on: March 19, 2011, 08:26:49 AM »
PCLinuxOS 32bit KDE 4.10.4; kernel-3.4.11-pclos1.bfs & 64bit 3.4.38bfs; NVidia GeForce 8400GS 1GB 310.19 driver

Sony Vaio SVE1513A4ESI Laptop, Intel Core i5, 2.6GHz, 6GB RAM, 750GB, 15.6" Intel HD Graphics 4000

Offline Jonesy

  • Sr. Member
  • ****
  • Posts: 301
Re: How To Find External IP From Behind A Router
« Reply #9 on: September 09, 2011, 04:28:19 PM »
I wrote this while back:

Quote
#!/bin/sh
external_ip=`curl http://www.whatismyip.com/automation/n09230945.asp`
echo "My IP address is: "$external_ip
echo "End!"

Regards.

Andy


That URL is now defunct, the script should now read:

Code: [Select]
#!/bin/sh
external_ip=`curl http://automation.whatismyip.com/n09230945.asp`
clear
echo "My IP address is: "$external_ip
echo "End!"

I added clear so as to remove the extraneous data and just print the required info.

Rgds  ;)
« Last Edit: September 09, 2011, 04:46:17 PM by Jonesy »
"But it was ok before.... honest"

Offline and then..

  • Sr. Member
  • ****
  • Posts: 463
Re: How To Find External IP From Behind A Router
« Reply #10 on: September 09, 2011, 05:31:54 PM »
My IP.sh
Code: [Select]
clear
echo "Your Public IP is:"
wget http://checkip.dyndns.org/ -q -O - | grep -Eo '\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>'
 

Offline maxpolaris

  • Full Member
  • ***
  • Posts: 95
Re: How To Find External IP From Behind A Router
« Reply #11 on: December 05, 2011, 02:53:21 AM »
I love these little snippets for command line. I like to copy them into txt files so I can toy with them.

Offline cirrus_minor

  • Full Member
  • ***
  • Posts: 123
  • ☆★ #watp ★☆
    • cirrus minor
Re: How To Find External IP From Behind A Router
« Reply #12 on: December 05, 2011, 03:01:09 AM »
you can also visit my page at http://cirrusminor.info  and the lil danasoft widgit will show ur browser/OS/IP  :P  .>PLUG<. :P


$ PCLOS~KDE~ 2011.Kernel:2.6.38.8
CPU:Intel® Pentium D 2x3.GHz
GPU:ASUS® [G92 EN8800 GT TOP] 512MB DDR3.
Memory:3072MB'DDR2 | HDD Size 1TB
Audio:Audigy2 ZS 7.1

Offline DeBaas

  • Hero Member
  • *****
  • Posts: 1535
    • PCLinuxOS.nl
Re: How To Find External IP From Behind A Router
« Reply #13 on: December 05, 2011, 03:02:32 AM »
http://test-ipv6.com/

Is showing my ipv4 and ipv6 addresses on the net.