匿名用户
1级
2016-08-16 回答
操作系统:RHEL7.0
两个网卡连接在一个交换机下面,本例用vmware模拟都在NAT模式下
1、查看当前网卡 名字 mac地址,确定当前为ens33、ens37
[root@LiuZhen network-scripts]#
[root@LiuZhen network-scripts]# ifconfig
ens33: flags=4163 mtu 1500
inet 192.168.221.222 netmask 255.255.255.0 broadcast 192.168.221.255
inet6 fe80::20c:29ff:fe92:cdde prefixlen 64 scopeid 0x20
ether 00:0c:29:92:cd:de txqueuelen 1000 (Ethernet)
RX packets 476 bytes 44782 (43.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 410 bytes 61722 (60.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens37: flags=4163 mtu 1500
ether 00:0c:29:92:cd:e8 txqueuelen 1000 (Ethernet)
RX packets 39 bytes 2523 (2.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2、进入以下目录/etc/sysconfig/network-scripts
vi ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
DEVICE=ens33
MASTER=bond0
SLAVE=yes
vi ifcfg-ens37
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
DEVICE=ens37
MASTER=bond0
SLAVE=yes
vi ifcfg-bond0
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
DEVICE=bond0
IPADDR=192.168.221.222
PREFIX=16
DNS=192.168.221.2
NM_CONTROLLED=no
vi /etc/modprobe.d/bond.conf
alias bond0 bonding
options bond0 miimon=100 mode=6
mode=6:平衡负载模式,两个都工作。有自动备援,不需要 “Switch”支援及设定。
mode=1:自动备援模式,只有一个工作。其中一条线若断线,其他线路将会自动备援。
mode=0:平衡负载模式,两个都工作。有自动备援,但需要 “Switch”支援及设定(这两个端口应该采取聚合方式)。
3、重启网络服务,
service network restart
[root@LiuZhen network-scripts]# ifconfig -a
bond0: flags=5187 mtu 1500
inet 192.168.221.222 netmask 255.255.0.0 broadcast 192.168.255.255
inet6 fe80::20c:29ff:fe92:cdde prefixlen 64 scopeid 0x20
ether 00:0c:29:92:cd:de txqueuelen 0 (Ethernet)
RX packets 1007 bytes 90348 (88.2 KiB)
RX errors 0 dropped 8 overruns 0 frame 0
TX packets 817 bytes 133925 (130.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens33: flags=6211 mtu 1500
ether 00:0c:29:92:cd:de txqueuelen 1000 (Ethernet)
RX packets 901 bytes 83115 (81.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 751 bytes 126638 (123.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens37: flags=6211 mtu 1500
ether 00:0c:29:92:cd:e8 txqueuelen 1000 (Ethernet)
RX packets 106 bytes 7233 (7.0 KiB)
RX errors 0 dropped 8 overruns 0 frame 0
TX packets 66 bytes 7287 (7.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
查看配置文件
root@LiuZhen network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: ens33
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: ens33
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:92:cd:de
Slave queue ID: 0
Slave Interface: ens37
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:0c:29:92:cd:e8
Slave queue ID: 0
配置完成。
今天的文章Linux中网卡信息中的是ens32,linux为什么网卡是ens33分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/32293.html