Article Title: Modify the NIC configuration file of a Linux system. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
(1)/etc/sysconfig/network-scripts/ifcfg-interface-name
The configuration file ifcfg-interface-name contains most of the details required for the initialization interface. The interface-name varies according to the type and order of the network card. Generally, its names are eth0, eth1, and ppp0. eth indicates the Ethernet (eth0) network card, 0 indicates the first Nic, 1 indicates the second Nic, and ppp0 indicates the first point-to-poirt protocol network interface. The items defined in the ifcfg file depend on the interface type.
The following values are more common:
"DEVICE = name, where name is the name of the physical DEVICE.
IPADDR = addr, where addr is an IP address.
NETMASK = mask, where mask is the network mask value.
"NETWORK = addr, where addr is the NETWORK address.
"BROADCAST = addr, where addr is the BROADCAST address.
"GATEWAY = addr, where addr is the GATEWAY address.
ONBOOT = answer, where answer is yes (the device is activated during boot) or no (the device is not activated during boot)
USERCTL = answer, where answer is yes (non-root users can control this device) or no
"BOOTPROTO = proto, where, proto takes one of the following values: none, no protocol used for guidance; static allocation address; bootp, use BOOTP protocol, or dhcp, use DHCP protocol.
(2) According to the meaning of the above parameters, the setting file for the linpcl.lintec.edu.cn machine is as follows:
[Root @ linpcl root] # cat/etc/sysconfig/networking/devices/ifcfg-rth0
DEVICE = eth0
ONBOOT = yes
BOOTPROTO = static
IPADDR = 192.168.0.2
NETMASK = 255.255.255.0
GATEWAY = 192.168.0.1
(3) Save the file after the parameter configuration is complete, and restart the network device using the/etc/init. d/network restart command. The latest value will take effect.
[Root @ linpcl root] #/etc/rc. d/init. d/network restart
Closing interface eth0: [OK]
Disable the loop interface: [OK]
Set network parameters: [OK]
Pop-up loop interface: [OK]
Pop-up page eth0: [OK]
(4) run the ifconfig command to view the network device status.
[Root @ linpcl root] # ifconfig
Eth0 Link encap: Ethernet HWassr 52: 54: AB: 28: EE: 37
Linet addr: 192.168.0.2 bcast: 192.168.0.255 Mask: 255.255.255.0