Linux system dual network card binding configuration implementation

Linux system dual network card binding configuration implementation

System version

[root@ ~]# cat /etc/redhat-release 

CentOS release 6.8 (Final)

[root@ ~]# uname -r

2.6.32-642.6.1.el6.x86_64

Network card description

eth0 192.168.1.8 (server external network card)
eth1
eth2
Two server network cards (intranet)

Turn off firewall

[root@ ~]# /etc/init.d/iptables stop

[root@ ~]# chkconfig iptables off

Turn off selinux

[root@ ~]#setenforce 0 
[root@ ~]#sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

Disable NetworkManager

[root@ ~]# /etc/init.d/NetworkManager stop

Stopping NetworkManager daemon: [ OK ]

[root@ ~]# chkconfig NetworkManager off

[root@ ~]# /etc/init.d/network restart

Edit eth1 network card

[root@ ~]# cd /etc/sysconfig/network-scripts/
[root@ network-scripts\]# cat >ifcfg-eth1 <<EOF
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bind0
EOF

Edit eth2 network card

[root@ network-scripts]# cat >ifcfg-eth2 <<EOF    
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bind0
EOF

Edit bind0 network card

[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

Configuring bond parameters

[root@ network-scripts]# cat >/etc/modprobe.conf <<EOF
alias bind0 bonding
options bind0 miimon=100 mode=6
EOF

Add to boot (/etc/rc.local)

[root@ network-scripts]# cat >>/etc/rc.local <<EOF

ifenslave bind0 eth1 eth2

EOF

Restart network services

[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 ]

Configuration makes the binding take effect immediately

[root@LVS-2 network-scripts]# ifenslave bind0 eth1 eth2

Test Unicom

[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

At this time, you will find that the system has an extra network card

[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)

This is the end of this article about the implementation of dual network card binding configuration in Linux system. For more relevant Linux dual network card binding configuration content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Linux dual network card binding script method example
  • Linux uses dual network card bond and screwdriver interface
  • Configuration process of dual network card firewalld under Linux (recommended)
  • Detailed explanation of Linux dual network card binding to achieve load balancing
  • How to set up dual network cards in Linux
  • Summary of the practice of dual network card configuration under Linux system
  • Linux uses bond to implement dual network cards to bind a single IP sample code

<<:  MySQL 8.0 user and role management principles and usage details

>>:  Learn javascript iterator

Recommend

Writing High-Quality Code Web Front-End Development Practice Book Excerpts

(P4) Web standards are composed of a series of sta...

Record a slow query event caused by a misjudgment of the online MySQL optimizer

Preface: I received crazy slow query and request ...

HTML+CSS+JS sample code to imitate the brightness adjustment effect of win10

HTML+CSS+JS imitates win10 brightness adjustment ...

Solutions to black screen when installing Ubuntu (3 types)

My computer graphics card is Nvidia graphics card...

Comprehensive inventory of important log files in MySQL

Table of contents Introduction Log classification...

JavaScript to achieve text expansion and collapse effect

The implementation of expanding and collapsing li...

Write a shopping mall card coupon using CSS in three steps

Today is 618, and all major shopping malls are ho...

Example of exporting and importing Docker containers

Table of contents Exporting Docker containers Imp...

Implementation of MySQL's MVCC multi-version concurrency control

1 What is MVCC The full name of MVCC is: Multiver...

Practice of Vue global custom instruction Modal drag

Table of contents background Implementation ideas...

Detailed explanation of scp and sftp commands under Linux

Table of contents Preface 1. scp usage 2. Use sft...

What are the differences between xHTML and HTML tags?

All tags must be lowercase In XHTML, all tags must...

How to deeply understand React's ref attribute

Table of contents Overview 1. Creation of Refs ob...