What's new

Retrieving External IP (w/curl) not working

lcalamar

Occasional Visitor
I created a script to change my A record at Cloudflare when my external IP is changing.

Lately though - the way I retrieve my external IP is not working... I am using this:
$curl -fs4 https://api.seeip.org/?

When I run that from a bash script or in terminal I am not getting the correct IP -

But if I run it from a web browser it returns the correct IP.

Use case:
- check external IP in web site: (directly on https://www.ipify.org - returns: "136.XX.XXX.XXX"
- From Terminal: $curl 'https://api.ipify.org?format=json' - returns "136.XX.XXX.XXX"
- Connect to VPN
- check external IP in web site: (directly on https://www.ipify.org - returns: "146.YY.YYY.YYYY"
- From Terminal: $curl 'https://api.ipify.org?format=json' - returns "136.XX.XXX.XXX" (same as original check before connecting to VPN)

Any ideas/how to fix - so that I'm retrieving the correct external IP???
Note: the 'service' doesn't change anything - have tried several...
 
It looks like it's working to me. But that depends on how you have configured your VPN client and what your intention is. You'd usually want the router to know your "real" IP address, not that of your VPN provider.
 
It looks like it's working to me. But that depends on how you have configured your VPN client and what your intention is. You'd usually want the router to know your "real" IP address, not that of your VPN provider.
OH MY - THANK YOU SO MUCH FOR: "depends on how you have configured your VPN client"...
- my split tunneling was causing it. DOH!
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top