【原创】CentOS8双网卡绑定
1. NAT网络配置(所有服务器):
# yum install bash-completion
# cd /etc/sysconfig/network-scripts/
bond0配置:
# vim ifcfg-bond0
BOOTPROTO=static
NAME=bond0
DEVICE=bond0
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100" #指定绑定类型为1及链路状态监测间隔时间
IPADDR=192.168.10.21
NETMASK=255.255.255.0
GATEWAY=192.168.10.2
DNS1=202.106.0.20
eth0配置:
# cat ifcfg-eth0
BOOTPROTO=static
NAME=eth0
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
USERCTL=no
SLAVE=yes
ech1配置
# vim ifcfg-eth1
BOOTPROTO=static
NAME=eth1
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
USERCTL=no
SLAVE=yes
2.仅主机网络配置
# cd /etc/sysconfig/network-scripts/
Bond1配置:
# vim ifcfg-bond1
BOOTPROTO=static
NAME=bond1
DEVICE=bond1
ONBOOT=yes
BONDING_MASTER=yes
BONDING_OPTS="mode=1 miimon=100" #指定绑定类型为1及链路状态监测间隔时间
IPADDR=192.168.20.21
NETMASK=255.255.255.0
eth2配置:
# vim ifcfg-eth2
BOOTPROTO=static
NAME=eth2
DEVICE=eth2
ONBOOT=yes
MASTER=bond1
USERCTL=no
SLAVE=yes
eth3配置:
# vim ifcfg-eth3
BOOTPROTO=static
NAME=eth3
DEVICE=eth3
ONBOOT=yes
MASTER=bond1
USERCTL=no
SLAVE=yes
3.查看网卡状态:
# nmcli c reload
# nmcli c up ethX
# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
link/ether 00:0c:29:9d:a6:a6 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP group default qlen 1000
link/ether 00:0c:29:9d:a6:a6 brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond1 state UP group default qlen 1000
link/ether 00:0c:29:9d:a6:ba brd ff:ff:ff:ff:ff:ff
5: eth3: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond1 state UP group default qlen 1000
link/ether 00:0c:29:9d:a6:ba brd ff:ff:ff:ff:ff:ff
6: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0c:29:9d:a6:ba brd ff:ff:ff:ff:ff:ff
inet 192.168.20.50/24 brd 192.168.20.255 scope global noprefixroute bond1
valid_lft forever preferred_lft forever
7: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0c:29:9d:a6:a6 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.50/24 brd 192.168.10.255 scope global noprefixroute bond0
valid_lft forever preferred_lft forever
4.内外网通信:
# ping www.baidu.com
# ping 192.168.20.2
6.更新yum云:
# yum install wget –y
# rm -rf /etc/yum.repos.d/*
# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
# yum install –y centos-release-openstack-ocata.noarch
# yum install -y https://rdoproject.org/repos/rdo-release.rpm
# yum clean all
# yum makecache
主:更新阿里云openstack-ocata源,需更改rdo.repo, openstack-ocata.repo中的源为:
http://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-ocata/
http://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-queens/
7.查看yum源版本:
yum list centos-release-openstack*
8.安装常用命令
# yum install -y net-tools vim lrzsz tree screen lsof ntpdate telnet wget