Ipaddrip Address
netmask Subnet Mask
Network gateway Address
Typically, if we want to change the host address to a static address or change the hostname, several files that need to be modified include:
/etc/sysconfig/network CentOS setting host name and network configuration
/etc/sysconfig/network-scripts/ifcfg-eth0 settings for a specific NIC
/etc/resolv.conf Setting up DNS
/etc/hosts setting the specified domain name resolution address
In general we only need to modify the CentOS configuration file of the network card, for example, my CentOS configuration file is as follows:
Device=eth0
Bootproto=static
Type=ethernet
Name= "System etho0"
broadcast=192.168.56.255
hwaddr=08:00:27:24:f8:9b
Ipaddr=192.168.56.101
Ipv6init=yes
Ipv6_autoconf=yes
netmask=255.255.255.0
network=192.168.56.1
Onboot=yes
After the CentOS setup IP is complete, reboot the network card to do it: Service network restart
We also have a way to implement the CentOS set static IP, that is, by ifconfig this command. Usually, we use it to view some information about the current network card, and he can also be used to set up some network card information.
The modified command is as follows: Ifconfig eth0 192.168.56.102
Cos Change IP