4 IP Configuration Commands Every SysAdmin Should Know

Learn 4 Linux and Windows commands to display IP address settings for network configuration and troubleshooting.

Male with glasses looking at laptop screen next to window during the day

One fundamental component of network troubleshooting on a server is displaying the current IP address configuration. Doing so allows system administrators to confirm the address is assigned and correct.

Consider the following example: A system cannot be reached from across the network. As part of troubleshooting, the administrator checks the system’s IP address.

The IP address displayed on the system is The administrator should recognize this as an Automatic Private IP Address (APIPA) configuration or link-local address that indicates the device could not successfully lease an IP address configuration from a Dynamic Host Configuration Protocol (DHCP) server.

Because the administrator can view the IP settings, they now have a course of action to make the system accessible again.

Like many tasks, displaying the IP address is more quickly done via the command line interface (CLI) than the graphical user interface (GUI). Let’s discuss four ways you can display IP configurations in both Linux and Windows.

Displaying IP Configurations in Linux

The common tool for displaying IP address information in Linux has been ifconfig. While many distributions still ship with ifconfig, it is gradually being replaced with the ip command. During this transition, it’s critical to know how to work with both.

Using the ifconfig Command

ifconfig Command

Figure 1: Display IP address information with ifconfig

The ifconfig command displays the network configuration for active interfaces. Depending on the system, this output can be very long, so it’s also possible to display the configuration for specific interfaces. To see the IP address for the enp0s3 interface, for example, type the following command:

# ifconfig enp0s3

Some configuration is also possible via the ifconfig command. For example, you can up or down NICs (enable or disable) by using this command:

# ifconfig enp0s3 down

# ifconfig enp0s3 up

It’s important to note that the ifconfig command is one of several choices to display the IP address configuration on macOS.

The ifconfig command even allows administrators to set a static IP address on an interface. Here’s an example of configuring the address and subnet mask on enp0s3:

# ifconfig enp0s3 netmask

Also, note that you can use the route command to add a default gateway after setting the static IP address with ifconfig. For example, to set a default gateway of to the system, type:

# route add gateway enp0s3

Using the ip Command

The ip command is relatively new to the Linux scene. It’s more robust and more complex than ifconfig. Some Linux distributions have both tools installed but be aware that many have just one.

The syntax of the ip command is different from ifconfig. It uses a command subcommand structure. Here’s a basic example of displaying the IP configurations of all interfaces:

# ip addr

There are many subcommands available for ip beyond the addr example displayed above. Routing and link configurations can also be manipulated.

The subcommand syntax is flexible. Formal training on the ip command might show the following example for displaying all IP address information:

# ip address show

However, this command can be abbreviated down to ip addr or even just ip a.

Like ifconfigip addr displays the configuration of all active interfaces. To focus the command on the enp0s3 interface, simply type the following:

# ip addr show enp0s3

ip addr

Figure 2: Display IP address information with ip addr

Finally, like ifconfig, the ip command can configure a static IP on a NIC. Here’s an example, using the same addressing information from the ifconfig example above:

# ip addr add dev enp0s3

It’s a good idea for Linux administrators to get used to both the ifconfig and ip commands for displaying network configurations. Confirming IP address settings is critical enough that even Windows administrators should have a basic understanding of these two commands in case they are ever signed into a Linux device.

Displaying IP Configurations on Windows

Many Windows administrators are comfortable with displaying network information through the GUI. There are several ways of accessing this information, including the server manager console and the properties of the network interface. However, it’s useful to display network settings from the command line.

Using the ipconfig Command

The ipconfig command displays the basic IP addressing information for each network interface on the Windows system. This information includes both the IP address and subnet mask.

PS C:\> ipconfig

However, more verbose output can be useful. By adding the /all switch to ipconfig, administrators can display a great many useful settings, including the Media Access Control (MAC) address, DHCP lease information, name resolution servers and the system’s fully qualified domain name (FQDN).

PS C:\> ipconfig /all

Most Windows administrators benefit from knowing all the switches associated with ipconfig, but two of the critical options are /release and /renew. On a system configured as a DHCP client, the /release switch clears the DHCP configuration. The /renew switch forces a new DHCP lease generation process, permitting the client to receive updated network settings from a DHCP server.

Using PowerShell Network cmdlets

Microsoft continues to emphasize the use of Windows PowerShell as the preferred CLI for modern Windows systems. PowerShell includes several network cmdlets to display and manipulate network settings.

For those who are less familiar with PowerShell’s syntax, recall that a cmdlet is a combination of a verb as the first word and a noun as the second word. For example, the Get-Date cmdlet specifies the system should “get” or retrieve a value, and that value is specifically the date.

The simplest cmdlet for showing IP address settings is Get-NetIpAddress. This cmdlet displays the address for all active interfaces. Additional parameters can be added to better narrow the output.

Here’s the basic cmdlet:

PS C:\> Get-NetIpAddress

Here’s the cmdlet with a more elegant output:

PS C:\> Get-NetIpAddress | Format-Table

Adding the -AddressFamily IPv6 parameter to the cmdlet causes it to display only IPv6 addressing information.

IP address info with Windows PowerShell

Figure 3: Display IP address information with Windows PowerShell

There are other similar cmdlets that provide additional flexibility or information.

For example, to display interface-specific information, type:

PS C:\> Get-NetIpInterface

Display interface info with Windows PowerShell

Figure 4: Display interface information with Windows PowerShell

Or, to display configuration details such as name resolution servers and interfaces, type:

PS C:\> Get-NetIpConfiguration

Displaying IP Address Settings

One of the earliest steps in troubleshooting network connection problems is to verify the IP address configuration of the source and destination devices. Linux sysadmins should have a general idea of how to check these settings on a Windows box, and Windows admins should know similar commands on Linux. Since many router operating systems are based on the Linux kernel, the knowledge of commands such as ifconfig and ip addr is very practical.

While administrators can use the Windows GUI tools to display this information, it’s often more efficient to use the command line. Linux administrators may not have GUI utilities available, especially on server deployments.


Get more tutorials like this right in your inbox with CompTIA’s IT Career Newsletter. Subscribe today, and you can save 10% off your next CompTIA purchase.

Email us at [email protected] for inquiries related to contributed articles, link building and other web content needs.

Read More from the CompTIA Blog

Leave a Comment