The Linux configuration IP URL can be configured using Neat,netconfig,ifconfig and so on, where the first two have a user interface, the third command is just a temporary IP setting, and the configuration will be lost after the machine restarts.
Sometimes the graphical user interface program is difficult to obtain, here is a more straightforward way, is to modify the network configuration file.
The general network configuration file name is: ifcfg-eth[x], this x can be 0,1,2, etc., because you can set up multiple networks, if only one, the configuration file name is Ifcfg-eth0, file location:
/etc/sysconfig/network-scripts/ifcfg-eth0
1. Modify the network configuration file
#vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0 #设定网卡的名称, corresponding to the file name #
Onboot=yes #是否在开机的的时候启动网卡 #
bootproto=static #启动的时候的 IP protocol, this is fixed, if it is a dynamic host, it should be changed to DHCP line #
ipaddr=192.168.1.2 #IP Address #
netmask=255.255.255.0 #子网掩码 #
network=192.168.1.0 #该网段的第一个 ip#
broadcast=192.168.1.255 #最后一个同网段的广播地址 #
gateway=192.168.1.2 #网关地址 #
#GATEWAYDEV =eth0
When the Linux host has just been installed, the default value for the Onboot property is no and needs to be modified to yes,boorproto default to DHCP, which needs to be modified to static.
Then set the IP address, netmask, gateway and so on.
2. Restart Network Service
When set up, use:
Service Network restart
Make the network settings effective.
Red Hat Linux test passed.
Note: If Onboot is set to No, the service network restart startup error is caused.