VMware ESXi and vSphere Cluster Management

Display and Configure an IP Address on Raspberry Pi

Learn how to find a Raspberry Pi IP address with ifconfig and ip addr, understand interface output, and temporarily configure an IPv4 address safely.

An IP address identifies a network interface on an IP network. Your Raspberry Pi uses an IP address to communicate with other devices on the local network, such as a router, computer, printer, or another Raspberry Pi.

The address belongs to an interface rather than to the Pi as one undifferentiated object. A Pi can have one address on wired Ethernet, another on Wi-Fi, and a loopback address for communication with itself.

Common Raspberry Pi Network Interfaces

A network interface is a physical or virtual connection point through which a system communicates on a network.

InterfaceTypical purposeExample address typeNotes
eth0Wired EthernetPrivate IPv4 address such as 192.168.5.11A conventional name for the first wired Ethernet interface.
wlan0Wi-FiPrivate IPv4 address assigned by Wi-Fi DHCPA conventional wireless name. Interface names can vary on newer Linux installations.
loLoopback127.0.0.1Used for local-host communication, diagnostics, and troubleshooting. It does not connect to other devices.

Display Network Settings with ifconfig

ifconfig is a traditional Linux utility for displaying and changing network interface settings. Run it without options to list active interfaces and their network settings:

ifconfig

Depending on the system, the output includes interface names, IPv4 and IPv6 addresses, subnet-mask information, broadcast addresses, MAC address data, status flags, and traffic statistics such as received and transmitted packets.

To include interfaces that are currently inactive, use:

ifconfig -a

ifconfig is a legacy utility. It may not be installed by default on current Raspberry Pi OS releases. The modern Linux command for viewing addresses is:

ip addr show

To inspect one interface with the modern command:

ip addr show dev eth0

Use ip link show to inspect link and administrative state:

ip link show
ip link show eth0

Install ifconfig if it is required

On a Debian-based Raspberry Pi OS installation, the legacy command is provided by the net-tools package:

sudo apt install net-tools

Prefer ip addr and ip link for new work, but installing net-tools can help when following a workflow that specifically requires ifconfig.

Read an IPv4 Address in ifconfig Output

IPv4 is the common dotted-decimal address format, for example 192.168.5.11. In traditional output, look under the interface you care about, such as eth0 or wlan0, and find the inet or older inet addr field.

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.5.11  netmask 255.255.255.0  broadcast 192.168.5.255
        inet6 fe80::abcd:1234:5678:9abc  prefixlen 64  scopeid 0x20
        ether dc:a6:32:12:34:56  txqueuelen 1000  (Ethernet)
        RX packets 1200  bytes 987654
        TX packets 950   bytes 765432
FieldMeaningExampleWhy it matters
inet or inet addrThe interface's IPv4 address192.168.5.11This is the address other devices use to reach the Pi over IPv4.
netmask or MaskDefines which portion of the IPv4 address identifies the local network255.255.255.0Determines whether another address is local to the same subnet.
broadcast or BcastThe broadcast address for the subnet192.168.5.255Used to send traffic to all suitable devices on the local subnet.
etherThe interface's MAC addressdc:a6:32:12:34:56A hardware-level identifier; it is not the IPv4 address.
Status flagsAdministrative and link conditionsUP, RUNNING, BROADCASTHelp show whether the interface is enabled and has an active link.

Do not confuse the IPv4 value in inet with the netmask, broadcast address, an IPv6 value in inet6, or the MAC address in ether. In this example, 192.168.5.11 is the IPv4 address.

DHCP-Assigned Addresses

DHCP, or Dynamic Host Configuration Protocol, automatically supplies network settings to a client. A typical home router acts as a DHCP server and provides the Pi with an IPv4 address, subnet mask, default gateway, and DNS settings.

DHCP is convenient, but its address assignments can change. A different address may be issued after a lease expires, the Pi reconnects, or the router's DHCP state changes. If the Pi must reliably use the same address, use a DHCP reservation on the router or configure a persistent address through the active operating-system network manager.

Safely Plan a Manual Address Change

A subnet is a logical local network defined by an address and a network mask. Before assigning an address, verify:

  • You selected the correct interface, such as eth0 for wired Ethernet.
  • The cable or Wi-Fi connection is active.
  • The chosen address belongs to the connected subnet.
  • No other device is already using the address.
  • You have local console access or another recovery method if the change interrupts remote access.

First inspect the current state:

ifconfig
ip link show eth0
ip addr show dev eth0

Compare the Pi's current address and mask with a known-working device on the same LAN. An address already in use can create an IP conflict, where two devices claim the same address and connectivity becomes unreliable.

Temporarily Assign an IPv4 Address with ifconfig

To assign 192.168.5.11 with the mask 255.255.255.0 to the wired interface, run:

sudo ifconfig eth0 192.168.5.11 netmask 255.255.255.0

Administrative privileges are required because this changes kernel network settings. Use this command only when the address is unused and appropriate for the connected subnet.

This is a temporary runtime change, not a durable static-IP setup. It can be replaced after a reboot, reconnecting the interface, renewing DHCP, or allowing NetworkManager, dhcpcd, or another network service to reconfigure the interface.

Verify the temporary assignment

ifconfig eth0
ip addr show dev eth0

Confirm that the expected address appears on the intended interface and that the netmask or prefix is correct. Then test local connectivity, for example by pinging a known device or the local router:

ping -c 4 192.168.5.1

Use the actual gateway or another known address for your network. A successful interface display does not by itself prove that the wider network is reachable.

Enable and Disable an Interface

Bring an interface up with:

sudo ifconfig eth0 up

Bring it down with:

sudo ifconfig eth0 down

Disabling an interface stops that network path. If the interface carries your SSH session, the connection can terminate immediately. Do not bring down the interface used for remote administration unless you have local console access, a second network path, or another reliable recovery method.

After enabling an interface, check its link state and address again:

ip link show eth0
ip addr show dev eth0

Temporary Versus Persistent Address Configuration

MethodSurvives rebootBest useCaution
ifconfig assignmentNoShort, controlled tests or troubleshootingCan be overwritten by DHCP or a network service and can cause conflicts if the address is already used.
DHCP reservationUsually, through the routerKeeping the same address while retaining automatic host configurationRequires access to the router or DHCP server, and depends on the reservation being configured correctly.
Operating-system network manager configurationYes, when configured correctlyA true persistent static address or managed connection profileUse the method active on the system, such as NetworkManager, dhcpcd, or another distribution-specific mechanism.

Do not treat the temporary ifconfig command as a persistent static-IP procedure. Persistent configuration must be made through the network-management method that controls the interface on your Raspberry Pi OS installation.

Safe Verification Workflow

  1. Identify whether the connection is wired or wireless and select the matching interface.
  2. Inspect the interface with ip link show and ip addr show, or with ifconfig if it is installed.
  3. Confirm the link is up and record the existing IPv4 address, mask, and interface name.
  4. Check that a proposed address is valid for the local subnet and is not already in use.
  5. Make the smallest required change, preferably with local access available.
  6. Recheck the interface output and test a known local address.
  7. If the address must remain fixed, configure a DHCP reservation or a persistent profile using the active network manager.

Troubleshooting

ifconfig: command not found

The net-tools package is probably not installed. Use the modern command first:

ip addr show

If a specific procedure requires ifconfig, install it with:

sudo apt install net-tools

No IPv4 address appears on eth0

  • Check the Ethernet cable and the router or switch port.
  • Inspect the link state with ip link show eth0.
  • Make sure the interface has not been administratively disabled.
  • Check that the DHCP server is available and reconnect or renew through the active network manager.

The Pi cannot be reached after assigning an address

The address may be outside the local subnet, the netmask may be wrong, another device may already use the address, or the temporary change may not have supplied a default gateway or DNS configuration. Compare the address and mask with another working device, choose an unused address, and restore DHCP or use the system's persistent network configuration method when appropriate.

The manual address disappears

This is expected after a reboot or after DHCP or another network manager reconfigures the interface. Use a DHCP reservation or configure a persistent connection profile through the service managing the interface.

An SSH connection drops

The address may have changed on the interface carrying SSH, or that interface may have been brought down. Use local console access or a second network path, then reconnect using the new address after verifying the interface state.

Exam-Relevant Notes

  • ifconfig is a legacy utility; ip addr is the modern address-inspection command and ip link is useful for link status.
  • eth0 conventionally identifies wired Ethernet, wlan0 commonly identifies Wi-Fi, and lo is loopback.
  • The inet or inet addr field contains an IPv4 address.
  • netmask describes the local subnet; ether identifies the interface's MAC address.
  • DHCP supplies settings automatically, but the assigned address can change.
  • An ifconfig assignment is temporary and requires sudo.
  • Changing or disabling the interface used by SSH can disconnect you immediately.

For a concise reference, review Raspberry Pi IP address display commands and compare the legacy and modern output for the interface you need to manage.