Centos7 网络配置
默認(rèn)安裝centos7的時(shí)候,選擇最小安裝,這時(shí)候默認(rèn)沒(méi)有啟用網(wǎng)絡(luò)的,系統(tǒng)開(kāi)機(jī)后無(wú)法使用網(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)卡,這時(shí)候,可以用以下方式去開(kāi)啟網(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ò)服務(wù):
[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ù)專家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的Centos7 网络配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: OC对象的本质及分类
- 下一篇: Centos6.5安装Kibana