Double-NIC binding for Kylin system

Source: Internet
Author: User

cd/etc/sysconfig/network-scripts/


[[email protected]network-scripts]# Cat Ifcfg-bond0
Device=bond0
Nm_controlled=no #yes的话是不需要network restart, directly effective.
Bootproto=static
Onboot=yes
ipaddr=10.225.3.164
netmask=255.255.255.0
gateway=10.225.3.254
dns1=10.225.5.16
Userctl=no
bonding_opts= "Mode=1 miimon=100" #redhat6可以直接在这里配置, no need to configure in/etc/modprobe.d/dist.conf
[[email protected]network-scripts]# Cat Ifcfg-bond1
Device=bond1
Nm_controlled=no
Bootproto=static
Onboot=yes
ipaddr=192.168.0.1
netmask=255.255.255.0
Userctl=no
bonding_opts= "Mode=1 miimon=100" #1是高可用, 0 is load balanced
[[email protected]network-scripts]# Cat Ifcfg-eth0
Device= "Eth0"
Nm_controlled=no
Onboot=yes
Type=ethernet
Bootproto=static
Master=bond0
Slave=yes
Userctl=no
[[email protected]network-scripts]# Cat Ifcfg-eth1
Device= "Eth1"
Nm_controlled=no
Onboot=yes
Type=ethernet
Bootproto=static
Master=bond0
Slave=yes
Userctl=no
[[email protected]network-scripts]# Cat Ifcfg-eth2
Device= "Eth2"
Nm_controlled=no
Onboot=yes
Type=ethernet
Bootproto=static
Master=bond1
Slave=yes
Userctl=no

[[email protected]network-scripts]# Cat Ifcfg-eth3
Device= "Eth3"
Nm_controlled=no
Onboot=yes
Type=ethernet
Bootproto=static
Master=bond1
Slave=yes
Userctl=no


4 # Vi/etc/rc.d/rc.local
Join
Ifenslave bond0 eth0 eth1

#那也就是说在主备模式下, when a network interface failure (such as the main switch power off, etc.), do not return to the network interruption, the system will be in accordance with the order of the specified network card in the cat/etc/rc.d/rc.local, the machine can still serve the external services, played a function of failure protection.




Chkconfig NetworkManager off #开机不启动 If the boot will appear ifconfig when the network card has its own IP, and route-n see the route table will also have eth0 and other routes, will not be normal
Service NetworkManager Stop
Chkconfig Network on
Service Network restart

Can see

Cat/proc/net/bonding/bond1

See which network card Bond1 is using now. The Ifdown eth2 can be used to test whether the binding redundancy is normal ifup the eth2 stop port.





That's what it looks like under normal circumstances.

[[email protected]network-scripts]# ifconfig
Bond0 Link encap:ethernet HWaddr c4:54:44:88:de:e4
inet addr:10.225.3.167 bcast:10.225.3.255 mask:255.255.255.0
Inet6 ADDR:FE80::C654:44FF:FE88:DEE4/64 Scope:link
Up broadcast RUNNING MASTER multicast mtu:1500 metric:1
RX packets:11780 errors:0 dropped:0 overruns:0 frame:0
TX packets:1963 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1444639 (1.3 MiB) TX bytes:284783 (278.1 KiB)

Bond1 Link encap:ethernet HWaddr c4:54:44:88:de:e6
inet addr:192.168.0.2 bcast:192.168.0.255 mask:255.255.255.0
Inet6 ADDR:FE80::C654:44FF:FE88:DEE6/64 Scope:link
Up broadcast RUNNING MASTER multicast mtu:1500 metric:1
RX packets:3579 errors:0 dropped:0 overruns:0 frame:0
TX packets:3021 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:506906 (495.0 KiB) TX bytes:314562 (307.1 KiB)

Eth0 Link encap:ethernet HWaddr c4:54:44:88:de:e4
Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1
RX packets:9784 errors:0 dropped:0 overruns:0 frame:0
TX packets:1953 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:994215 (970.9 KiB) TX bytes:283766 (277.1 KiB)
memory:95b20000-95b40000

eth1 Link encap:ethernet HWaddr c4:54:44:88:de:e4
Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1
RX packets:1996 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:450424 (439.8 KiB) TX bytes:1017 (1017.0 b)
memory:95b00000-95b20000

Eth2 Link encap:ethernet HWaddr c4:54:44:88:de:e6
Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1
RX packets:2960 errors:0 dropped:0 overruns:0 frame:0
TX packets:2642 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:378047 (369.1 KiB) TX bytes:270161 (263.8 KiB)
memory:95a20000-95a40000

Eth3 Link encap:ethernet HWaddr c4:54:44:88:de:e6
Up broadcast RUNNING SLAVE multicast mtu:1500 metric:1
RX packets:619 errors:0 dropped:0 overruns:0 frame:0
TX packets:379 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:128859 (125.8 KiB) TX bytes:44401 (43.3 KiB)
memory:95a00000-95a20000

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:5964 errors:0 dropped:0 overruns:0 frame:0
TX packets:5964 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:494380 (482.7 KiB) TX bytes:494380 (482.7 KiB)


############################### #下面这个是上网找的参考, with mode=0##################################

Today, the work in the record, convenient for later work to look over.
(linux6.1/6.5 the benefits of the double NIC binding, 0 mode, can realize the load balance of the dual network card, that is, for example, a single NIC network speed is 100M, dual network card is 200M, but our gigabit network adapter of the double NIC binding maximum is 140~150m,
1 mode, master/standby switching for dual NIC).
1, check whether the system configuration supports bonding:
cat/boot/config-xxxxxxxx | Grep-i Bonding 
Config_bonding=m
(Return config_bonding=m support, otherwise need to compile the kernel to enable him to support BONDING, need to compile and then Baidu) 
2, in order to prevent errors, you can first back up the network card configuration directory.
3, Configuration Bond0
Under/etc/sysconfig/network-scripts/, create a ifcfg-bond0 that reads as follows:
Device=bond0
Bootproto=static
Nm_controlled=no (must be no here)
Onboot=yes
ipaddr=192.168.1.51
netmask=255.255.255.0
gateway=192.168.1.1
Userctl=no 
bonding_opts= "Mode=0 miimon=200" (This is the configuration under Bind mode)
3, modify IFCFG-EM1 (General machine is ifcfg-eth0, name, whatever is not related) and ifcfg-em2, the content is as follows
Vim Ifcfg-em1
Device=em1
Bootproto=static
Master=bond0
Slave=yes
Onboot=yes
Userctl=no
Vim ifcfg-em2 
Device=em2
Bootproto=static
Master=bond0
Slave=yes
Onboot=yes
Userctl=no 
4, modify the/etc/modprobe.d/dist.conf file, and finally add
Alias Bond0 Binding
5, modify the/etc/rc.d/rc.local file, and finally add
Ifenslave bond0 eth0 eth1
6. Close NetworkManager Service 
Service NetworkManager Stop
Chconfig NetworkManager off
7, reboot machine, it is best to restart the machine, not restart the network card
8, ifconfig, see if Em1,em2 's MAC address is consistent with bond0
9. Check the operating status of Bond0
Cat/proc/net/bonding/bond0




Double-NIC binding for Kylin system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.