Linux下网卡混杂模式设置和取消

简介:

1、Linux下网卡常用的几种模式说明:

广播方式:该模式下的网卡能够接收网络中的广播信息。

组播方式:设置在该模式下的网卡能够接收组播数据。

直接方式:在这种模式下,只有目的网卡才能接收该数据。

混杂模式:在这种模式下的网卡能够接收一切通过它的数据,而不管该数据是否


2、查看、添加和取消混杂模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
a、查看网卡模式
[root@zabbix ~] # ifconfig -a
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
         inet 10.203.12.88  netmask 255.255.255.0  broadcast 10.203.12.255
         inet6 fe80::250:56ff:feb3:2253  prefixlen 64  scopeid 0x20<link>
         ether 00:50:56:b3:22:53  txqueuelen 1000  (Ethernet)
         RX packets 2800921171  bytes 2087772292594 (1.8 TiB)
         RX errors 0  dropped 61583  overruns 0  frame 0
         TX packets 2328391024  bytes 1651122431491 (1.5 TiB)
         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 0  (Local Loopback)
         RX packets 287928092  bytes 25694088025 (23.9 GiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 287928092  bytes 25694088025 (23.9 GiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
         
b、添加ens32网卡的混杂模式
[root@zabbix ~] # ifconfig ens32 promisc
[root@zabbix ~] # ifconfig -a
ens32: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST>  mtu 1500
         inet 10.203.12.88  netmask 255.255.255.0  broadcast 10.203.12.255
         inet6 fe80::250:56ff:feb3:2253  prefixlen 64  scopeid 0x20<link>
         ether 00:50:56:b3:22:53  txqueuelen 1000  (Ethernet)
         RX packets 2800927421  bytes 2087779226027 (1.8 TiB)
         RX errors 0  dropped 61585  overruns 0  frame 0
         TX packets 2328394266  bytes 1651123460792 (1.5 TiB)
         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 0  (Local Loopback)
         RX packets 287929365  bytes 25694221536 (23.9 GiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 287929365  bytes 25694221536 (23.9 GiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
         
c、除去ens32网卡的混杂模式
[root@zabbix ~] # ifconfig ens32 -promisc
[root@zabbix ~] # ifconfig -a
ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
         inet 10.203.12.88  netmask 255.255.255.0  broadcast 10.203.12.255
         inet6 fe80::250:56ff:feb3:2253  prefixlen 64  scopeid 0x20<link>
         ether 00:50:56:b3:22:53  txqueuelen 1000  (Ethernet)
         RX packets 2800929338  bytes 2087779370583 (1.8 TiB)
         RX errors 0  dropped 61607  overruns 0  frame 0
         TX packets 2328396280  bytes 1651123608090 (1.5 TiB)
         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 0  (Local Loopback)
         RX packets 287931015  bytes 25694392926 (23.9 GiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 287931015  bytes 25694392926 (23.9 GiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0










本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1795607,如需转载请自行联系原作者
目录
相关文章
|
10天前
|
存储 安全 Linux
|
4天前
|
存储 Linux C++
【Linux】详解信号的保存&&信号屏蔽字的设置
【Linux】详解信号的保存&&信号屏蔽字的设置
|
6天前
|
存储 安全 Linux
从基础到高级:Linux用户与用户组权限设置详解
从基础到高级:Linux用户与用户组权限设置详解
|
7天前
|
Linux
linux设置全局命令
linux设置全局命令
11 0
|
13天前
|
Linux Apache
Linux设置开机启动
以上步骤允许您在Linux系统上配置开机启动服务或程序。确保将"service-name"替换为实际要配置的服务或程序的名称。
21 0
|
16天前
|
存储 Linux Shell
【进厂修炼 - Second week】Linux服务及用户设置
【进厂修炼 - Second week】Linux服务及用户设置
|
19天前
|
Linux Shell 开发工具
linux如何设置服务自启
linux如何设置服务自启
21 0
|
19天前
|
Ubuntu Linux
Linux(Ubuntu)系统临时IP以及静态IP配置(关闭、启动网卡等操作)
请注意,以上步骤是在临时基础上进行配置的。如果要永久保存静态IP地址,通常还需要修改 `/etc/network/interfaces`文件,以便在系统重启后保持配置。同时,确保备份相关配置文件以防止出现问题。
33 1
|
20天前
|
存储 Linux 网络安全
|
21天前
|
Ubuntu Linux
Linux(22) Linux设置网络优先级顺序
Linux(22) Linux设置网络优先级顺序
10 0