1.目的:配置静态地址。
- cd /etc/sysconfig/network-scripts/
- vim ifcfg-ens33 添加以下:
TYPE=Ethernet
BOOTPROTO=Static
IPADDR=192.168.100.201
NETMASK=255.255.254.0
GETEWAY=192.168.100.254
DNS=8.8.8.8
NAME=ens33
HWADDR=00:0c:29:23:84:dc
DEVICE=ens33
ONBOOT=yes
2.问题:ping不通网关
- 思路1:可能是dns服务器没有配置好:查看物理机上的dns:ipconfig/all
- 思路2:可能是防火墙没有关闭。关闭防火墙:systemctl stop firewalld.service #停止firewall / systemctl disable firewalld.service #禁止firewall开机启动
- 思路3:虚拟网卡是否是桥接模式。