linux 不同型号网卡绑定,Linux各版本上的多网卡绑定

IPADDR_END=CLONENUM=0[/code]

可以有256个ip

2037 一个ip如何绑定两块网卡(hutuworm)

假设192.168.0.88是ip,192.168.0.1是网关:

[code]/sbin/modprobe bonding miimon=100 mode=1

/sbin/ifdown eth0

/sbin/ifdown eth1

/sbin/ifconfig bond0 192.168.0.88

/sbin/ifenslave bond0 eth0 eth1

/sbin/route add default gw 192.168.0.1[/code]

2038 192.168.1.0/24(双眼皮的猪)

它与192.168.1.0/255.255.255.0是等价的,只是表示方式不同....

Debian下

Debian和Ubuntu,

SuSE,

Mandriva、Fedora和RH

-----------------------------------------------------------------------

Debian和Ubuntu上的多网卡绑定

实验环境Ubuntu 6.06 Dadder,内核版本2.6.15-23 server

首先安装ifenslave

[code]#apt-get install ifenslave-2.6[/code]

编辑/etc/network/interfaces

[code]auto lo bond0 eth0 eth1

iface bond0 inet static

address 10.31.1.5

netmask 255.255.255.0

network 10.31.1.0

gateway 10.31.1.254

up /sbin/ifenslave bond0 eth0

up /sbin/ifenslave bond0 eth1

iface lo loopback

iface eth0 inet static

address 10.1.1.101

netmask 255.255.255.0

iface eth1 inet static

address 10.1.1.102

netmask 255.255.255.0[/code]

再编辑 /etc/modprobe.d/arch/i386

加上两行:

[code]alias bond0 bonding

options bonding mode=0 miimon=100[/code]

最后重启网络即可

[code]/etc/init.d/networking restart[/code]

-----------------------------------------------------------------------

SuSE,Mandriva、Fedora和RH

1、编辑 /etc/modules.conf 文件(SuSE的系统是/etc/modprobe.d/modprobe.cong.local),加入如下一行内容,以使系统在启动时加载bonding模块,对外虚拟网络接口设备为 bond0

alias bond0 bonding

2、编辑虚拟网络接口配置文件,指定网卡IP

[code]vi /etc/sysconfig/network-scripts/ifcfg-bond0[/code]

(SuSE的系统是/etc/sysconfig/network/ifcfg-bond0)

Fedora的写法

[code]DEVICE=bond0

IPADDR=192.168.1.1

NETMASK=255.255.255.0

NETWORK=192.168.1.0

BROADCAST=192.168.1.255

ONBOOT=yes

BOOTPROTO=none

USERCTL=no[/code]

SuSE的写法

[code]BOOTPROTO='static'

BROADCAST='192.168.1.255'

ETHTOOL_OPTIONS=''

IPADDR='192.168.1.1'

MTU=''

NETMASK='255.255.255.0'

NETWORK='192.168.1.0'

STARTMODE='auto'

USERCONTROL='no'[/code]

3、编辑物理网络接口配置文件,并指向虚拟网络接口bond0

Fedora:

物理网络接口配置文件位于/etc/sysconfig/network-scripts,

ifcfg-eth0对应第一个网卡,ifcfg-eth1对应第二个千兆网卡。

[code]ifcfg-eth0 :

DEVICE=eth0

IPADDR=11.0.0.1

NETMASK=255.255.255.0

USERCTL=no

ONBOOT=yes

BOOTPROTO=none

ifcfg-eth1 :

DEVICE=eth1

IPADDR=11.0.0.2

NETMASK=255.255.255.0

USERCTL=no

ONBOOT=yes

BOOTPROTO=none[/code]

SuSE:

物理网络接口配置文件位于/etc/sysconfig/network/,

以ifcfg-eth-(mac)为名字

[code]BOOTPROTO='static'

IPADDR='10.0.0.1'

NETMASK='255.255.255.0'

STARTMODE='auto'

USERCONTROL='no'[/code]

最后编辑/etc/rc.local(SuSE是/etc/rc.d/rc)或是直接运行

ifenslave bond0 eth0 eth1 eth2(绑几个网卡就写几个网卡的名字)

无论eth0 eth1 eth2的IP怎样设置,绑定之后全都以bind0的设置为准。此时所有网卡的mac地址都是一样的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux网卡绑定通常使用的是网络接口绑定技术,也称为网卡绑定网卡聚合、链路聚合等。这种技术可以将多个物理网卡绑定成一个虚拟网卡,从而实现带宽叠加和冗余备份,提高网络的可用性和可靠性。 在Linux系统中,常用的网络接口绑定技术有两种:bonding和team。下面分别介绍它们的实现方法。 一、bonding技术 1. 安装bonding模块 在Linux系统中,bonding模块通常已经包含在内核中。如果需要手动加载或者更新,可以使用以下命令: ``` modprobe bonding ``` 2. 配置bonding模块 在/etc/modprobe.d/目录下创建一个新的配置文件,例如bonding.conf,添加以下内容: ``` alias bond0 bonding options bonding mode=0 miimon=100 ``` 其中,mode=0表示使用负载均衡模式,miimon=100表示每隔100毫秒检查一次链路状态。 3. 配置网络接口 编辑/etc/network/interfaces文件,添加以下内容: ``` iface eth0 inet manual iface eth1 inet manual auto bond0 iface bond0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 bond-slaves eth0 eth1 bond-mode balance-rr bond-miimon 100 bond-downdelay 200 bond-updelay 200 ``` 其中,bond-slaves eth0 eth1表示将eth0和eth1绑定到bond0虚拟网卡上,bond-mode balance-rr表示使用负载均衡模式,bond-miimon 100表示每隔100毫秒检查一次链路状态,bond-downdelay 200和bond-updelay 200分别表示链路断开和恢复的延迟时间。 4. 重启网络服务 使用以下命令重启网络服务: ``` service networking restart ``` 二、team技术 1. 安装team模块 team模块通常也已经包含在Linux内核中,如果需要手动加载或者更新,可以使用以下命令: ``` modprobe team ``` 2. 配置team模块 在/etc/modprobe.d/目录下创建一个新的配置文件,例如team.conf,添加以下内容: ``` alias team0 team_mode_loadbalance ``` 其中,team_mode_loadbalance表示使用负载均衡模式。 3. 配置网络接口 编辑/etc/network/interfaces文件,添加以下内容: ``` iface eth0 inet manual iface eth1 inet manual auto team0 iface team0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 team-mode loadbalance team-port eth0 team-port eth1 ``` 其中,team-port eth0和team-port eth1表示将eth0和eth1绑定到team0虚拟网卡上,team-mode loadbalance表示使用负载均衡模式。 4. 重启网络服务 使用以下命令重启网络服务: ``` service networking restart ``` 以上就是Linux网卡绑定的实现方法,使用这种技术可以提高网络的可用性和可靠性,同时也可以实现带宽叠加。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值