Centos 7 dual network card bonding

1. Enter cd /etc/sysconfig/network-scripts/

View catalog Ls

Check network card status ip a

2. Back up the network card configuration file

cp ifcfg-em1ifcfg-em1-bak

cp ifcfg-em2ifcfg-em2-bak

3. Create a network card binding (bond) file

vim ifcfg-bond0

Press i to edit and enter the following

TYPE=bond

DEVICE=bond0

BOOTPROTO=static

ONBOOT=yes

IPADDR=192.168.100.17

NETMASK=255.255.255.0

GATEWAY=192.168.100.1

BONDING_OPTS="mode=1 miimon=100"

After inputting, press ESC, then enter: wq to exit: q!

 

4. Modify the ifcfg-eth0 file as follows:

Press i to edit

TYPE=Ethernet

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

After inputting, press ESC, then enter: wq to exit: q!

 

Then modify the ifcfg-eth1 file as follows:

Press i to edit

TYPE=Ethernet

DEVICE=eth1

ONBOOT=yes

BOOTPROTO=none

MASTER=bond0

SLAVE=yes

After inputting, press ESC, then enter: wq to exit: q!

 

5. Restart network service

systemctl restart  network或者service network restart

6. Turn off the firewall

systemctl stop  firewalld

7. Edit selinux files

vim  /etc/selinux/config

Press i to edit

Change enforcing to disabled

After inputting, press ESC, then enter: wq to exit: q!

8. Turn off selinux firewall

setenforce 0

 

PS:

1. Change the network card name (to abc)

mv ifcfg-em1  ifcfg-abc

2. Delete the network card

rm  –rf  ifcfg-em1

3. Restart the network card service control window

systemctl stop NetworkManager ( letters are case sensitive)

systemctl disable NetworkManager (letters are case sensitive)

4. Firewall settings

Check the firewall status: systemctl status firewalld.service

Shut down: systemctl stop firewalld

Start: systemctl start firewalld

Automatically shut down at boot: systemctl disable firewalld

Start automatically at boot: systemctl enable firewalld

Check whether it starts at boot: chkconfig --list|grep network(RHLE6)

Guess you like

Origin blog.csdn.net/m0_46517962/article/details/129764026