linux设置静态ip

#检查现有的网络连接配置
nmcli connection show
ip a
ifconfig
route -n
# 修改配置文件路径 root权限
/etc/sysconfig/network-scripts/ifcfg-*(device)

# 修改完
service network restart
reboot
ping baidu.com
# vim ifcfg-*(device)

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=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=xxx
UUID=xxxxxx-xxxx-xxxx-xxxx-xxxxxx
DEVICE=xxx
ONBOOT=yes
IPADDR=192.168.1.xxx
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
DNS1=8.8.8.8
DNS2=192.168.1.1

你可能感兴趣的:(Linux)