1.修改/etc/sysconfig/network-scripts/eno16777736
查看你的网卡名称(本机是eno16777736):
[root@linuxprobe Desktop]# ifconfig eno16777736: flags=4163 mtu 1500 inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::20c:29ff:feb8:2b07 prefixlen 64 scopeid 0x20 inet6 fde0:b912:e3a9:0:20c:29ff:feb8:2b07 prefixlen 64 scopeid 0x0 ether 00:0c:29:b8:2b:07 txqueuelen 1000 (Ethernet) RX packets 37 bytes 5428 (5.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 62 bytes 8269 (8.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 0 (Local Loopback) RX packets 134 bytes 10928 (10.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 134 bytes 10928 (10.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@linuxprobe Desktop]#
编辑ifcfg-eno16777736 文件:
红色为需要修改或者添加的内容,保存并退出。
部分释义:
TYPE=Ethernet #网络接口类型 BOOTPROTO=static #动态为dhcpDEFROUTE=yes IPV4_FAILURE_FATAL=yes IPV6INIT=yes #是否支持IPV6 IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME=eno16777736 #网卡名称 UUID=72cf53fd-534c-4765-912b-3df575a10a7d ONBOOT=yes #开启自动启用网络连接 IPADDRO=192.168.1.20 #设置IP地址 GATEWAY0=192.168.1.1 #设置网关 PREFIX0=24 #设置子网掩码DNS1=192.168.1.1 #设置DNS HWADDR=00:0C:29:B8:2B:07 PEERDNS=yes PEERROUTES=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
重启网卡并测试网络:
[root@linuxprobe Desktop]# systemctl restart network
2.图形工具nmtui
在终端执行命令:
[root@linuxprobe Desktop]# nmtui
你依然需要重启网卡才能生效,并测试网络。
3.图形工具nm-connection-editor
终端执行命令:
[root@linuxprobe Desktop]# nm-connection-editor
本文出自 “IT技术” 博客,请务必保留此出处http://wjlnet1988.blog.51cto.com/7651172/1791286
原文地址:http://wjlnet1988.blog.51cto.com/7651172/1791286