Curl My Ip



Get my IP Address. Need a robust API to Geolocate IPs and fetch other crucial information? $ curl ifconfig.me/ip. IPv4 or IPv6 still can be forced by passing the appropiate flag to your client, e.g curl -4 or curl -6. Can I force getting JSON? Setting the Accept: application/json header works as expected. Is automated use of this service permitted? Yes, as long as the rate limit is respected. The rate limit is in place to ensure a fair service for all. IP Address: curl globalip.me 157.55.39.252: IP address: curl globalip.me?ip: 157.55.39.252: method: curl globalip.me?method: GET: protocol: curl globalip.me?protocol. Very strange things: it works sometimes (and curl the result) and mostly of time it says: could not bind to zz.zz.zz.zz – yarek Apr 13 '17 at 19:44 1 According to the man page the -interface option can take an interface name, IP address or host name. Normally, if we want to find the public IP Address we use, we go to google and search “what is my ip address”. But if you use Linux, you can get your public IP Address from the command line using curl command. The curl command with ifconfig.me argument will show your public IP Address.

This Linux quick tip will show you many different way to get your public IP address from the command line using different tools. Since not all Linux distributions have the same set of packages (programs) installed, some of these example may or may not work on your system. For example, default Red Hat and CentOS installations do not have the dig tool installed.

All of these options will depend on external sources. We will try to use as many different sources as possible in the examples to ensure reliability.

Using the curl Command

Curl is a tool used to transfer data to and from a server using many different supported protocols. Here we will use the HTTPS protocol to pull a webpage and grep to extract our public IP address. Here are some examples of how to get your public IP address from the command line using curl.

ipaddr.pub

Address

The ipaddr.pub service can also provide additional information from the command line. You can find a complete list of options on the ipaddr.pub website.

ifconfig.io

WhatismyIP.com

Google.com

ipecho.net

akamai.com

Using the wget Command

The wget command is a command line utility for non-interactive download of files from the web. It supports most HTTP, HTTPS, and FTP as well as connecting through a HTTP Proxy server. Here are some examples of how to get your public IP address from the command line using wget.

ipaddr.pub

ipecho.net

icanhazip.com

Using the dig Command

The dig command is a command line tool for querying DNS servers. This utility is not always available. If you want to install dig, it is usually packaged in bind-utils on Red Hat based distros and dnsutils on Debian based distros. Here are some examples of how to get your public IP address from the command line using dig.

google.com

opendns.com

Using the host Command

The host command is a simple command line utility for performing DNS queries. Here are some examples of how to get your public IP address from the command line using the host command.

opendns.com

Using the nslookup Command

The nslookup command is tool that queries DNS Servers, much like dig. This command is available on many operating systems including Linux, UNIX and Windows. Here are some examples of how to get your public IP address from the command line using nslookup.

Curl My Ip Json

google.com

opendns.com

Conclusion

There are many different ways to get your public IP address from the command line. Which you use will mostly depend on what is installed on your system. Our preferred method would be from a DNS server using the dig command, but as we stated, dig isn’t always available.

Curl What Is My Ip

References