您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Linux7如何设置静态IP的实例

2024/6/6 15:36:38发布34次查看
这篇文章主要介绍了centos linux7设置静态ip的实例的相关资料,需要的朋友可以参考下
centos linux7设置静态ip的实例
## 先进入配置文件的放置位置:
cd /etc/sysconfig/network-scripts/
## 查看当前网卡使用的是哪个文件
ip add
## 过滤出配置文件列表
ll | grep ifcfg
## 编辑配置文件
vi ifcfg-ens160
## 配置文件内容 主要:bootproto ipaddr netmask nm_controlled onboot 这几个字段,其他的不变
type=ethernet bootproto=static ipaddr=192.168.1.251 netmask=255.255.255.0 dns1=8.8.8.8 dns2=8.8.4.4 nm_controlled=no defroute=yes peerdns=yes peerroutes=yes ipv4_failure_fatal=no ipv6init=yes ipv6_autoconf=yes ipv6_defroute=yes ipv6_peerdns=yes ipv6_peerroutes=yes ipv6_failure_fatal=no ipv6_addr_gen_mode=stable-privacy name=ens160 uuid=23a77b70-a6e3-4399-a5bd-4ca312a0f123 device=ens160 onboot=yes
## 修改网关配置文件:
vi /etc/sysconfig/network networking=yes networking_ipv6=no hostname=localhost.localdomain gateway=192.168.1.1
## 重启网络服务
systemctl restart network.service
以上就是linux7如何设置静态ip的实例的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product