The Linux IP address is temporarily configured

Ifconfig eth0 10.10.10.10 netmask 255.255.255.0 Note: eth0 is the name of the network port. You can run ifconfig to view the value

After the configuration, the same network segment can be pinged through. You may need to configure a route for different network segments to ping through the configured route :route add default gw 10.10.1.0

The Linux IP address takes effect permanently

Modify the configuration file of the eth0 network port, for example, change the IP address of eth0 vim /etc/sysconfig/network-scripts/ifcfg-eth0

BOOTPROTO="static" ONBOOT="yes" TYPE="Ethernet" PERSISTENT_DHCLIENT="yes" IPADDR=10.10.10.10 NETMASK = 255.255.255.0 GATEWAY = 10.10.1.0Copy the code

You can restart the systemctl restart network service