For network management in Linux systems, we often use powerful ifconfig commands.
However, the ifconfig command configuration of the network card information, after the network card reboot after the machine restart, the configuration does not exist. In order to keep the above configuration information forever in the computer, it is necessary to modify the network card configuration file. There is a very important member in the configuration file:/etc/sysconfig/network-scripts/ifcfg-ethx (Note: Echx refers to the device name, such as eth0, etc.).
The network information in the Ifcfg-ethx file configuration is still in effect after reboot, it is very useful in network management, now I ifcfg-ethx file IPV4 Network configuration method for simple explanation.
According to the file Ifcfg-eth0 open the command and the following information:
[Root@localhost ~]# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0#网卡设备名称
Onboot=yes#启动时是否激活 yes | no
Bootproto=static#协议类型 DHCP BOOTP none
ipaddr=192.168.1.90#网络IP地址
netmask=255.255.255.0#网络子网地址
gateway=192.168.1.1#网关地址
broadcast=192.168.1.255#广播地址
hwaddr=00:0c:29:fe:1a:09#网卡MAC地址
Type=ethernet#网卡类型为以太网
Note: After modifying the file Ifcfg-ethx, you will need to re-import the file to take effect, as follows:
[Root@localhost ~]#/etc/init.d/network Reload #命令有start | Restart | Stop | Reload