Possible Duplicate:
Finding the Public IP address in a shell script
I'm currently doing this in a script:
EXTERNAL_IP=`curl -s http://whatismyip.org`
There's got to be a built in linux command or something for this, no?
I'm currently doing this in a script:
There's got to be a built in linux command or something for this, no?
| |||||
feedback
|
This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.
|
No, there is no built-in command, and even the command you suggest may not give you what you want if your NAT device is doing anything more complex then a simple masquerading. | |||
|
feedback
|
|
If you mean your source address as the rest of the Internet sees it, then the way you're doing it now is pretty much it. A machine behind a firewall or other device doing NAT will be happily unaware of any address translation done further along. You might find that http://ifconfig.me is a bit cleaner for what you're after - have a look under the Command Line Interface section on the front page. | |||||||
feedback
|