15%

Save 15% on All Hosting Services

Test your skills and get Discount on any hosting plan

Use code:

Skills
Get Started
02.01.2026

Which linux command can you use to display or change ip configuration settings?

On modern Linux systems, network configuration is managed through a set of command-line tools that let you inspect, troubleshoot, and modify IP settings without relying on a graphical interface. These commands are essential for administrators and power users because they provide fast, precise control over how a machine connects to a network—whether you’re assigning a static IP on a server, checking why a service is unreachable, verifying the default gateway, or bringing an interface up after a reboot.

In real-world scenarios, you use these commands to:

  • Display current IP addresses assigned to network interfaces (IPv4/IPv6)
  • Check link status (UP/DOWN), MTU, and interface details
  • View routing rules and the active default gateway
  • Temporarily change IP configuration for testing or emergency recovery
  • Diagnose connectivity issues (wrong subnet, missing route, interface down, etc.)
  • Confirm which interface and route the system uses to reach a destination

Because Linux runs everywhere—from cloud servers and VPS nodes to routers and embedded devices—being able to configure networking via CLI is a core skill. On modern Linux, the primary command to display and change IP configuration is: ip (from the iproute2 suite). It replaces most older utilities, works consistently across distributions, and is the standard toolset used in today’s production environments.

Change IP configuration (runtime / non-persistent)

Changes made with ip usually last until reboot (or until NetworkManager/systemd-networkd overwrites them). For persistence, use NetworkManager (nmcli) or distro config files.

Bring an interface up/down

sudo ip link set dev eth0 up
sudo ip link set dev eth0 down

Add an IP address (CIDR)

sudo ip addr add 192.168.10.50/24 dev eth0

Remove an IP address

sudo ip addr del 192.168.10.50/24 dev eth0

Replace IP address (common pattern)

sudo ip addr flush dev eth0

sudo ip addr add 192.168.10.50/24 dev eth0

Add a default gateway

sudo ip route add default via 192.168.10.1 dev eth0

Replace default gateway (cleanly)

sudo ip route replace default via 192.168.10.1 dev eth0

Add a static route

sudo ip route add 10.50.0.0/16 via 192.168.10.254 dev eth0

Persistent changes (recommended on desktops/servers)

If you use NetworkManager: nmcli

Best for Ubuntu Desktop, many RHEL-based desktops, and lots of cloud images.

Show connections

nmcli con show

Set static IPv4 on a connection

sudo nmcli con mod "Wired connection 1" ipv4.method manual \
ipv4.addresses 192.168.10.50/24 ipv4.gateway 192.168.10.1 ipv4.dns "1.1.1.1 8.8.8.8"
sudo nmcli con up "Wired connection 1"

If you use systemd-networkd: networkctl

Common on minimal servers.

networkctl status

Persistence is done by editing *.network files under:

  • /etc/systemd/network/

Legacy commands you’ll still see (but not preferred)

  • ifconfig (net-tools) — often not installed by default anymore

  • route — replaced by ip route

Practical takeaway

  • Display + change (modern standard): ip

  • Make it persistent (common): nmcli (NetworkManager) or systemd-networkd config

If you tell me your distro (Ubuntu/Debian/RHEL/Alma/etc.) and whether it’s server or desktop, I can give the exact persistent method you should use.

15%

Save 15% on All Hosting Services

Test your skills and get Discount on any hosting plan

Use code:

Skills
Get Started