查看你的網卡名稱(本機是eno16777736):
[root@linuxprobe Desktop]# ifconfigeno16777736: 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 0lo: 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=yesIPV4_FAILURE_FATAL=yesIPV6INIT=yes #是否支持IPV6 IPV6_AUTOCONF=yes IPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noNAME=eno16777736 #網卡名稱UUID=72cf53fd-534c-4765-912b-3df575a10a7dONBOOT=yes #開啟自動啟用網絡連接IPADDRO=192.168.1.20 #設置IP地址GATEWAY0=192.168.1.1 #設置網關PREFIX0=24 #設置子網掩碼DNS1=192.168.1.1 #設置DNSHWADDR=00:0C:29:B8:2B:07PEERDNS=yes PEERROUTES=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yes
重啟網卡並測試網絡:
[root@linuxprobe Desktop]# systemctl restart network2.圖形工具nmtui
在終端執行命令:
[root@linuxprobe Desktop]# nmtui
你依然需要重啟網卡才能生效,並測試網絡。
終端執行命令:
[root@linuxprobe Desktop]# nm-connection-editor
三種方法只要會一種就可以上網,配置你所需要的服務,是不是非常簡單啊!
本文轉載地址:http://www.linuxprobe.com
http://xxxxxx/Linuxjc/1134154.html TechArticle