ifconfigLegacy interface configuration (read it, prefer ip)
ifconfig shows network interfaces with their IP, netmask, MAC and packet counters, and can bring interfaces up or down. It's part of the deprecated net-tools package: still common on older servers, in macOS and in old docs, but on modern Linux use ip.
ifconfig [-a] [INTERFACE] | ifconfig INTERFACE [ADDRESS] [netmask MASK] [mtu N] [up|down]An old runbook says 'check ifconfig'. Install it if needed and read the fields.
sudoViewing is free; any change needs root.
ifconfig talks to the kernel with ioctl calls on a socket (SIOCGIFFLAGS, SIOCGIFADDR, SIOCSIFMTU and so on) and reads /proc/net/dev for counters. That old interface only knows one IPv4 address per interface name, which is why net-tools introduced alias labels like ens5:1 for extra addresses. Addresses added with ip addr add (without a label) are invisible to ifconfig, and it knows nothing about policy routing, network namespaces or many modern link types. net-tools has been unmaintained for years and is not installed by default on Ubuntu, Debian, RHEL or Amazon Linux; ip from iproute2 replaces it. Like ip, changes made with ifconfig apply only to the running kernel and are lost at reboot.
ifconfigShow interfaces that are up-aShow all interfaces, including down onesIFACEShow one interfaceIFACE ADDR netmask MSet the primary IPv4 address and maskIFACE up / downEnable or disable the interfaceIFACE mtu NChange the MTUIFACE:N ADDRAdd an alias address (legacy multi-IP)-sShort table of counters, like netstat -iUsing ifconfig output to check which IPs a host hasIt only shows one IPv4 address per interface name; addresses added with ip (or by cloud agents) don't appear.
ip -br a # or ip -4 addr showAssuming ifconfig exists in scripts and containersnet-tools isn't installed on modern distributions or slim images, so the script fails with 'command not found'.
Use ip (iproute2), which is always present on systemd systems.Configuring a server permanently with ifconfig commands in rc.localChanges are runtime-only, and mixing them with netplan or NetworkManager leads to conflicts after DHCP renewals or reboots.
Describe the config in netplan or NetworkManager and apply it.Try these on a Linux machine of your own. Each task has a hint and a solution.
Show all interfaces with ifconfig, including those that are down.
Show the loopback interface with ifconfig, then with ip, and find the MTU in both.
Write the ip command equivalent to: sudo ifconfig eth0 10.0.1.40 netmask 255.255.255.0 up
ifconfigLegacy interface configuration (read it, prefer ip)
ifconfig shows network interfaces with their IP, netmask, MAC and packet counters, and can bring interfaces up or down. It's part of the deprecated net-tools package: still common on older servers, in macOS and in old docs, but on modern Linux use ip.
ifconfig [-a] [INTERFACE] | ifconfig INTERFACE [ADDRESS] [netmask MASK] [mtu N] [up|down]An old runbook says 'check ifconfig'. Install it if needed and read the fields.
sudoViewing is free; any change needs root.
ifconfig talks to the kernel with ioctl calls on a socket (SIOCGIFFLAGS, SIOCGIFADDR, SIOCSIFMTU and so on) and reads /proc/net/dev for counters. That old interface only knows one IPv4 address per interface name, which is why net-tools introduced alias labels like ens5:1 for extra addresses. Addresses added with ip addr add (without a label) are invisible to ifconfig, and it knows nothing about policy routing, network namespaces or many modern link types. net-tools has been unmaintained for years and is not installed by default on Ubuntu, Debian, RHEL or Amazon Linux; ip from iproute2 replaces it. Like ip, changes made with ifconfig apply only to the running kernel and are lost at reboot.
ifconfigShow interfaces that are up-aShow all interfaces, including down onesIFACEShow one interfaceIFACE ADDR netmask MSet the primary IPv4 address and maskIFACE up / downEnable or disable the interfaceIFACE mtu NChange the MTUIFACE:N ADDRAdd an alias address (legacy multi-IP)-sShort table of counters, like netstat -iUsing ifconfig output to check which IPs a host hasIt only shows one IPv4 address per interface name; addresses added with ip (or by cloud agents) don't appear.
ip -br a # or ip -4 addr showAssuming ifconfig exists in scripts and containersnet-tools isn't installed on modern distributions or slim images, so the script fails with 'command not found'.
Use ip (iproute2), which is always present on systemd systems.Configuring a server permanently with ifconfig commands in rc.localChanges are runtime-only, and mixing them with netplan or NetworkManager leads to conflicts after DHCP renewals or reboots.
Describe the config in netplan or NetworkManager and apply it.Try these on a Linux machine of your own. Each task has a hint and a solution.
Show all interfaces with ifconfig, including those that are down.
Show the loopback interface with ifconfig, then with ip, and find the MTU in both.
Write the ip command equivalent to: sudo ifconfig eth0 10.0.1.40 netmask 255.255.255.0 up