Generally, dncp is not configured in the production environment. It is usually configured once, once and for all. Then, write down how to configure the static address:
Nic configuration files are placed under/etc/sysconfig/network-scripts, you can see ifcfg-eth0, ifcfg-eth1 .... These are the Nic configuration files we are looking. Before configuring the network card, you must first understand the configuration parameters of the network card.
* DEVICE interface name (DEVICE, NIC)
* USERCTL [yes | no] (whether non-root users can control the device)
* [None | static | bootp | dhcp] (Protocol not used during boot | static IP allocation | BOOTP protocol | DHCP protocol)
* Hwaddr mac address
* Whether the network interface is valid when the ONBOOT system is started (yes/no)
* TYPE network TYPE (usually Ethemet)
* NETMASK network mask
* PREFIX verification code length
* Ipaddr ip address
* GATEWAY default gateway ip address
* BROADCAST address
* NETWORK address
Looking at a bunch of things, you don't need to write so much. Just write a few. For example:
Okay, enough. Restart the NIC:
Service network restart
How about whether the network is smooth.
By the way, you also need to configure dns. You can add DNS1 = 8.8.8.8 and DNS2 = 114.114.114.114 to the above Nic file.
You can also add rows of nameserver 8.8.8.8 in/etc/resolv. conf (multiple rows can be added ).
In addition, if dns is configured like this, you may find a line of service network restart
The configured dns is missing again. Tips: close the networkmanager service.