修改网卡配置 vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static" #dhcp改为static
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="b4041ca5-b704-493d-a3d0-d39d3f01c1ab"
DEVICE="ens33"
ONBOOT="yes"#添加以下部分
IPADDR=192.168.228.132 #静态ip
NETMASK=255.255.255.0 #子网掩码
GATEWAY=192.168.228.2 #网关
DNS1=192.168.228.2 #dns
重启网络服务
systemctl restart network
systemctl stop NetworkManager
systemctl disable NetworkManager
其他:
子网掩码:ifconfig
网关查询:netstat -rn
dns查询:cat /etc/resolv.conf