Skip to content

Instantly share code, notes, and snippets.

@netnr netnr/ifcfg
Created Aug 1, 2019

Embed
What would you like to do?
Centos7设置静态IP
# 进入目录
cd /etc/sysconfig/network-scripts
ls
# ifcfg-ens开头的文件,如 ifcfg-ens33
# 配置文件如下:
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static # 改成 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=a9490d4b-1396-4527-9bbd-35ba46a7530d
DEVICE=ens33
ONBOOT=yes # 开机启用
ZONE=public
# 追加的配置
NM_CONTROLLED=no
IPADDR=192.168.1.177 # 静态IP地址
NETMASK=255.255.255.0 # 子网掩码
GATEWAY=192.168.1.1 # 网关地址
DNS1=192.168.1.1 # DNS服务器
HWADDR=08:00:27:31:52:78 # MAC地址
# 重启服务
service network restart
# help
https://blog.csdn.net/sjhuangx/article/details/79618865
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.