Modify IP address
[[email protected] ~] # cd / etc / sysconfig / network-scripts /
[[email protected] network-scripts] # ll ifcfg * #Switch to the network card configuration directory
-rw-r--r--. 1 root root 280 Dec 20 01:28 ifcfg-eth0 #View the configuration of the network card. Since only one network card is configured, there is only eth0
-rw-r--r--. 1 root root 254 Apr 12 2016 ifcfg-lo #Return test, system use
[[email protected] network-scripts] # gedit ifcfg-eth0 #Edit the configuration file of eth0
DEVICE = eth0 #device name
TYPE = Ethernet #Network type Ethernet
UUID = 849c2c0f-f685-4b85-8917-75e578d6ebc5 #HWADDR HardWare Address Hardware address MAC address
ONBOOT = yes # Whether to start with the system
NM_CONTROLLED = yes # Whether it is managed by the network program
BOOTPROTO = none #dhcp: Obtain IP address automatically none: Fixed IP address static: Fixed IP address
IPADDR = 192.168.56.88 #IP address
PREFIX = 24 #Subnet mask, a total of 32 IP addresses, 24 means the first 24 bits are 1, which is equivalent to 255.255.255.0
GATEWAY = 192.168.56.1 #Gateway
DEFROUTE = yes
IPV4_FAILURE_FATAL = yes
IPV6INIT = no
NAME = "System eth0"
HWADDR = 00: 0C: 29: 49: 9F: 0B
LAST_CONNECT = 1513702340
Restart network service after saving changes
[[email protected] network-scripts] # /etc/init.d/network restart
Shutting down interface eth0: Device state: 3 (disconnected)
[OK]
Shutting down loopback interface: [OK]
Bringing up loopback interface: [OK]
Bringing up interface eth0: Active connection state: activated
Active connection path: / org / freedesktop / NetworkManager / ActiveConnection / 4
[OK]
or
[[email protected] network-scripts] # service network restart
More settings can refer to
https://www.cnblogs.com/picaso/archive/2012/07/02/2572888.html