Operations 10 min read

Master CentOS 7 Network Configuration: ifconfig, ifup/ifdown, and Essential Commands

This guide explains how to use ifconfig to view and modify network interfaces, manage them with ifup/ifdown, edit CentOS 7 configuration files, apply additional ip commands, and troubleshoot common VM cloning network issues.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master CentOS 7 Network Configuration: ifconfig, ifup/ifdown, and Essential Commands

1. ifconfig Network Parameters

ifconfig allows you to manually start, observe, and modify network interface parameters.

[root@linux ~]# ifconfig {interface} {up|down}  <== observe and start interface
[root@linux ~]# ifconfig interface {options}    <== set and modify interface

Parameters:
Interface – network device name (e.g., eth0, eth1, ppp0)
Options – up/down, mtu, netmask, broadcast, etc.

Example – display all interfaces:

[root@linux ~]# ifconfig
eth0 Link encap:Ethernet  HWaddr 00:0F:EA:A3:06:A2
      inet addr:192.168.10.100  Bcast:192.168.10.255  Mask:255.255.255.0
      inet6 addr: fe80::20f:eaff:fe73:682/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:3439 errors:0 dropped:0 overruns:0 frame:0
      TX packets:2735 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:646935 (631.7 KiB)  TX bytes:562313 (549.1 KiB)
      Interrupt:209 Memory:fb000000-0
Key fields: eth0 – interface name (lo is loopback) HWaddr – MAC address inet addr – IPv4 address (Bcast and Mask follow) inet6 addr – IPv6 address (often omitted) RX/TX – packets received/sent, errors, drops, collisions, txqueuelen, byte counters Interrupt/Memory – hardware IRQ and memory address

2. ifup and ifdown

These scripts read the configuration files under /etc/sysconfig/network‑scripts (e.g., ifcfg‑eth0) and bring the interface up or down accordingly.

[root@linux ~]# ifup {interface}
[root@linux ~]# ifdown {interface}

[root@linux ~]# ifup eth0
Notes: ifup/ifdown are simple wrappers that locate the matching ifcfg‑ethX file. The file must exist in the correct directory; otherwise the operation fails. If you modify an interface with ifconfig , you must bring it down with ifconfig eth0 down because ifdown compares the current state with the ifcfg‑eth0 file and will abort if they differ.

3. CentOS 7 Network Configuration Files

Important system files:

/etc/resolv.conf – DNS configuration

/etc/hosts – hostname‑to‑IP mappings

/etc/sysconfig/network – global interface and routing information (only the last gateway is effective)

/etc/sysconfig/network-scripts/ifcfg‑* – per‑interface configuration

Each network card should have a single configuration file; if multiple files exist, the later one overrides earlier settings.

4. Default Network Interface Configuration File (example)

TYPE=Ethernet               # Interface type
PROXY_METHOD=none           # Proxy disabled
BROWSER_ONLY=no             # Not browser‑only
BOOTPROTO=dhcp              # DHCP boot protocol
DEFROUTE=yes                # Default route enabled
IPV4_FAILURE_FATAL=no       # IPv4 fatal error detection disabled
IPV6INIT=yes                # IPv6 auto‑initialization
IPV6_AUTOCONF=yes           # IPv6 auto‑configuration
IPV6_DEFROUTE=yes           # IPv6 default route
IPV6_FAILURE_FATAL=no       # IPv6 fatal error detection disabled
IPV6_ADDR_GEN_MODE=stable-privacy # IPv6 address generation mode
NAME=eno16777736            # Interface name (derived from file name)
UUID=f47bde51-fa78-4f79-b68f-d5dd90cfc698   # Unique identifier
DEVICE=ens33                # Device name
ONBOOT=no                   # Not started automatically; set to yes to enable at boot or use systemctl restart network
HWADDR="00:0C:29:EB:90:72"  # Physical MAC address

5. Additional Useful Commands

ip [options] {link|addr|route...}

# Show IP information
ip addr show
# Assign IP address
ip addr add 192.168.0.1/24 dev eth0
# Delete IP address
ip addr del 192.168.0.1/24 dev eth0

# Show link (interface) information
ip link show
# Bring interface up/down
ip link set eth0 up
ip link set eth0 down
# Enable/disable promiscuous mode
ip link set eth0 promisc on
ip link set eth0 promisc off
# Set queue length and MTU
ip link set eth0 txqueuelen 1200
ip link set eth0 mtu 1400

# Show routing table
ip route show   # or ip route list or route -n
# Add a specific route
ip route add 192.168.4.0/24 via 192.168.0.254 dev eth0
# Set default gateway
ip route add default via 192.168.0.254 dev eth0
# Delete a route
ip route del 192.168.4.0/24
# Delete default route
ip route del default

6. Summary and Troubleshooting

When cloning a virtual machine, network problems often stem from the new MAC address. After cloning, check the MAC in the VM settings → Network Adapter → Advanced. Update the HWADDR field in the appropriate /etc/sysconfig/network-scripts/ifcfg‑* file, then restart the network with systemctl start network . If issues persist, verify or delete the MAC entry in /etc/udev/rules.d/70-persistent-ipoib.rules .

Link for reference: https://www.cnblogs.com/hongdada/p/9883107.html

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxNetwork Configurationcentos7ifconfigifdownifup
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.