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
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
如对本文有疑问, 点击进行留言回复!!
51单片机 Proteus仿真 智能台灯 调色光 倒计时 光强感应 光敏电阻
7.10 第九章I/O复用高级函数 select poll epoll(lt et)
荐 韦东山2440_第一期学习笔记_009_arm_linux_gcc和makefile
网友评论