LinuxSir.cn,穿越时空的Linuxsir!

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

双网卡配置的问题

[复制链接]
发表于 2007-1-11 12:34:42 | 显示全部楼层 |阅读模式
我在debian下配置双网卡,但是每次只能启用一块网卡,两块同时启用也只有一块有效
两块网卡都是8139的
在/etc/modules.conf添加了两块网卡设备还是不行
# /etc/modules.conf
alias eth0      8139too
alias eth1      8139too

网卡的配置参数如下:
###################################
# the network interfaces
iface eth0 inet static
        address 192.168.0.12
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1


iface eth1 inet static
        address 192.168.0.11
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
发表于 2007-1-11 13:05:00 | 显示全部楼层
Post by qq2375
我在debian下配置双网卡,但是每次只能启用一块网卡,两块同时启用也只有一块有效
两块网卡都是8139的
在/etc/modules.conf添加了两块网卡设备还是不行
# /etc/modules.conf
alias eth0      8139too
alias eth1      8139too

网卡的配置参数如下:
###################################
# the network interfaces
iface eth0 inet static
        address 192.168.0.12
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1


iface eth1 inet static
        address 192.168.0.11
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1


装个ifrename,然后man ifrename, 将两块网卡重命名为
eth1和eth2(不用eth0, 我也不清楚为什么,反正用eth0常常出问题),
修改你的interfaces文件。我是这么搞定的。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-11 15:42:57 | 显示全部楼层
Post by simonsays
装个ifrename,然后man ifrename, 将两块网卡重命名为
eth1和eth2(不用eth0, 我也不清楚为什么,反正用eth0常常出问题),
修改你的interfaces文件。我是这么搞定的。

用你的方法试过了,和我之前配置的效果是一样的,只能激活一块网卡。
用ifrename只是把网卡的名称和网卡的物理接口绑定了。
回复 支持 反对

使用道具 举报

发表于 2007-1-11 16:26:49 | 显示全部楼层
你试试这样:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.12
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

auto eth1
iface eth1 inet static
address 192.168.1.11
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

一个通过网关与外网连接。另一个分配IP用于内网,也可作为内网网关.
你的问题是同时设定了两个网关,尽管是一个 ip,但是不允许的
回复 支持 反对

使用道具 举报

发表于 2007-1-11 18:48:55 | 显示全部楼层
如果你仅想多占用一个ip,可以这样:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.12
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

auto eth1
iface eth1 inet static
address 192.168.0.11
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255

但似乎实用价值不大.
不如用一个网卡写成:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.12
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

auto eth0:0
iface eth0:0 inet static
address 192.168.0.11
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
.....
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-11 20:05:42 | 显示全部楼层
多谢chinajz!
我明天试一下,我一个网卡是用来连接外网的,
另一个网卡是用来调试嵌入式卡发板的,用直连网线,对IP没什么要求的了
回复 支持 反对

使用道具 举报

发表于 2007-1-11 21:44:36 | 显示全部楼层
我å前机子2块网卡,分别2个ip;
My pc has 2 ethernet  card and i set two ip to them.
Ï次启¨之后虽然2块ýý用,但是好Ï2ë网卡上的ipÏ常’换一样。
Though 2 cards both work, their ip is always changing.
所以我想能把ip与mac绑定就不会ip互窜了,但没有实验
So i think it 's a good way to bind the ip to its MAC to resolve the matter. I didn't  test it.

[my post is truncated]
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-12 12:16:31 | 显示全部楼层
我试过chinajz兄的方法了,结果和我之前配置的情况一样,还是不能同时启动两块网卡。
应该不是网关配置的问题,也不是lish兄所说的启动顺序的问题。

我的一块网卡通过局域网连接到外网,一块网卡通过直连网线连接嵌入式开发板。
我通过ifdown,ifup轮流启用每个网卡都能够正常工作。
两个网卡同时启用时,只有先启用的网卡能够正常工作。
但是,通过ifconfig查看,两个网卡都是启动正常。

诸位兄弟再帮忙分析看,会是什么问题?
回复 支持 反对

使用道具 举报

发表于 2007-1-12 12:24:18 | 显示全部楼层
会是路由的问题么?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-1-12 12:34:01 | 显示全部楼层
一个接局域网,一个接直连线,和路由没关系呀。。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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