Which of the following commands could be used to determine your current IP address?

Updated: 08/31/2020 by

Which of the following commands could be used to determine your current IP address?

You can determine the IP address of a website using the ping command from a command line. Below are steps on how to use the ping command and other commands to get an IP address.

Using ping in MS-DOS or Windows command line

Below are the steps on how to use the Windows command line to determine the IP address of a website.

  1. Open the Command Prompt.
  2. Run the following command at the command prompt, replacing "google.com" with the domain name of the website you're trying to find the IP address.
ping google.com
  1. Review the output (similar to the below output) to see the domain name, IP address, and the responses from the server if accepted.
Pinging google.com [216.58.216.164] with 32 bytes of data:

Reply from 216.58.216.164: bytes=32 time=30ms TTL=53
Reply from 216.58.216.164: bytes=32 time=30ms TTL=53
Request timed out.
Reply from 216.58.216.164: bytes=32 time=31ms TTL=53

Ping statistics for 216.58.216.164:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 30ms, Maximum = 31ms, Average = 30ms

Using the ping in the Linux command line

  1. Open the Linux command shell.
  2. Run the following command at the command prompt, replacing "google.com" with the domain name of the website you're trying to find the IP address.
ping google.com
  1. Review the output (similar to the below output) to see the domain name, IP address, and the responses from the server if accepted.
PING google.com (216.58.216.164) 56(84) bytes of data.
64 bytes from www.google.com (216.58.216.164): icmp_seq=1 ttl=63 time=0.267 ms

--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.267/0.267/0.267/0.000 ms

Why is the IP address long or not only numbers?

If you see an address containing letters, numbers, and commas (e.g., 2607:f8b0:4005:805::200e) the website uses an IPv6 address and not an IPv4 address.

Using nslookup to look up an IP address

The nslookup command is used to query your nameserver for the IP address of a hostname. The command is available from the Windows command line, or a linux or macOS X terminal. Example:

nslookup wikipedia.org
Server: [name.server]
Address:  [nameserver.address]

Non-authoritative answer:
Name:    wikipedia.org
Addresses:  2620:0:860:ed1a::1
          208.80.153.224

For more information, see the command documentation:

  • Windows/MS-DOS nslookup
  • Linux nslookup

Using online services

Online services exist that help you determine the IP address of a website. Such services are particularly helpful if ICMP requests (pings) are being filtered somewhere between you and the site.

Introduction

An IP address is a codename assigned to a computer on a network. It works as a postal address, ensuring that network traffic is sent to the correct computer.

In this tutorial you will learn how to find your IP address using a Linux operating system.

Which of the following commands could be used to determine your current IP address?

Prerequisites

  • A Linux operating system
  • Access to a terminal window/command-line (optional) (CtrlAltT, CtrlAltF2)

Find Your IP Address From the Command Line

There are a few different commands you can use to check your IP address. To run these commands, start by opening a terminal window/command line.

Using the hostname Command

One way to check your IP address from the command-line is by using the following command:

hostname -I

The system will display your internal IP address.

Which of the following commands could be used to determine your current IP address?

Using the ip addr Command

Check your ip address with the ip addr command:

ip addr

The system will scan your hardware, and display the status for each network adapter you have. Look for an entry that says link/ether. Below it, you should see one of the following:

inet 192.168.0.10/24
inet6 fe80::a00:27ff:fe76:1e71/64

Which of the following commands could be used to determine your current IP address?

The entries will include one for a wired (Ethernet) adapter and a wireless (Wi-Fi) adapter. You may also have an entry for a virtual adapter. Generally, only one entry will have an IP address listed – that is the one you will want.

Note: The number after the slash – /24 and /64 – specifies the size of the network, and it helps with scanning and mapping network size.

Using the ifconfig Command

The third method to find your IP address involves using the ifconfig command. In the command line, enter the following:

ifconfig

The system will display all network connections – including connected, disconnected, and virtual. Look for the one labeled UP, BROADCAST, RUNNING, MULTICAST to find your IP address. This lists both IPv4 and IPv6 addresses.

Note: When you check your IP address, you may notice the term loopback. This refers to an IP address that returns traffic to the same computer. Usually, the loopback address is 127.0.0.1. If you see that address listed, either you are looking at the wrong line, or you are not connected to the network.

Read phoenixNAP’s ultimate Linux IP command tutorial with 31 examples to learn more!

Finding Your IP Address in Linux With a GUI

If you are using a point-and-click interface to run your Linux system, you can check your IP address by following these steps:

1. Go to the Application menu and type Settings into the search bar.

2. Click on the Settings icon that appears among the results, as in the image below:

Which of the following commands could be used to determine your current IP address?

3. Next, find the Network tab in the Settings Menu and click on the Advanced Wired Settings icon.

Which of the following commands could be used to determine your current IP address?


4. This opens a new pop-up window with details on wired settings. Here you can find both your IPv4 address and your IPv6 address.

Which of the following commands could be used to determine your current IP address?

To find your public IP address, reach out to an external website.

If you are using a browser, navigate to:

https://www.whatismyip.com

Or

https://icanhazip.com

If you are using a command-line or terminal, use a retrieval command like curl or wget to display the external IP address:

curl -s https://icanhazip.com
wget -O - -q https://checkip.amazonaws.com

Which of the following commands could be used to determine your current IP address?

Note: Did you know that when you use curl to connect to an insecure website, the output responds with an error? To resolve it, visit our guide on making curl ignore certificates.

What is a Public/Private IP Address?

Each computer in a network is required to have its own IP address. If two systems have the same IP address, it will generate errors on the network. Most modern networks will detect the problem and prompt you to fix it. However, older networks might get confused, trying to route traffic to both computers.

Most systems will have two different IP addresses:

  • Private IP address: This is the address used on the network. Also, it is the one you will want to use for configuring routing tools. On smaller networks, the internal IP address typically starts with 192.168.x.x. It is dynamically assigned to your computer whenever you connect.
  • Public IP address: This is the IP address that registers on a website when you visit it. When you connect to a small network, your computer connects to a router using an internal IP address. That router, in turn, connects to a bigger network (like an Internet Service Provider), which has its own IP address system.

Conclusion

Now you know how to find a private and public IP address in Linux using multiple methods.

Each option strikes a balance between speed and complexity. Now you have the flexibility to choose, if you only need your internal IP address, you can use the hostname method. If you need more detailed information, view our article on 31 Linux IP Commands with examples.

Which command is used to find IP address in Linux?

Using the ifconfig Command The system will display all network connections – including connected, disconnected, and virtual. Look for the one labeled UP, BROADCAST, RUNNING, MULTICAST to find your IP address. This lists both IPv4 and IPv6 addresses.

What are the 3 main commands in ipconfig?

Table of Content.
ipconfig - Retrieves Basic TCP/IP Network Information (IP, subnet mask, gateway).
ipconfig /all - Retrieves All TCP/IP Network Information (MAC address, adapter description, DHCP details).
ipconfig /release - Releases the IPv4 Address of All Network Adapters..