系统版本
?
|
1
2
3
4
5
6
7 |
[root@ ~]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[root@ ~]# uname -r
2.6.32-642.6.1.el6.x86_64 |
网卡说明
eth0 192.168.1.8(服务器外网卡)
eth1
eth2
两块服务器网卡(内网)
关闭防火墙
?
|
1
2
3 |
[root@ ~]# /etc/init.d/iptables stop
[root@ ~]# chkconfig iptables off |
关闭selinux
?
|
1
2 |
[root@ ~]#setenforce 0
[root@ ~]#sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config |
禁用NetworkManager
?
|
1
2
3
4
5
6
7 |
[root@ ~]# /etc/init.d/NetworkManager stop
Stopping NetworkManager daemon: [ OK ]
[root@ ~]# chkconfig NetworkManager off
[root@ ~]# /etc/init.d/network restart |
编辑eth1网卡
?
|
1
2
3
4
5
6
7
8 |
[root@ ~]# cd /etc/sysconfig/network-scripts/
[root@ network-scripts\\]# cat >ifcfg-eth1 <<EOF
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bind0
EOF |
编辑eth2网卡
?
|
1
2
3
4
5
6
7 |
[root@ network-scripts]# cat >ifcfg-eth2 <<EOF
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bind0
EOF |
编辑bind0网卡
?
|
1
2
3
4
5
6
7
8
9
10
11 |
[root@ network-scripts]# cat >ifcfg-bind0 <<EOF
DEVICE=bind0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.0.0.8
NETMASK=255.255.255.0
GATEWAY=10.0.0.254
IPV6INIT=no
USERCTL=no
EOF |
配置bond参数
?
|
1
2
3
4 |
[root@ network-scripts]# cat >/etc/modprobe.conf <<EOF
alias bind0 bonding
options bind0 miimon=100 mode=6
EOF |
加入开机自启动(/etc/rc.local)
?
|
1
2
3
4
5 |
[root@ network-scripts]# cat >>/etc/rc.local <<EOF
ifenslave bind0 eth1 eth2
EOF |
重启网络服务
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 |
[root@LVS-2 network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth1: [ OK ]
Shutting down interface eth2: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface bind0: WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
Determining if ip address 10.0.0.8 is already in use for device bind0..[ OK ]
Bringing up interface eth0: Determining if ip address 192.168.1.8 is already in use for device eth0... [ OK ]
Bringing up interface eth1: RTNETLINK answers: File exists [ OK ]
Bringing up interface eth2: RTNETLINK answers: File exists [ OK ] |
?
|
1 |
[root@LVS-2 network-scripts]# ifenslave bind0 eth1 eth2 |
测试联通
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 |
[root@LVS-2 network-scripts]# ping 10.0.0.8
PING 10.0.0.8 (10.0.0.8) 56(84) bytes of data.
64 bytes from 10.0.0.8: icmp_seq=1 ttl=64 time=0.089 ms
64 bytes from 10.0.0.8: icmp_seq=2 ttl=64 time=0.046 ms
^C
--- 10.0.0.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1921ms
rtt min/avg/max/mdev = 0.046/0.067/0.089/0.023 ms |
此时会发现系统多一个网卡
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 |
[root@LVS-2 network-scripts]# ifconfig bind0
bind0
Link encap:Ethernet HWaddr 00:0C:29:CC:9B:5
inet addr:10.0.0.8 Bcast:10.0.0.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fecc:9b55/64 Scope:LinkUP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:151 errors:0 dropped:0 overruns:0 frame:0
TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11826 (11.5 KiB) TX bytes:258 (258.0 b) |
到此这篇关于Linux 系统双网卡绑定配置实现的文章就介绍到这了,更多相关Linux 双网卡绑定配置内容请搜索快网idc以前的文章或继续浏览下面的相关文章希望大家以后多多支持快网idc!
原文链接:https://segmentfault.com/a/1190000023033452
相关文章
猜你喜欢
- ASP.NET自助建站系统的域名绑定与解析教程 2025-06-10
- 个人服务器网站搭建:如何选择合适的服务器提供商? 2025-06-10
- ASP.NET自助建站系统中如何实现多语言支持? 2025-06-10
- 64M VPS建站:如何选择最适合的网站建设平台? 2025-06-10
- ASP.NET本地开发时常见的配置错误及解决方法? 2025-06-10
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-05-25 83
-
2025-05-25 66
-
2025-05-26 79
-
关于安装linux redhat后无法使用yum命令安装gcc-c++问题的解决过程
2025-05-27 54 -
2025-05-29 88
热门评论

