Mastering ifconfig, ifup, and ifdown: Quick Guide to Linux Network Interface Management
This guide explains how to use the Linux commands ifconfig, ifup, and ifdown to view, configure, and control network interfaces, covering syntax, common options, practical examples, virtual interfaces, and important cautions for reliable system administration.
The three commands ifconfig , ifup , and ifdown are used to start, stop, and modify network interfaces on Linux systems. ifconfig works directly on an interface, allowing you to assign IP addresses, set MTU, netmask, broadcast, and other parameters, while ifup and ifdown operate on configuration files located in /etc/sysconfig/network-scripts/ifcfg-*.
Using ifconfig
Basic syntax: # ifconfig {interface} {up|down} – observe or toggle the interface state. # ifconfig {interface} {options} – set or modify parameters.
Common options include: up, down – enable or disable the interface without changing other settings. mtu – set the Maximum Transmission Unit, e.g., mtu 1500. netmask – define the subnet mask. broadcast – specify the broadcast address.
Example 1: List all interfaces
# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:71:85:BD inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe71:85bd/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2555 errors:0 dropped:0 overruns:0 frame:0 TX packets:70 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:239892 (234.2 KiB) TX bytes:11153 (10.8 KiB)
The output shows hardware address (HWaddr), IPv4 address (inet addr), broadcast, netmask, MTU, packet statistics, and error counters, which help assess network health.
Example 2: Temporarily assign an IP address
# ifconfig eth0 192.168.100.100 # ifconfig eth0 192.168.100.100 \ netmask 255.255.255.128 mtu 8000 # ifconfig eth0 mtu 9000 # ifconfig eth0:0 192.168.50.50 # ifconfig # ifconfig eth0:0 down # /etc/init.d/network restart
Running ifconfig eth0 192.168.100.100 assigns the address and automatically calculates netmask, network, and broadcast values based on the class. Adding extra parameters (netmask, mtu) customises the interface. The virtual interface eth0:0 creates an additional IP on the same physical NIC. To remove the virtual interface, use ifconfig eth0:0 down. Restarting the network service with /etc/init.d/network restart discards all temporary changes and reloads settings from the ifcfg-* files.
Using ifup and ifdown
These scripts read the configuration files under /etc/sysconfig/network-scripts/. Example commands:
# ifup {interface} # ifdown {interface} # ifup eth0
ifupsearches for ifcfg-eth0, applies the stored settings, and brings the interface up. ifdown does the opposite. Ensure the corresponding ifcfg-* file exists; otherwise the command will fail.
Important caveat: after modifying an interface with ifconfig, the changes are not reflected in the ifcfg-* files, so ifdown will refuse to act because the runtime parameters no longer match the stored configuration. In that case, bring the interface down with ifconfig eth0 down instead.
Overall, ifconfig provides quick, ad‑hoc adjustments, while ifup / ifdown enforce persistent configurations defined in the system’s network‑script files.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
