Linux启动后可以自动获取IP,但是每次自动获取的IP地址可能不一样。这样就不适用于做服务器,我们需要服务器的IP是固定的。直接修改配置文件来指定IP,并可以连接外网。
1.vim /etc/sysconfig/network-sctipts/ifcfg-ens33
IPADDR是指定IP
GATEWAY是网关
DNS1和网关保持一致即可
2.重启service network restart
报错:
Restarting network (via systemctl): Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
[失败]
4.查看网上的解决方案
systemctl stop NetworkManager
systemctl disable NetworkManager
service network restart
失败。。。。未解决