6

centos7如何设定固定ip

 1 year ago
source link: https://xushanxiang.com/centos7-static-ip.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

centos7如何设定固定ip

作者: xusx 分类: Linux 发布时间: 2022-11-26 14:13 浏览:12
virtualbox-centos7.png

1、打开文件

vi /etc/sysconf ig/network-scripts/ifcfg-enp0s3

2、编辑文件

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=enp0s3
JUID=ad64525f-1779-476a-9fb1-bdd6494ed087
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.1.108
GATEWAY=192.168.1.1
DNs1=114.114.114.114
DNS2=223.5.5.5
NETTASK=255.255.255.0

变更项:

BOOTPROTO=static
ONBOOT=yes

新增项:

IPADDR=192.168.1.108
GATEWAY=192.168.1.1
DNs1=114.114.114.114
DNS2=223.5.5.5
NETTASK=255.255.255.0

3、重启生效

systemctl restart network

4、检查测试

ip a
cat /etc/resolv.conf
ping www.baidu.com

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK