Step1: ifconfig
Step2: cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
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="fa8f136d-80ac-45aa-ae99-315c114667d7"
DEVICE="ens33"
ONBOOT="yes"
Step3: 查看dns: cat /etc/resolv.conf
search localdomain
nameserver 172.16.243.2
Step4: 查看网关: netstat -r
Step5: 子网掩码
Step6: vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
IPADDR="172.16.243.157" # 设置的静态IP地址
NETMASK="255.255.255.0" # 子网掩码
GATEWAY="172.16.243.2" # 网关地址
DNS1="172.16.243.2" # DNS服务器
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="fa8f136d-80ac-45aa-ae99-315c114667d7"
DEVICE="ens33"
ONBOOT="yes"
Step6: 重启网络 systemctl restart network