安装命令
需要安装ifconfig命令
yum -y install net-tools
ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:baff:fef4:ecb0 prefixlen 64 scopeid 0x20<link>
ether 02:42:ba:f4:ec:b0 txqueuelen 0 (Ethernet)
RX packets 3 bytes 140 (140.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 708 (708.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.30.5 netmask 255.255.255.0 broadcast 192.168.30.255
inet6 fe80::20c:29ff:fe7c:24b prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:7c:02:4b txqueuelen 1000 (Ethernet)
RX packets 858 bytes 75109 (73.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 482 bytes 85152 (83.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
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
vethebfbfe2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::1c38:4aff:fe38:622 prefixlen 64 scopeid 0x20<link>
ether 1e:38:4a:38:06:22 txqueuelen 0 (Ethernet)
RX packets 3 bytes 182 (182.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 21 bytes 1714 (1.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
设置
设置之前查看网卡模式
[root@localhost ~]# ifconfig |grep eno
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
对网卡设置混在模式
ifconfig eno16777736 promisc
验证
[root@localhost ~]# ifconfig |grep eno
eno16777736: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1500
取消网卡混杂模式
ifconfig eno16777736 -promisc
验证
[root@localhost ~]# ifconfig |grep eno
eno16777736: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500