LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1351|回复: 6

两个网卡不同时间获得eth0、eth1会互换

[复制链接]
发表于 2006-2-23 15:45:40 | 显示全部楼层 |阅读模式
我有两个网卡,一个网卡为主板集成RealTek RTL8139  ip为dhcp获得,一为pci网卡dlink530tx
ip为静态给予,有时启动 eth0为RealTek RTL8139   eth0为dlink530tx,有时启动 eth0为dlink530tx  eth1为RealTek RTL8139,我只好人工修改/etc/network/interfaces 然后/etc/init.d/networking restart ,太麻烦了,可不可以固定,请高手指点一下

/var/log/messages:
Feb 23 07:38:58 localhost kernel: 8139cp: 10/100 PCI Ethernet driver v1.2 (Mar 22, 2004)
Feb 23 07:38:58 localhost kernel: 8139too Fast Ethernet driver 0.9.27
Feb 23 07:38:58 localhost kernel: ACPI: PCI Interrupt 0000:01:05.0[A] -> GSI 21 (level, low) -> IRQ 209
Feb 23 07:38:58 localhost kernel: eth0: RealTek RTL8139 at 0xc400, 00:0d:61:91:c8:b3, IRQ 209
Feb 23 07:38:58 localhost kernel: via-rhine.c:v1.10-LK1.2.0-2.6 June-10-2004 Written by Donald Becker
Feb 23 07:38:58 localhost kernel: ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 18 (level, low) -> IRQ 169
Feb 23 07:38:58 localhost kernel: PCI: Via IRQ fixup for 0000:01:00.0, from 11 to 9
Feb 23 07:38:58 localhost kernel: eth1: VIA Rhine III at 0x1c000, 00:40:05:41:0a:0a, IRQ 169.
Feb 23 07:38:58 localhost kernel: eth1: MII PHY found at address 1, status 0x786d advertising 05e1 Link 45e1.

Feb 23 14:31:53 localhost kernel: eth0: VIA Rhine III at 0x1c000, 00:40:05:41:0a:0a, IRQ 169.
Feb 23 14:31:53 localhost kernel: eth0: MII PHY found at address 1, status 0x786d advertising 05e1 Link 45e1.
Feb 23 14:31:53 localhost kernel: 8139too Fast Ethernet driver 0.9.27
Feb 23 14:31:53 localhost kernel: ACPI: PCI Interrupt 0000:01:05.0[A] -> GSI 21 (level, low) -> IRQ 209
Feb 23 14:31:53 localhost kernel: eth1: RealTek RTL8139 at 0xc400, 00:0d:61:91:c8:b3, IRQ 209
发表于 2006-2-24 07:50:18 | 显示全部楼层
å前¡有Ù个î˜,°在来了。

我手¨rmmod两个网卡模块,然后按照我的需要重新加载。

不知道什么原因。
回复 支持 反对

使用道具 举报

发表于 2006-2-24 10:17:37 | 显示全部楼层
在modprobe.conf中添加
alias eth0 8139too
alias eth1 [对应dlink网卡的驱动名称]
这个连接可以参考一下
http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-24 13:26:57 | 显示全部楼层
谢谢各位的指点:
结合我的配置,处理如下:
1)lsmod 找出网卡驱动模块
  例如:
  8139too                25088  0
  via_rhine              20900  0
2)在/etc/modprobe.d/aliases 增加两行:
  alias eth0 8139too
  alias eth1 via_rhine
结果还是不行
回复 支持 反对

使用道具 举报

发表于 2006-2-24 20:55:46 | 显示全部楼层
其实两个网卡交错是因为两个网卡的驱动加载次序造成的。
看到楼主用lsmod可以列出模块,说明是用模块方式加载驱动的。
由于你给的信息太少。我的基本想法是,可能你的/etc/modules.conf 好像是这个名字
里面已经有了8139too 和via_rhine两个模块的加载。 你要使/aliases起作用就不能在这个文件里面先行加载这两个模块。 把这两个模块名字从modules.conf里面删除再启动试试
回复 支持 反对

使用道具 举报

发表于 2006-2-26 08:57:39 | 显示全部楼层
DEBIAN 参考手册  提到可以 根据 网卡的MAC  固定 名称 和 IP 地址.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-10 12:31:33 | 显示全部楼层
谢谢各位指点,我已经解决,采用alias 模块的方法一直不成功!
根据mac分配ip,则可以
/etc/network/interfaces:

    auto lo eth0 eth1
    # The loopback network interface
    iface lo inet loopback

    mapping eth0 eth1
    script /etc/network/get-mac-address.sh
    map 00:0D:61:91:C8:B3  lan
    map 00:40:05:41:0A:0A  internet

    # The primary network interface
    iface internet inet static
    address 222.92.108.90
    netmask 255.255.255.248
    network 222.92.108.88
    broadcast 222.92.108.95
    gateway 222.92.108.89
    dns-nameservers 61.177.7.1

    iface lan inet dhcp

get-mac-address.sh在
/usr/share/doc/ifupdown/examples/
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表