目录

 

为什么不一样?

到底哪儿不一样?


为什么不一样?

接触过6系列系列和早期Debian系列的用户都知道,他们采用的默认网卡名称为eth0,远比ens33看起来舒服,毕竟计算机领域很多东西都是从0开始计数的。很多朋友好奇为什么RedHat/CentOS 7的网卡名字叫做ens33,既不是0开始也不是传统的eth开头,eth很好理解嘛,ethernet的缩写。

RedHat/CentOS 7系列采用dmidecode采集命名访问,采用了硬件相关信息,可以实现网卡名字永久唯一化。

然而并不是所有7系列操作系统默认命名方式都是ens33,比如阿里云采用的时KVM技术

[root@localhost network-scripts]# ls
ifcfg-eth0

VirtualBox则是enp0s3 

[root@localhost network-scripts]# ls
ifcfg-enp0s3

这里写一下扩展知识内容:

  • en标识ethernet
  • o:主板板载网卡,集成是的设备索引号
  • p:独立网卡,PCI网卡
  • s:热插拔网卡,USB之类的扩展槽索引号
  • nnn(数字):MAC地址+主板信息计算得出唯一序列

到底哪儿不一样?

其实eth0是内核的命名风格,现在更多地设备以虚拟化的方式运行,同时同一个局域网之间通信方式再基础网络设施的基础上,通过软件定义网络等技术,提供虚拟的路由器和交换机来实现内部网络的隔离和转发策略。比如公有云中提供的VPC网络。

现在vmware中选择CentOS8安装的系统默认叫ens160,也有网友反应他的设备上叫做ens32,其实这都跟你选取的系统版本有关。

不同系统 ,vmware做了相应的工作,提供不同版本的网卡设备,以支持系统的一些新特性。

# CentOS8,ens160
lshw -class network # 截取部分内容
  *-network                 
       description: Ethernet interface
       product: VMXNET3 Ethernet Controller
       vendor: VMware
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: ens160
       version: 01
       serial: 00:0c:29:**:**:a0
       size: 10Gbit/s
       capacity: 10Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm pciexpress msi msix bus_master cap_list rom ethernet physical logical tp 1000bt-fd 10000bt-fd

相比ens33,典型的如支持万兆网口

# CentOS7,ens33
lshw -class network
  *-network                 
       description: Ethernet interface
       product: 82545EM Gigabit Ethernet Controller (Copper)
       vendor: Intel Corporation
       physical id: 1
       bus info: pci@0000:02:01.0
       logical name: ens33
       version: 01
       serial: 00:0c:29:**:**:ed
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 66MHz
       capabilities: bus_master cap_list rom ethernet physical logical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation

同时使用的资源也不一样,提供不同的中断向量

# aliyun ECS
lshw -class network
  *-network                 
       description: Ethernet controller
       product: Virtio network device
       vendor: Red Hat, Inc.
       physical id: 3
       bus info: pci@0000:00:03.0
       version: 00
       width: 32 bits
       clock: 33MHz
       capabilities: msix bus_master cap_list rom
       configuration: driver=virtio-pci latency=0
       resources: irq:10 ioport:c060(size=32) memory:febd1000-febd1fff memory:feb80000-febbffff

针对网卡提供的功能,可以使用ethtool进行设置。

ethtool ens33 # 查看当前硬件设置
ethtool -h # 其中%d和%x对应使用十进制和十六进制数作为参数

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐