时间:2021-05-19
Centos7默认安装是没有开启配置网卡信息的,无法访问外网。
下边配置打开网络自动获取Ip地址
1.查看网卡信息
执行Ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::20c:29ff:fee8:8637 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:e8:86:37 txqueuelen 1000 (Ethernet) RX packets 1121 bytes 98968 (96.6 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 179 bytes 25233 (24.6 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 0 (Local Loopback) RX packets 900 bytes 78372 (76.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 900 bytes 78372 (76.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 01.eno16777736代表网卡的名称,ether 00:0c:29:e8:86:37代表网卡的Mac地址
2.配置网卡开始网络连接
cd /etc/system/network-scripts/vi ifcfg-eno16777736 HWADDR=00:0C:29:E8:86:37TYPE=EthernetBOOTPROTO=dhcpDEFROUTE=yesPEERDNS=yesPEERROUTES=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_PEERDNS=yesIPV6_PEERROUTES=yesIPV6_FAILURE_FATAL=noNAME=eno16777736UUID=79d6c916-aab8-45e4-a163-37ae73393d26ONBOOT=no将ONBOOT= no改成ONBOOT=yes
3.重启网络
service network restart4.再执行ifconfig
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.159.128 netmask 255.255.255.0 broadcast 192.168.159.255 inet6 fe80::20c:29ff:fee8:8637 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:e8:86:37 txqueuelen 1000 (Ethernet) RX packets 1699 bytes 140091 (136.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 333 bytes 42669 (41.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: 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 0 (Local Loopback) RX packets 900 bytes 78372 (76.5 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 900 bytes 78372 (76.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0inet 192.168.159.128 代表IP地址
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
在CentOS配置网卡开机自动获取IP地址:vi/etc/sysconfig/network-scripts/ifcfg-eth0将ONBOOT="no"改为O
一.修改/etc/network/interfaces,注释自动获取IP,并添加自动从网卡获取地址。 #autolo #ifaceloinetlockloo
由于Centos7的网络配置与之前版本有较大差距,所以单独讨论。Centos7对网卡设备具有自动探测功能:(1)网卡命名机制systemd对网络设备的命名方式:
设置动画示范教程: Windows7系统有线网卡自动获取IP地址的详细设置步骤如下: 第一步:鼠标点击电脑桌面右下角小电脑图标,在弹出的对话框中,点击打
Centos7网路配置详细介绍1、查看当前网卡信息[root@localhost~]#nmcliconnectionshowNAMEUUIDTYPEDEVICE