RHEL7的网卡命名方式从eth0,1,2的方式变成了enoXXXXX的格式。
en代表的是enthernet (以太网),o 代表的是onboard (内置),那一串数字是主板的某种索引编号自动生成,以便保证其唯一性。和原先的命名方式对比,这种新的方式比较长,难以记忆,不过优点在于编号唯一,做系统迁移的时候不容易出错。
1.修改/etc/sysconfig/network-scripts/eno16777728
查看网卡名称(本机是eno16777728):
[root@localhost]$ ifconfig
eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.8 netmask 255.255.255.0 broadcast 192.168.3.255
inet6 fe80::20c:29ff:fee3:d015 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e3:d0:15 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 30 bytes 4164 (4.0 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 520 bytes 44276 (43.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 520 bytes 44276 (43.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
编辑[root@localhost]$ cat /etc/sysconfig/network-scripts/ifcfg-eno16777728 文件:
TYPE="Ethernet"
BOOTPROTO="none" # static静态IP dhcp动态IP none不指定
DEFROUTE="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="yes" #是否支持IPV6
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777728" #网卡名称
UUID="15c19b00-1549-4b6e-92d6-6106b0ed91a5"
DEVICE="eno16777728"
ONBOOT="yes" #开启自动启用网络连接
HWADDR="00:0C:29:E3:D0:15" #
IPADDR="192.168.3.8" #ip地址
PREFIX="24" #
GATEWAY="192.168.3.1" #网关
DNS1=192.168.1.1 #设置DNS
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"
重启网卡并测试网络:
[root@Desktop]# systemctl restart network
2.图形工具nmtui
[root@Desktop]# nmtui
[root@Desktop]# systemctl restart network
3.终端执行命令:
[root@Desktop]# nm-connection-editor
[root@Desktop]# systemctl restart network
网友评论