Home > Article > Operation and Maintenance > Can linux modify static ip address?
Linux can modify the static ip address. The method is: 1. Use the ifconfig command to temporarily modify the syntax "ifconfig eth0..netmask.."; 2. Use "vi ifcfg-eth0 path" to modify the static IP information of the "ifcfg-eth0" file, and restart the network service. .
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
1. Effective immediately:
The example is as follows:
# ifconfig eth0 192.168.1.155 netmask 255.255.255.0
2 , restart to take effect
Modify /etc/sysconfig/network-scripts/ifcfg-eth0
The example is as follows:
Enter in the terminal: vi / etc/sysconfig/network-scripts/ifcfg-eth0
Start editing and fill in the ip address, subnet mask, gateway, DNS, etc. Among them, the "information in the red box" is a must.
After editing, save and exit.
Restart the network service. service network restart or /etc/init.d/network restart
ping the gateway and ping the external network for testing. If both can ping successfully, it means the network is normal.
Recommended learning: Linux video tutorial
The above is the detailed content of Can linux modify static ip address?. For more information, please follow other related articles on the PHP Chinese website!