Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change public ip method #1

Closed
jposemescouilles opened this issue Apr 6, 2018 · 5 comments
Closed

change public ip method #1

jposemescouilles opened this issue Apr 6, 2018 · 5 comments

Comments

@jposemescouilles
Copy link

jposemescouilles commented Apr 6, 2018

getting wan address via ## curl https://4.ifcfg.me ## does not work for me

I suggest changing that line to

IP=dig +short myip.opendns.com @resolver1.opendns.com

thanks a lot for the script

edit : "source" is also causing problems, should change it to "."

@zwindler
Copy link
Owner

zwindler commented Apr 6, 2018

Thanks,

I'll have a look at it because I don't want to induce a regression for other environments (this scripts runs on many different OSes with differents versions of curl/dig/wget and each time it's a nightmare to make sure it works everywhere)

@cotiga
Copy link

cotiga commented Apr 9, 2018

ifcfg.me Seems to be down
i replaced
IP=curl https://4.ifcfg.me
by
IP=curl http://ifconfig.me

@zwindler
Copy link
Owner

zwindler commented Apr 9, 2018 via email

@jposemescouilles
Copy link
Author

I found this comment on askubuntu pertinent

"The other answers here all go over HTTP to a remote server. Some of them require parsing of the output, or rely on the User-Agent header to make the server respond in plain text. They also change quite frequently (go down, change their name, put up ads, might change output format etc.).
The DNS response protocol is standardised (the format will stay compatible).
Historically DNS services (OpenDNS, Google Public DNS, ..) tend to survive much longer and are more stable, scalable and generally looked after than whatever new hip whatismyip.com HTTP service is hot today.
(for those geeks that care about micro-optimisation), this method should be inherently faster (be it only by a few micro seconds).
Using dig with OpenDNS as resolver:
$ dig +short myip.opendns.com @resolver1.opendns.com"

https://askubuntu.com/questions/95910/command-for-determining-my-public-ip

@zwindler
Copy link
Owner

zwindler commented Apr 23, 2018

Sorry for the time it took me to take your proposition in account.

You had convinced me but I had to take the time to test it, especially as I have a very specific usecase were DNS resolution method is not possible (port 53 blocked).

To answer all usecases, I just use a dump switch which allow both methods to be available, even though DNS resolution is indeed MUCH faster.

Docker images for both ARM and x86_64 should be available.

Many thanks to you both for your suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants