eth0改成eth1
⑴ Linux的网卡由eth0变成了eth1,如何修复麻烦告诉我
经过网络,了解了一些信息,特此记录在此,以备忘。
很多Linux distribution使用udev动态管理设备文件,并根据设备的信息对其进行持久化命名。udev会在系统引导的过程中识别网卡,将mac地址和网卡名称对应起来记录在udev的规则脚本中。而对于新的虚拟机
,VMware会自动为虚拟机的网卡生成MAC地址,当你克隆或者重装虚拟机软件时,由于你使用的是以前系统虚拟硬盘的信息,而该系统中已经有eth0的信息,对于这个新的网卡,udev会自动将其命名为eth1(累加的原则),所以在你的系统启动后,你使用ifconfig看到的网卡名为eth1。
在fedora中,udev记录网络规则的脚本为:/etc/udev/rules.d/70-persistent-net.rules
[user@localhost ~]$ vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.## You can modify it, as long as you keep each rule on a single line.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM==net, ACTION==add, DRIVERS==?*, ATTR{address}==00:0c:29:5a:6c:73, ATTR{type}==1, KERNEL==eth*, NAME=eth0
SUBSYSTEM==net, ACTION==add, DRIVERS==?*, ATTR{address}==00:0c:29:a9:22:9d, ATTR{type}==1, KERNEL==eth*, NAME=eth1
打开该文件,这时你会发现,里面有eth0,eth1两个网卡的信息,但实际上你ifconfig时只能发现eth1一个网卡的信息,这时因为eth0根本就不存在。
将其中eth0的信息删掉,并将eth1信息中的设备名改为eth0,重启系统,你看到的网卡就是eth0了,或者删掉其中所有的信息重启系统udev会帮你发现新的设备的。
⑵ linux中可以修改eth0和eth1的顺序吗
eth0和eth1这是网卡设备,
只是个名称不必纠结,不是那谁说的一个普通网卡一个无线网卡,他什么都不懂。
通常服务器会有多个网卡的,所以就有eth0
eth1
eth2
这样的名称,
而且在一些系统中对于无线网卡会命名为wlan0
wlan1。。。。
具体的你可以看看目录etc/sysconfig/network-scripts下面,
ifcfg-eth0就代表eth0的配置,你把文件改成了eth1,文件内容做下修改,
那就是eth1了。。
当然,这种配置方法并不适用于所有的linux系统,但对rhel是适用的。
⑶ Linux的网卡由eth0变成了eth1,怎么修复
在fedora中,udev记录网络规则的脚本为:/etc/udev/rules.d/70-persistent-net.rules
[user@localhost ~]$ vi /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:5a:6c:73", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a9:22:9d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
打开该文件,这时你会发现,里面有eth0,eth1两个网卡的信息,但实际上你ifconfig时只能发现eth1一个网卡的信息,这时因为eth0根本就不存在。
将其中eth0的信息删掉,并将eth1信息中的设备名改为eth0,重启系统,你看到的网卡就是eth0了,或者删掉其中所有的信息重启系统udev会帮你发现新的设备的。
另外还有一个启动脚本文件/etc/sysconfig/network-scripts/ifcfg-eth0,该文件中的mac地址为原来eth0网卡的物理地址,而虚拟机为eth1分配新的物理地址,故启动脚本中的信息与实际信息时不匹配的,将MAC的地址信息修改为70-persistent-net.rules中的eth1的MAC地址,再次重启网络,就完全恢复到以前eth0网卡的状态了。
⑷ centos 怎么改eth0改成eth1
vi /etc/udev/rules.d/70-persistent-net.rules
把eth0 改成 eth1
把配置文件 /etc/sysconfig/network-scripts/ifcfg-eth0 改成ifcfg-eth1
重启
⑸ CentOS7将网口名称修改为eth0,eth1
因特殊需求,需要将CentOS7的默认网口名称改为eth格式的上一代命名方式
编辑 /etc/sysconfig/grub
在 GRUB_CMDLINE_LINUX 中增加 net.ifnames=0 biosdevname=0 ,完整的例子是: GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap net.ifnames=0 biosdevname=0 rhgb quiet"
重新生成grub配置文件 grub2-mkconfig -o /boot/grub2/grub.cfg
重启系统 /sbin/reboot
⑹ linux配置中eth0和eth1做什么用的
是一种光纤以太网接口卡,按照以太网通信协议进行信号传输。一般通过光缆与光纤以太网交换机连接。
Eth0和eth1用于区分网卡名。它们的含义与windows本地连接1和本地连接2相同。
这里的子网卡不是一个实用的网络接口,但是它可以作为一个集合接口在系统中闪现,比如eth0:1,eth1:2。
(6)eth0改成eth1扩展阅读:
Linux操作系统嵌入了TCP/IP协议栈,协议软件具有路由转发功能。路由和转发依赖于在主机中安装多个网卡作为路由器。
当某一网卡接收到度包时,系统内核会根据度包的目的IP地址查询路由表,然后根据查询结果将度包发送到另一网卡,最后通过该网卡发送度包。主机的进程是路由器的核心功能。
路由功能是通过修改Linux内核参数来实现的。sysctl命令用于配置和显示/proc/sys目录中的内核参数。
出于安全原因,Linux内核默认禁止数据包路由和转发。在Linux系统中,有临时和永久两种方法启用转发功能。
⑺ linux配置中eth0和eth1做什么用的
都是上网用的,只是名称不同。
eth0,eht1相当于windows的本地连接1本地连接2,就是告诉你现在又两块网卡,一块叫eth0,另一块叫eth1。
例如:
目录etc/sysconfig/network-scripts下面,ifcfg-eth0就代表eth0的配置,把文件改成了eth1,文件内容做下修改, 那就是eth1了。
当然,这种配置方法并不适用于所有的linux系统,但对RHEL是适用的。
(7)eth0改成eth1扩展阅读:
使用注意事项
子网卡在这里并不是实际上的网络接口设备,但是可以作为网络接口在系统中出现,如eth0:1、eth1:2这种网络接口。它们必须要依赖于物理网卡,虽然可以与物理网卡的网络接口同时在系统中存在并使用不同的IP地址,而且也拥有它们自己的网络接口配置文件。但是当所依赖的物理网卡不启用时(Down状态)这些子网卡也将一同不能工作。
如果将一个物理网卡通过vconfig命令添加到多个VLAN当中去的话,就会有多个VLAN虚拟网卡出现,他们的信息以及相关的VLAN信息都是保存在/proc/net/vlan/config这个临时文件中的,而没有独自的配置文件。它们的网络接口名是eth0.1、eth1.2这种名字。
⑻ 怎么解决虚拟机迁移后eth0变成了eth1
1、用ifconfig
eth0
up命令开启下网卡。
#ifconfig
eth0
up
2、更改eth0配置:
#vi/etc/sysconfig/network-scripts/ifcfg-eth0下显示:
DEVICE=eth0
ONBOOT=no
//开机启动网卡
BOOTPROTO=static
IPADDR=192.168.1.8
//自己设置有效ip地址
NETMASK=255.255.255.0
//子网掩码
GATEWAY=192.168.1.1
//有效网关地址
HWADDR=00:0C:29:96:38:F8
注意其中的ONBOOT=no将其改为yes,网卡激活。
3、重启服务。
#service
network
restart
重启后配置生效。
⑼ Ubuntu系统如何安装双网卡及更改网卡名称(eth0改为eth1)
如果ethtool eth0显示的信息类似与下面Settings for eth0:Supported ports: [ TP ]Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/FullSupports auto-negotiation: YesAdvertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full说明eth0是千兆网卡,如果ethtool eth0显示的信息类似与下面Settings for eth0:Supported ports: [ TP ]Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/FullSupports auto-negotiation: YesAdvertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full说明eth0是百兆网卡。对网络进行设置,可以编辑vi /etc/network/interfaces,类似与下# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopbackauto eth0 #设置eth0iface eth0 inet static address 192.168.37.76 netmask 255.255.255.0 network 192.168.37.0 broadcast 192.168.37.255 gateway 192.168.37.254 dns-nameservers 192.168.37.254 #auto eth1 #设置eth1#iface eth1 inet static#address xxx #auto eth0:1 #单网卡设置多个IP#iface eth0:1 inet static#address 192.168.1.60#netmask 255.255.255.0#network x.x.x.x#broadcast x.x.x.x#gateway x.x.x.x设置完后重启网络/etc/init.d/networking restart
⑽ Ubuntu系统如何安装双网卡及更改网卡名称(eth0改为eth1)
如果ethtool eth0显示的信息类似与下面Settings for eth0:Supported ports: [ TP ]Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/FullSupports auto-negotiation: YesAdvertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full说明eth0是千兆网卡,如果ethtool eth0显示的信息类似与下面Settings for eth0:Supported ports: [ TP ]Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/FullSupports auto-negotiation: YesAdvertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full说明eth0是百兆网卡。对网络进行设置,可以编辑vi /etc/network/interfaces,类似与下# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopbackauto eth0 #设置eth0iface eth0 inet static address 192.168.37.76 netmask 255.255.255.0 network 192.168.37.0 broadcast 192.168.37.255 gateway 192.168.37.254 dns-nameservers 192.168.37.254 #auto eth1 #设置eth1#iface eth1 inet static#address xxx #auto eth0:1 #单网卡设置多个IP#iface eth0:1 inet static#address 192.168.1.60#netmask 255.255.255.0#network x.x.x.x#broadcast x.x.x.x#gateway x.x.x.x设置完后重启网络/etc/init.d/networking restart