linux双网卡备份,Linux双网卡实现绑定和备份

登录并查看

login as: root

root@192.168.11.160's password:

[root@localhost ~]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:50:56:A8:6C:61

inet addr:192.168.11.160 Bcast:192.168.11.255 Mask:255.255.255.0

inet6 addr: fe80::250:56ff:fea8:6c61/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:114 errors:0 dropped:0 overruns:0 frame:0

TX packets:54 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:9166 (8.9 KiB) TX bytes:6535 (6.3 KiB)lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

查看当前网络接口配置文件

[root@localhost ~]# cd /etc/sysconfig/network-scripts/

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

DEVICE="eth0"

BOOTPROTO=none

NM_CONTROLLED="yes"

ONBOOT=yes

TYPE="Ethernet"

UUID="f0bd6d3b-c8dc-4e8a-8d9d-91938a5f4be1"

HWADDR=00:50:56:A8:6C:61

IPADDR=192.168.11.160

PREFIX=24

GATEWAY=192.168.11.1

DNS1=202.96.128.86

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="System eth0"

[root@localhost network-scripts]#

[root@localhost network-scripts]# cat ifcfg-eth1

DEVICE="eth1"

BOOTPROTO="dhcp"

HWADDR="00:50:56:A8:6C:62"

NM_CONTROLLED="yes"

ONBOOT="no"

TYPE="Ethernet"

UUID="fce1b80b-9e63-4468-aaaa-529e991a5cff"

[root@localhost network-scripts]#

修改内核模块加载参数

[root@localhost ~]# cd /etc/modprobe.d/

[root@localhost modprobe.d]# vi bonding.conf

alias bond0 bonding

options bond0 miimon=80 mode=5

mode参数所支持的选项

modes:

mode=0 (Balance Round Robin)

mode=1 (Active backup)

mode=2 (Balance XOR)

mode=3 (Broadcast)

mode=4 (802.3ad)

mode=5 (Balance TLB)

mode=6 (Balance ALB)

创建绑定接口的配置文件

[root@localhost ~]# cd /etc/sysconfig/network-scripts/

[root@localhost network-scripts]# vi ifcfg-bond0

DEVICE=bond0

IPADDR=192.168.11.160

NETMASK=255.255.255.0

NETWORK=192.16.11.0

BROADCAST=192.168.11.255

GATEWAY=192.168.11.1

ONBOOT=yes

BOOTPROTO=none

USERCTL=no

修改网卡配置文件

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

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=none

USERCTL=no

MASTER=bond0

SLAVE=yes

[root@localhost network-scripts]# vi ifcfg-eth1

DEVICE=eth1

ONBOOT=yes

BOOTPROTO=none

USERCTL=no

MASTER=bond0

SLAVE=yes

重启网络服务

[root@localhost network-scripts]# service network restart > 2012

/etc/sysconfig/network-scripts/ifdown-eth: line 116: /sys/class/net/bond0/bonding/slaves: No such file or directory

[root@localhost network-scripts]# cat 2012

Shutting down interface eth0: [ OK ]

Shutting down loopback interface: [ OK ]

Bringing up loopback interface: [ OK ]

Bringing up interface bond0: [ OK ]

[root@localhost network-scripts]#

^

[root@localhost ~]# ifconfig

bond0 Link encap:Ethernet HWaddr 00:50:56:A8:6C:61

inet addr:192.168.11.160 Bcast:192.168.11.255 Mask:255.255.255.0

inet6 addr: fe80::250:56ff:fea8:6c61/64 Scope:Link

UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1

RX packets:892 errors:0 dropped:0 overruns:0 frame:0

TX packets:983 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:68406 (66.8 KiB) TX bytes:87517 (85.4 KiB)eth0 Link encap:Ethernet HWaddr 00:50:56:A8:6C:61

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:518 errors:0 dropped:0 overruns:0 frame:0

TX packets:650 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:45276 (44.2 KiB) TX bytes:66535 (64.9 KiB)eth1 Link encap:Ethernet HWaddr 00:50:56:A8:6C:62

UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1

RX packets:374 errors:0 dropped:0 overruns:0 frame:0

TX packets:334 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:23130 (22.5 KiB) TX bytes:21216 (20.7 KiB)lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

s

e363b8ed665383afcf6b9b44fbfadd3d.png

4226bd87787cf800fa839ba3d62eebc3.png

c37768843de4b3abdd49a858870a1faa.png

09376611452b8411d5e1e37fe6168511.png

32e77ae54d711ef00275a291965f4602.png

修改内核模块加载参数

span style=”color: #008000;”

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值