How to set ip address in centos7

巴扎黑
巴扎黑Original
2017-06-23 14:19:082832browse

vi /etc/sysconfig/network-scripts/ifcfg-enpos3
In the file, change
BOOTPROTO to static,
At the same time add
IPADDR=192.168.1.150
NETMASK= 255.255.255.0
GATEWAY=192.168.1.1
If ONBOOT=no, change it to yes.
When modifying, make sure the IP address and gateway are in the same network segment.
Restart the service, service network restart

Set the DNS server,
vi /etc/resolv.conf
Add nameserver 8.8.8.8

ip addr to view the IP address Whether the setting is successful

Then execute the command and ping www.baidu.com

If the ping succeeds, the setting is successful.

END

The above is the detailed content of How to set ip address in centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn