About a week ago I lost port forwarding on my home network. I didn’t change anything but my webcam suddenly became invisible from outside.
I checked the settings and discovered that services like canyouseeme.org and portchecker.co report a different external IP than the one shown in my router’s status page. If I try to connect to my machines with the IP reported by the router forwarding works again.
For webcam I use an externally hosted page which I update with my current external IP every time the cam starts. To get this IP I use
in bash and it reports a different IP from the router (and same as canyouseeme.org). My provider must have changed something in their setup and there’s zero chance that they’ll reverse their policy simply because I call them.
How can I find my actual external IP without manually going to the router’s page and getting it from there? I don’t think it accepts SSH connections, there’s only
"Remote Config Management
Enable"
in options without specifying what to do with it next.
If I run traceroute my actual IP doesn’t appear anywhere in the output.
As I said earlier, i don’t think my router allows for ssh connections and I have no influence over ISP’s policies. Is there a way to find my external IP from the “inside” and without manually logging into the router?
I’ve seen a python script logging into the router, getting the page with assigned IP and then parsing it to extract the address. I can try to make that work in my case but I’m no good at python. There’s also “ip neighbor” command that shows correct external IP among other information and I can parse that in bash, but, confusingly, the machine with webcam attached does not contain that line even if it’s connected via ethernet just the same.
> if you do
>
> Code:
> --------------------
>
> wget whatsmyip.com
>
> --------------------
> you’ll get a file index.html. It has a SetCookie line which contains
> your external IP.
>
>
Well, then let me drop a little bash script I use:
case $1 in
-ip|-i|–ip)
echo $(wget -q -O - http://checkip.dyndns.org/ | sed ‘s/[a-zA-Z<>/ :]//g’)
;;
-h|-help|–help)
echo “${0##/} -i|-ip|–ip - show external IP only"
echo
echo "${0##/} -h|-help|–help - show this help message”
echo
echo “If called without any extra arguments, ${0##*/} will show”
echo “external IP and actual date+time”
;;
*)
echo $(date) |tr ’
’ ’ ’
echo External IP: $(wget -q -O - http://checkip.dyndns.org/ | sed ‘s/[a-zA-Z<>/ :]//g’)
;;
esac
exit 0
The commented line at the top is a drop-in replacement if you want to use
curl instead of wget.
AK
–
Never attribute to malice that which can be adequately explained by stupidity.
(R.J. Hanlon)
Earlier I said that external IP shown on my router’s page works. I was wrong - it works only when used by devices on the same network. That IP is not in the 192.168.2… range so I thought it was “external” but it isn’t. I tried accessing it from mobile phone (with wifi turned off) and got nothing.
The IP reported by canyouseeme and the likes, including the last two suggestions in this thread, does not work either. No ports get forwarded and no ports are reported as open.
On Wed, 26 Oct 2016 15:46:01 +0000, Stan Ice wrote:
> Earlier I said that external IP shown on my router’s page works. I was
> wrong - it works only when used by devices on the same network. That IP
> is not in the 192.168.2… range so I thought it was “external” but it
> isn’t. I tried accessing it from mobile phone (with wifi turned off) and
> got nothing.
>
> The IP reported by canyouseeme and the likes, including the last two
> suggestions in this thread, does not work either. No ports get forwarded
> and no ports are reported as open.
>
> Everything was fine just a week ago…
Even though you don’t have control over your ISP, you might contact them
to see what changed - it’s possible that something changed in their
network and they for some reason aren’t aware of it.
As for pulling it from the router, a python script using mechanize could
do this, but creating such a script would require someone with knowledge
of python and access to your router (or a router with the same firmware)
in order to test it.
You might also check with the router manufacturer to see if they have a
way to programmatically get the external address from the router.
Another option would be to see if your router is supported by OpenWRT, DD-
WRT, or Tomato, which would let you ssh in to extract the address.
Also if i remember correctly there was DDOs that targeted large tech companies last Friday that involves webcams so there might be some new security protocols that are being implemented.
The matter was resolved on ISP end, their technician said something about them running out of IP addresses to give and so customers who want port forwarding have to request their router’s IP being moved from behind their “proxy” or whatever they used. After doing that the IP reported by the router now matches the IP reported by outside services.
Jetchisel, I don’t think recent DDOS attack had anything to do with it but it’s a nice reminder that the world outside is dangerous. Also curl and wget scripts only get the IP of the “proxy”, not my router’s. It’s the same IP I get with dig command mentioned in the OP.