Centos7 网络配置
默認安裝centos7的時候,選擇最小安裝,這時候默認沒有啟用網(wǎng)絡(luò)的,系統(tǒng)開機后無法使用網(wǎng)絡(luò)
1.查看物理網(wǎng)卡的地址:
ifconfig?或者 ip addr都可以的
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.80.136 netmask 255.255.255.0 broadcast 192.168.80.255
inet6 fe80::c89b:1871:b2c6:3a60 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:0e:a8:cb txqueuelen 1000 (Ethernet)
RX packets 1778 bytes 116068 (113.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 175 bytes 23426 (22.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 268 bytes 23300 (22.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 268 bytes 23300 (22.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.可以看到ens33為物理網(wǎng)卡,這時候,可以用以下方式去開啟網(wǎng)絡(luò)連接
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ll
總用量 232
-rw-r--r--. 1 root root 310 4月 11 2019 ifcfg-ens33
[root@localhost ~]# vi? /etc/sysconfig/network-scripts/ifcfg-ens33
改成:onboot=yes
接ESC?退出? ?:wq? 保存
?3.重啟網(wǎng)絡(luò)服務:
[root@localhost network-scripts]# systemctl restart network.service
4.重啟后:ping www.baidu.com
解析正常了,網(wǎng)絡(luò)啟用正常
轉(zhuǎn)載于:https://www.cnblogs.com/freewsf/p/10687796.html
與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的Centos7 网络配置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: OC对象的本质及分类
- 下一篇: 正则表达式三种模式:贪婪模式、懒惰模式、