当前位置: 首页 > news >正文

掩码、反掩码、通配符的区别和计算方式

注:几篇文章合集捋清掩码、反掩码、通配符的区别。


ACL 通配符,子网掩码,反掩码区别和计算方式

192.168.1.1

255.255.255.0

掩码:

1111111111111111000000000

@ 左边永远是 1,右边永远是 0

@ 1 和 0 ,永远不会交叉出现

@ 关注 “掩码” 中 1 所对应的位;

反掩码:

@ 左边永远是 0,右边永远是 1

@ 1 和 0 ,永远不会交叉出现

@ 关注 “掩码” 中 0 所对应的位;

通配符:(wildcard bits)

@关注 “通配符” 中 0 所对应的位;

如何写 ACL:

rule {id} permit/deny source [x.x.x.x] 【通配符】

x.x.x.x ,表示的是你想抓取的通信流量的 公共部分

记住:在写公共部分的时候的原则是:

相同的位,直接写

不同的位,变成 0

奇数偶数:10.1.1.0

奇数

1 0000 0001

3 0000 0011

5 0000 0101

7 0000 0111

9 0000 1001

偶数

2 0000 0010

4 0000 0100

6 0000 0110

8 0000 1000

10 0000 1010

奇数 IP 的最后一位都是 1,而偶数 IP 的最后一位都是 0。这就是规律。

奇数时候 0001 这个不变,source ip 指的是起始 ip,起始时 10.1.1.1 通配符最后 1111 1110【看的是 0 是不变的】

同理偶数 0010 这个不变,source ip 指的是起始 ip,起始是 10.1.1.2 不是 10.1.11,通配符最后 1111 1110 十进制 254

奇数 IP 的:10.1.1.1 0.0.0.254 ;偶数 IP 的呢 ——10.1.1.2 0.0.0.254

通配符规则命令允许匹配以下数据流量

192.168.1.1
0.0.0.0000 0001
192.168.1.3
0.0.0.0000 0011
192.168.1.5
0.0.0.0000 0101
192.168.1.7
0.0.0.0000 0111
0.0.0.0000 0zz0
0.0.0.0000 0110
0.0.0.6
rule 10 permit source 192.168.1.1 0.0.0.6

ACL 主要难点是在通配符的计算,如有这么一道题:
已知主机 ip,求通配符。

例:允许

192.168.1.5/24
192.168.1.10/24
192.168.1.13/24
192.168.1.14/24

主机访问路由器。要求写出 ACL 来,但只能用两条 ACL 代替。

  1. 先将这四个数换成二进制:

192.168.1.5 0.0.0. 0000 0101 (5)

0 1 0 1

192.168.1.10 0.0.0. 0000 1010 (10)

1 0 1 0

192.168.1.10 0.0.0. 0000 1101 (13)

1 1 0 1

192.168.1.14 0.0.0. 0000 1110 (14)

1 1 1 0

0101 (5) 1010 (10) 1101 (13) 1110 (14)

找相同部分

用两条命令来匹配

  1. 我们可以看到规律

5 和 13
0101 (5)
1101 (13)

相同为比较多只有第一个不同, 不同要用 “1” 表示

1000 十进制表达是 8

那么通过这两个 ip 的 acl 可以这样写

192.168.1.0000 0101
0.0.0. 0000 1000

rule 10 permit source 192.168.1.5 0.0.0.8

  1. 可以看到规律

10 和 14
1010 (10)
1110 (14)

相同为比较多只有第一个不同,不同要用 “1” 表示

0100 十进制表达是 4

那么通过这两个 ip 的 acl 可以这样写

192.168.1.0000 1010
0.0.0. 0000 0100

rule 20 permit source 192.168.1.10 0.0.0.4


via:

  • ACL 通配符,子网掩码,反掩码区别和计算方式_51CTO 博客_子网掩码计算 qq5ea97e5ed12c0 2020-05-16 16:14:04

    https://blog.51cto.com/u_14806008/2495854


浅谈为何需要反掩码 inverse-mask wildcard-mask

反掩码,英文名 wildcard-mask,也直译成 inverse-mask

在介绍反掩码之前,我们先回顾一下掩码 mask 的相关知识点
1.掩码
掩码中有 1 有 0,其中 连续的1 表示网络号,而 连续的0 表示主机范围,

举例:

255.255.255.0

转成二进制形式:

1111 1111 . 1111 1111 . 1111 1111 . 0000 0000

其中的 1 有 24 个,说明这个掩码有 24 位的网络号,也可以用 /24 表示

/24 是网络位,24 个 比特(bit )位,且为 连续的24 个 1,

子网掩码长度一共 32 个 bit,由两部分组成,网络位 + 主机位,本例中,网络位有 24bit,剩下的 8 个 bit 就是主机位,用二进制形式表示,其范围是:

0000 0000 ~ 1111 1111

转成十进制形式:

0~255,

主机编号从 0 到 255,共 256 个

/24 的网段里, 0 用来表示本网段,作为网段地址使用,255 用于表示网段中的广播地址,所以可用于表示主机的主机地址有 254 个,

这就是子网掩码的作用,

请注意,子网掩码中的 1 是连续的,不能出现一堆 1 里面夹着 0 的情况,
子网掩码中的 0 也同理,不能出现一堆 0 里面夹着 1 的情况。

比如,1111 1111.1111 0000.1111 1111.0000 1100,这样的子网掩码是不合法的,

请注意,下面的斜线模式指的是 连续的 1连续的 0,1 是连续的,0 也是连续的,不能出现断开的情况,
比如,/16 指的是连续的 16 个 1 再接着 16 个连续的 0,是这样的 11111111.11111111.00000000.00000000
而不能出现类似 11111111.00000000.11111111.00000000,这样的虽然也是 16 个 1 和 16 个 0,但是,1 不连续了,0 也不连续了,所以是错误的子网掩码,

所以 子网掩码 只能是如下的列表中的一个:


/1 128.0.0.0 10000000.0.0.0 /2 192.0.0.0 11000000.0.0.0 /3 224.0.0.0 11100000.0.0.0 /4 240.0.0.0 11110000.0.0.0 /5 248.0.0.0 11111000.0.0.0 /6 252.0.0.0 11111100.0.0.0 /7 254.0.0.0 11111110.0.0.0 /8 255.0.0.0 11111111.0.0.0

/9 255.128.0.0 11111111.10000000.0.0 /10 255.192.0.0 11111111.11000000.0.0 /11 255.224.0.0 11111111.11100000.0.0 /12 255.240.0.0 11111111.11110000.0.0 /13 255.248.0.0 11111111.11111000.0.0 /14 255.252.0.0 11111111.11111100.0.0 /15 255.254.0.0 11111111.11111110.0.0 /16 255.255.0.0 11111111.11111111.0.0

/17 255.255.128.0 11111111.11111111.10000000.0 /18 255.255.192.0 11111111.11111111.11000000.0 /19 255.255.224.0 11111111.11111111.11100000.0 /20 255.255.240.0 11111111.11111111.11110000.0 /21 255.255.248.0 11111111.11111111.11111000.0 /22 255.255.252.0 11111111.11111111.11111100.0 /23 255.255.254.0 11111111.11111111.11111110.0 /24 255.255.255.0 11111111.11111111.11111111.0

/25 255.255.255.128 11111111.11111111.11111111.10000000 /26 255.255.255.192 11111111.11111111.11111111.11000000 /27 255.255.255.224 11111111.11111111.11111111.11100000 /28 255.255.255.240 11111111.11111111.11111111.11110000 /29 255.255.255.248 11111111.11111111.11111111.11111000 /30 255.255.255.252 11111111.11111111.11111111.11111100 /31 255.255.255.254 11111111.11111111.11111111.11111110 /32 255.255.255.255 11111111.11111111.11111111.11111111

2.反掩码
反掩码也可以用来表示一个网段,比如:0.0.0.255 ,表示这个网段的网络号是 /24 ,从而判断出主机号有 256 个,
子网掩码 255.255.255.0 表示一个网段的网络号是 255.255.255/24,主机范围是 0~256 即 2⁸ (256)个
这么看来,反掩码 0.0.0.255 =255.255.255.0
作用相同,为啥又弄出一个反掩码捏,多此一举?!

看个例子:
要创建一个 acl,只允许两个网段通过,
1.192.168.10.0/24
2.192.168.14.0/24

先来试试用 子网掩码 来解决这个问题,

因为 10 和 14 是不连续的,所以无论我们怎么掩,都会把 11、12、13 放进来, 10 到 14 有 5 个数,
为了便于说明和理解,咱们先看 2 台主机,a.b.c.10a.b.c.14
因为 10 和 14 是不连续的,相差了 3 个数(11、12、13),
要想把这两个 ip 放到同一个网段中,就需要至少能容纳 8 台主机的子网掩码(用容纳 4 台主机的子网掩码 / 30 是不行的,不能同时装下 10 和 14,所以只能选用 / 29 的子网掩码),255.255.255.248/29
这样的子网掩码下,a.b.c.10 和 a.b.c.14 就能在同一个网段了,
网段的范围是: a.b.c.8 、a.b.c.9 、a.b.c.10 、a.b.c.11、a.b.c.12 、a.b.c.13 、a.b.c.14 、a.b.c.15

把这两个 ip 放到同一个网段中,就能使用一条路由来表示 a.b.c.10a.b.c.14 这两个主机地址了

通过上面的 a.b.c.10a.b.c.14 的例子我们可以类比出,
要想将 192.168.10.0 和 192.168.14.0 放到一个路由条目里,需要使用的子网掩码是 /21
255.255.248.011111111.11111111.11111000.0
路由如下:

192.168.10.0 /21
或者 192.168.14.0 /21
表示 192.168.10.0 和 192.168.14.0 在同一个子网里,

虽然用子网掩码能完成将 192.168.10.0192.168.14.0 放到一个子网里,
但同时问题也出现了,
就是,192.168.8.0192.168.9.0192.168.11.0192.168.12.0192.168.13.0192.168.15.0
这 6 个网段也被包括进来了,
而我们的需求是,一条路由中只有 192.168.10.0192.168.14.0 这两个网段,没有其他的网段。

那么,这时候就需要反掩码登场了,

我们先来观察一下,
192.168.10.0 和 192.168.14.0 在二进制下是什么样子,不同之处在哪里,

192.168.10.0:11000000.10101000.00001010.00000000
192.168.14.0:11000000.10101000.00001110.00000000

可见,192.168.10.0 和 192.168.14.0 的二进制表示形式中,只有 红色字符所在的位置不同,其他位置一摸一样,
那么,根据反掩码的规则,0 表示精确匹配,1 表示可以是任意数值,我们现在只保留红色字符的那一位为 1,其他位都置为 0,就可以生成一个反掩码,

00000000.00000000.00000100.00000000

它的点分十进制的表示是:

0.0.4.0

为了方便理解,我们给这个反掩码变个样子,

00000000.00000000.00000X00.00000000

X 所在的位置上,可以是任意值,即,可以是 0 也可以是 1

同时,我们知道反掩码是不能单独存在的,反掩码必须跟着一个 ip,
所以我们让这个反掩码跟着 192.168.10.0,让它们之间相互作用,
当这个反掩码中除了 x 所在的位置以外,其他的所有位置的值都与 192.168.10.0 一模一样的时候,
就有:

11000000.10101000.00001`X`10.00000000
1

192.168.(1010+0x00.0

x0 时,


192.168.(1010+0000)₂.0,
192.168.(1010)₂.0,
即 192.168.10.0

x1 时,


192.168.(1010+0100)₂.0,
192.168.(1110)₂.0,
即 192.168.14.0

同理,让这个反掩码跟着 192.168.14.0
除了 X 位之外的其他位置和 192.168.14.0 一模一样的时候,也有

192.168.(1010+0X00.0

x0 时,


192.168.(1010+0000)₂.0,
192.168.(1010)₂.0,

即 192.168.10.0

x1 时,


192.168.(1010+0100)₂.0,
192.168.(1110)₂.0,

即 192.168.14.0

它的点分十进制的表示:

0.0.4.0

让反掩码 0.0.4.0192.168.10.0 或者 192.168.14.0 结合起来,就可以表示 192.168.10.0192.168.14.0 这两个网段了,
表示形式如下:

192.168.10.0``0.0.4.0`
或者
`192.168.14.0` `0.0.4.0

反掩码 0.0.4.0 可以唯一的标识 192.168.10.0192.168.14.0 这两段网络,而不会出现把其他网段也包括进来的情况了,
因为,反掩码 0.0.4.000000000.00000000.00000100.00000000)跟着 192.168.10.0 的时候,只有 1 的位置是可以变换的,变成 0,就是 192.168.10.0 本身,变成 1 就是 192.168.14.0
所以 0.0.4.0 作用于 192.168.10.0 上的时候, 只能标识两个网段,即 192.168.10.0192.168.14.0 这两个网段,

这就是 反掩码精确匹配 的作用,是用 子网掩码无法办到 的。

一定要明确一个根本点,在反掩码中,有 0 的位置表示必须 精确匹配 这一位,1 表示 不关心 这一位(是 0 是 1 都行),

还有一个往往容易被忽视的地方,那就是反掩码不能单独存在,反掩码 是要跟着一个 ip 地址 的(这个 ip 地址是一个具体的主机地址也可以是一个网络号,它们是一个整体,
举例:192.168.1.1 0.0.0.0 ,表示我们期待一个 ip 地址,并且这个 ip 地址的 32 个 bit 必须在每个位置上都与 192.168.1.1 一致,达到精确匹配的要求,所以,192.168.1.1 0.0.0.0 就表示的是 192.168.1.1 这个主机地址),也就是我们期待的目标是 192.168.1.1 这台主机,
再举例:192.168.1.0 0.0.0.255,表示我们期待一些 ip 地址,并且这些个 ip 地址的前 24 位必须与 192.168.1.0 这个网络号一致,达到精确匹配的要求,剩余的其他位置是什么都无所谓,我们并不关心,所以最终符合我们要求的 ip 地址有,192.168.1.0、192.168.1.1、192.168.1.2、192.168.1.3、192.168.1.4、……、191.168.1.254、192.168.1.255,这么多个,用子网掩码的形式来表示就是 ,192.168.1.0/24 这个网段里所有的主机,

对反掩码的一切解读,都离不开它所跟随的 ip 地址,总是以这个 ip 地址为依据以这个 ip 地址为参考的,单独拿出一个反掩码来是没有任何意义的,

June the 06th 2022


via:

  • 浅谈为何需要反掩码 inverse-mask wildcard-mask-CSDN 博客 码龄 3 年 审核中 已于 2023-05-07 10:14:52 修改

    https://blog.csdn.net/m0_47505062/article/details/125095330


掩码、反掩码、通配符的区别

在配置 IP 地址,路由协议、控制列表中会使用到子网掩码,来对 IP 地址的网络位和主机位进行范围控制。

掩码

掩码(Mask)是由连续的 1 或 0 组成的 32 位掩码,用来衡量 IP 地址网络位的长度
1 对应的部分为网络位
0 对应的部分为主机位

典型使用:

在接口配置 IP 地址的时候需要配置掩码

img

通过配置掩码位数可以控制 IP 地址网络位的数量


反掩码

反掩码(Wildcard-mask)是 IP 地址掩码的反码,是直接把 IP 地址的掩码数字取反操作。

0 变 1 ,1 变 0

1 表示忽略 IP 地址中对应的位,0 表示必须保留此位。

例如:子网掩码 255.0.0.0,该掩码的反码为 0.255.255.255

典型使用:

在宣告 OSPF 区域所包含的网段时会使用反掩码

img

通过配置反掩码可以控制 OSPF 宣告的网段范围

虽然命令提示显示为通配符位,但是其实是使用反掩码

img

提示通配符 OSPF 网络掩码不是连续的。

通配符与反掩码的最大区别是:

通配符是可以是不连续的 1 和 0

反掩码必须是连续的 1


通配符

通配符(Wildcard)以点分十进制表示,并以二进制的 0 表示 “匹配”,1 表示 “不关心”,这与子网掩码恰好相反。

其实就是更为严格的反掩码

例如:子网掩码 255.255.255.0 对应的通配符掩码就是 0.0.0.255 。

通配符掩码中的 0 或 1 可以是不连续的,这样可以更加灵活地进行匹配,

例如 0.255.0.255 就是一个合法的通配符掩码

典型使用:

在配置 ACL 访问控制列表的时候会使用通配符

img

通过配置连续 / 不连续的 1 可以对地址进行匹配


偶数位匹配

例如 192.168.0.0 0.0.254.255

通配符:0.0.254.255

11000000.10101000.00000000.00000000

00000000.00000000.11111110.11111111

绿色背景为必须匹配的二进制位

通过观察可以发现可以匹配的为:

11000000.10100000.00000010.00000000

11000000.10101000.00000100.00000000

11000000.10101000.00000110.00000000

11000000.10101000.00001000.00000000

11000000.10101000.00001010.00000000

第三段分别为 2,4,6,8,10

结论:可以匹配出偶数位网段


奇数位匹配

例如 192.168.1.0 0.0.254.255

通配符:0.0.254.255

11000000.10101000.0000001.00000000

00000000.00000000.11111110.11111111

绿色背景为必须匹配的二进制位

通过观察可以发现可以匹配的为:

11000000.10100000.00000001.00000000

11000000.10101000.00000011.00000000

11000000.10101000.00000101.00000000

11000000.10101000.00000111.00000000

11000000.10101000.00001001.00000000

11000000.10101000.00001011.00000000

第三段分别为 1,3,5,7,9,11

结论:可以匹配出奇数位网段


总结

对比掩码、反掩码、通配符

类型规则作用举例备注
掩码连续的 1 和 0IP 地址255.255.255.01 对应网络位,0 对应主机位
反掩码连续的 1 和 0路由协议0.0.0.2550 必须匹配,1 无需匹配
通配符任意的 1 和 0访问控制列表0.0.255.00 必须匹配,1 无需匹配

通配符用法

通配符说明举例
X.X.X.X 0仅匹配一个地址192.168.1.1 0.0.0.00 只匹配 192.168.1.1 这个地址
X.X.X.X 0.0.0.255匹配一个 C 类网段192.168.1.0 0.0.0.255 匹配 192.168.1.0 这个网段
X.X.X.X 0.0.254.255匹配偶数网段192.168.0.0 0.0.254.255 匹配 192.168.0.0 中的的偶数网段
X.X.1.X 0.0.254.255匹配奇数网段192.168.1.0 0.0.254.255 匹配 192.168.0.0 中的的奇数网段
X.X.X.X 255.255.255.255匹配任意地址0.0.0.0 255.255.255.255 匹配任意地址

via:

  • 掩码、反掩码、通配符的区别_通配符和反掩码区别 - CSDN 博客 起旧雾于 2024-04-17 11:44:07 发布

    https://blog.csdn.net/qq_45826271/article/details/137858890


注:机翻,未校对。

思科认证 CCNA Study Resources - Subnet Mask vs Wildcard Mask

子网掩码与通配符掩码

March 18, 2021 admin0

In the world of networking, IP addressing plays a crucial role. It allows devices on a network to communicate with one another, enabling the exchange of data and information. IP addresses are used to identify devices on a network and send data packets to their intended recipient. However, simply having an IP address is not enough to ensure proper communication between devices. Subnet masks and wildcard masks are additional tools that are utilized to facilitate communication and routing on a network. In this article, we will explore the differences between subnet masks and wildcard masks, their purposes, and how they are used in networking.
在网络领域,IP 寻址起着至关重要的作用。它允许网络上的设备相互通信,从而实现数据和信息的交换。IP 地址用于识别网络上的设备并将数据包发送给其预期接收者。但是,仅仅拥有 IP 地址并不足以确保设备之间的正确通信。子网掩码和通配符掩码是用于促进网络上的通信和路由的附加工具。在本文中,我们将探讨子网掩码和通配符掩码之间的区别、它们的用途以及它们在网络中的使用方式。

Understanding IP Addressing 了解 IP 寻址

Before we dive into subnet masks and wildcard masks, let’s first revisit the basics of IP addressing. An IP address is a unique numerical identifier assigned to every device connected to a network. It is composed of four 8-bit octets, separated by periods, and can range from 0 to 255 for each octet.
在深入研究子网掩码和通配符掩码之前,让我们先回顾一下 IP 寻址的基础知识。IP 地址是分配给连接到网络的每个设备的唯一数字标识符。它由四个 8 位八位字节组成,由句点分隔,每个八位字节的范围从 0 到 255。

For example, an IP address may look like this: 192.168.1.25. This IP address is divided into two parts: the network address and the host address. The network address identifies the network to which the device is connected, while the host address identifies the specific device on that network.
例如,IP 地址可能如下所示:192.168.1.25。此 IP 地址分为两部分:网络地址和主机地址。网络地址标识设备连接到的网络,而主机地址标识该网络上的特定设备。

IP addresses are essential for devices to communicate with each other over a network. Without IP addresses, devices would not be able to identify each other and send data packets. IP addresses can be assigned manually or automatically through a protocol called Dynamic Host Configuration Protocol (DHCP).
IP 地址对于设备通过网络相互通信至关重要。如果没有 IP 地址,设备将无法相互识别并发送数据包。IP 地址可以通过称为动态主机配置协议 (DHCP) 的协议手动或自动分配。

It is important to note that IP addresses can be either IPv4 or IPv6. IPv4 addresses are the most commonly used and are composed of 32 bits, while IPv6 addresses are composed of 128 bits and are used to accommodate the growing number of devices connected to the internet.
需要注意的是,IP 地址可以是 IPv4 或 IPv6。IPv4 地址是最常用的,由 32 位组成,而 IPv6 地址由 128 位组成,用于容纳越来越多的连接到互联网的设备。

What is a Subnet Mask? 什么是子网掩码?

A subnet mask is a 32-bit number that is used to divide an IP address into two parts: the network address and the host address. It determines which part of the IP address is the network portion and which part is the host portion. The subnet mask is represented in the same format as an IP address and is applied bitwise to the IP address to determine the network address.
子网掩码是一个 32 位数字,用于将 IP 地址分为两部分:网络地址和主机地址。它确定 IP 地址的哪一部分是网络部分,哪一部分是主机部分。子网掩码以与 IP 地址相同的格式表示,并按位应用于 IP 地址以确定网络地址。

Subnet masks are commonly used in computer networking to create smaller subnetworks within a larger network. This allows for better organization and management of network resources. For example, a company may use subnetting to separate different departments or teams onto different subnetworks.
子网掩码通常用于计算机网络中,用于在较大的网络中创建较小的子网。这样可以更好地组织和管理网络资源。例如,公司可以使用子网划分将不同的部门或团队分隔到不同的子网上。

See also Broadcast Domain vs Collision Domain

The subnet mask is also used in conjunction with the IP address to determine if two devices are on the same network or not. If the network portion of the IP address and subnet mask match, then the devices are on the same network and can communicate directly with each other. If they do not match, then the devices are on different networks and communication must go through a router or gateway.
子网掩码还与 IP 地址结合使用,以确定两个设备是否位于同一网络上。如果 IP 地址和子网掩码的网络部分匹配,则设备位于同一网络上,可以直接相互通信。如果它们不匹配,则设备位于不同的网络上,并且通信必须通过路由器或网关进行。

What is a Wildcard Mask? 什么是通配符掩码?

A wildcard mask, also known as an inverse mask, is a 32-bit number that is used to specify a range of network addresses. A wildcard mask is used in conjunction with an IP address or subnet mask to identify a particular group of devices on a network. It is represented in the same format as an IP address and is applied bitwise to the IP address to determine which bits are “wildcard” bits that can match any value.
通配符掩码(也称为反向掩码)是一个 32 位数字,用于指定网络地址范围。通配符掩码与 IP 地址或子网掩码结合使用,以标识网络上的特定设备组。它以与 IP 地址相同的格式表示,并按位应用于 IP 地址,以确定哪些位是可以匹配任何值的“通配符”位。

Wildcard masks are commonly used in access control lists (ACLs) to define which network traffic should be allowed or denied. By using a wildcard mask, network administrators can define a range of IP addresses or subnets that should be included or excluded from the ACL. This allows for more granular control over network traffic and helps to improve network security. However, it is important to use wildcard masks correctly, as incorrect usage can result in unintended consequences such as blocking legitimate network traffic or allowing unauthorized access to sensitive resources.
通配符掩码通常用于访问控制列表 (ACL) 中,用于定义应允许或拒绝哪些网络流量。通过使用通配符掩码,网络管理员可以定义应包含在 ACL 中或从中排除的 IP 地址或子网范围。这样可以对网络流量进行更精细的控制,并有助于提高网络安全性。但是,正确使用通配符掩码非常重要,因为不正确的使用可能会导致意想不到的后果,例如阻止合法网络流量或允许未经授权访问敏感资源。

Differences between Subnet Mask and Wildcard Mask 子网掩码和通配符掩码之间的差异

The main difference between subnet masks and wildcard masks is their purpose. A subnet mask is used to divide an IP address into two parts, while a wildcard mask is used to specify a range of network addresses. Additionally, subnet masks are used in conjunction with a network address to determine the host address, while wildcard masks are used in conjunction with an IP address or subnet mask to identify a particular group of devices on a network.
子网掩码和通配符掩码之间的主要区别在于它们的用途。子网掩码用于将 IP 地址分为两部分,而通配符掩码用于指定网络地址范围。此外,子网掩码与网络地址结合使用以确定主机地址,而通配符掩码与 IP 地址或子网掩码结合使用以标识网络上的特定设备组。

The Purpose of Subnetting 子网划分的目的

The purpose of subnetting is to divide a larger network into smaller subnetworks, allowing for more efficient use of IP addresses and better network management. Subnetting also enhances network security by enabling finer control over traffic flow and access control.
子网划分的目的是将较大的网络划分为较小的子网,从而更有效地使用 IP 地址并更好地管理网络。子网划分还通过实现对流量流和访问控制的更精细控制来增强网络安全性。

See also IPv4 vs IPv6

The Purpose of Wildcard Masks 通配符掩码的用途

The purpose of wildcard masks is to simplify network configuration by allowing administrators to specify a range of network addresses using a single value. This makes it easier to manage access control lists (ACLs) and other network policies. Wildcard masks can also be used to identify groups of devices based on their IP address or subnet mask.
通配符掩码的目的是允许管理员使用单个值指定网络地址范围,从而简化网络配置。这样可以更轻松地管理访问控制列表 (ACL) 和其他网络策略。通配符掩码还可用于根据设备的 IP 地址或子网掩码来识别设备组。

How to Calculate a Subnet Mask 如何计算子网掩码

To calculate a subnet mask, you need to determine how many bits are used for the network portion of the IP address. This is typically done by examining the subnet length, which can range from 1 to 32 bits. For example, a subnet length of 24 bits corresponds to a subnet mask of 255.255.255.0. To calculate the subnet mask for a given subnet length, you can use the following formula:
要计算子网掩码,您需要确定 IP 地址的网络部分使用了多少位。这通常是通过检查子网长度来完成的,子网长度的范围可以从 1 位到 32 位。例如,24 位的子网长度对应于 255.255.255.0 的子网掩码。要计算给定子网长度的子网掩码,可以使用以下公式:

subnet mask = 2^(32-subnet length) - 1

How to Calculate a Wildcard Mask 如何计算通配符掩码

To calculate a wildcard mask, you need to determine which bits in the IP address are “wildcard” bits. This is typically done by examining the subnet mask or network address. The wildcard mask is then obtained by taking the bitwise complement of the subnet mask or network address. For example, a subnet mask of 255.255.255.0 corresponds to a wildcard mask of 0.0.0.255.
要计算通配符掩码,您需要确定 IP 地址中的哪些位是“通配符”位。这通常是通过检查子网掩码或网络地址来完成的。然后,通过对子网掩码或网络地址的按位补码进行补码来获取通配符掩码。例如,子网掩码 255.255.255.0 对应于通配符掩码 0.0.0.255。

How to Use Subnet and Wildcard Masks in Networking 如何在网络中使用子网和通配符掩码

Subnet and wildcard masks are used in networking to configure routing, access control, and other network policies. Subnet masks are used to divide IP addresses into subnetworks, while wildcard masks are used to specify groups of IP addresses. These masks can be used in conjunction with ACLs, routing protocols, and other network services to control traffic flow and access control.
子网和通配符掩码在网络中用于配置路由、访问控制和其他网络策略。子网掩码用于将 IP 地址划分为子网,而通配符掩码用于指定 IP 地址组。这些掩码可以与 ACL、路由协议和其他网络服务结合使用,以控制流量和访问控制。

Advantages and Disadvantages of Subnetting 子网划分的优点和缺点

One advantage of subnetting is that it allows for more efficient use of IP addresses, which can be critical in large networks. Subnetting also enhances network security by enabling finer control over traffic flow and access control. However, subnetting can also add complexity and administrative overhead to network management, particularly in smaller networks.
子网划分的一个优点是它允许更有效地使用 IP 地址,这在大型网络中可能至关重要。子网划分还通过实现对流量流和访问控制的更精细控制来增强网络安全性。但是,子网划分也会增加网络管理的复杂性和管理开销,尤其是在较小的网络中。

Advantages and Disadvantages of Using Wildcard Masks 使用通配符掩码的优点和缺点

One advantage of using wildcard masks is that they can simplify network configuration by allowing administrators to specify a range of network addresses using a single value. This makes it easier to manage ACLs and other network policies. However, wildcard masks can also be difficult to understand and use, particularly for less experienced network administrators.
使用通配符掩码的一个优点是,它们允许管理员使用单个值指定网络地址范围,从而简化网络配置。这样可以更轻松地管理 ACL 和其他网络策略。但是,通配符掩码也可能难以理解和使用,特别是对于经验不足的网络管理员。

See also Master CCNA Routing Concepts with Practical Techniques

Common Applications of Subnetting 子网划分的常见应用

Subnetting is commonly used in large networks to improve network performance, enhance network security, and facilitate network management. Subnetting allows for more efficient use of IP addresses, helps prevent network congestion, and enables finer control over traffic flow and access control.
子网划分通常用于大型网络中,用于提高网络性能、增强网络安全性并促进网络管理。子网划分可以更有效地使用 IP 地址,有助于防止网络拥塞,并能够对流量和访问控制进行更精细的控制。

Common Applications of Wildcard Masks 通配符掩码的常见应用

Wildcard masks are commonly used in network security, particularly in ACLs and other network policies. Wildcard masks can be used to specify groups of IP addresses, allowing administrators to control access and traffic flow to specific devices or subnetworks. Wildcard masks are also used in routing protocols and other network services to facilitate network configuration and management.
通配符掩码通常用于网络安全,尤其是在 ACL 和其他网络策略中。通配符掩码可用于指定 IP 地址组,使管理员能够控制对特定设备或子网的访问和流量。通配符掩码还用于路由协议和其他网络服务,以方便网络配置和管理。

Best Practices for Configuring Subnet and Wildcard Masks 配置子网和通配符掩码的最佳实践

When configuring subnet and wildcard masks, it is important to follow best practices to ensure proper network operation and security. Some best practices include: using the correct subnet and wildcard masks for the network topology, avoiding overlapping subnets, and regularly reviewing and updating network policies to ensure they are still relevant and effective.
配置子网和通配符掩码时,请务必遵循最佳实践,以确保正确的网络操作和安全性。一些最佳实践包括:对网络拓扑使用正确的子网和通配符掩码,避免重叠的子网,并定期审查和更新网络策略,以确保它们仍然相关且有效。

Troubleshooting Common Issues with Subnet and Wildcard Masks 排查子网和通配符掩码的常见问题

Despite best efforts, issues with subnet and wildcard masks can still occur. Some common issues include: misconfigured subnet/wildcard masks, overlapping subnets, and incorrect addressing. To troubleshoot these issues, network administrators can use tools like ping and traceroute to identify network connectivity issues, review the network topology for misconfigurations, and examine network policies to ensure they are properly configured.
尽管尽了最大努力,但仍可能出现子网和通配符掩码问题。一些常见问题包括:子网/通配符掩码配置错误、子网重叠和寻址错误。要解决这些问题,网络管理员可以使用 ping 和 traceroute 等工具来识别网络连接问题,检查网络拓扑是否存在配置错误,并检查网络策略以确保它们已正确配置。

Future Trends in IP Addressing and Network Masking Techniques IP 寻址和网络掩码技术的未来趋势

As networks continue to evolve and expand, the need for more efficient IP addressing and network masking techniques will become increasingly important. One trend that is emerging is the use of IPv6, which provides significantly more available IP addresses than IPv4. Additionally, new masking techniques and tools are being developed to improve network performance and security, including network virtualization and software-defined networking.
随着网络的不断发展和扩展,对更高效的 IP 寻址和网络屏蔽技术的需求将变得越来越重要。正在出现的一个趋势是使用 IPv6,它提供的可用 IP 地址比 IPv4 多得多。此外,正在开发新的屏蔽技术和工具,以提高网络性能和安全性,包括网络虚拟化和软件定义网络。

As networks continue to grow and become more complex, subnet masks and wildcard masks will remain important tools for network management and security. By understanding these tools and best practices for their configuration, network administrators can ensure proper network operation and security in the face of evolving technology and network demands.
随着网络的不断发展和变得越来越复杂,子网掩码和通配符掩码仍将是网络管理和安全的重要工具。通过了解这些工具及其配置的最佳实践,网络管理员可以确保在面对不断发展的技术和网络需求时正常运行和安全性。


via:

  • Subnet Mask vs Wildcard Mask – CCNA-Classes

    https://ccna-classes.com/ccna-study-resources/subnet-mask-vs-wildcard-mask/

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 使用s3cmd 2.x 与 Cyberduck 管理在 DigitalOcean Spaces 对象存储中的数据
  • 全网最适合入门的面向对象编程教程:30 Python的内置数据类型-object根类
  • 缓存策略自定义:Laravel应用性能优化秘籍
  • 虚拟机(CentOS7)安装jenkins
  • ubuntu安装nginx以及php的部署
  • STL—vector—模拟实现【深度理解vector】【模拟实现vector基本接口】
  • WebLogic: CVE-2020-14882/14883【getshell】
  • C语言自定义类型结构体与位段超详解
  • 如果一台Riscv FreeBSD系统没有pkg怎么办?
  • 基于深度学习的自动化模型设计
  • VS Code设置C++编译器路径
  • 《巴菲特的伯克希尔崛起》
  • 学Python可少不了项目练手,这8个小项目有趣又实用,小白也能做出来_python练手项目,python教程
  • 域环境的搭建 内网学习不会搭建环境???
  • 智慧水务项目(一)django(drf)+angular 18 通过pycharm建立项目
  • (三)从jvm层面了解线程的启动和停止
  • @jsonView过滤属性
  • 【个人向】《HTTP图解》阅后小结
  • 2018以太坊智能合约编程语言solidity的最佳IDEs
  • js算法-归并排序(merge_sort)
  • SpiderData 2019年2月25日 DApp数据排行榜
  • ViewService——一种保证客户端与服务端同步的方法
  • Vue 动态创建 component
  • vue学习系列(二)vue-cli
  • XML已死 ?
  • 翻译 | 老司机带你秒懂内存管理 - 第一部(共三部)
  • 反思总结然后整装待发
  • 实战|智能家居行业移动应用性能分析
  • 腾讯大梁:DevOps最后一棒,有效构建海量运营的持续反馈能力
  • 吴恩达Deep Learning课程练习题参考答案——R语言版
  • 在Docker Swarm上部署Apache Storm:第1部分
  • ionic异常记录
  • linux 淘宝开源监控工具tsar
  • raise 与 raise ... from 的区别
  • Spring第一个helloWorld
  • 你学不懂C语言,是因为不懂编写C程序的7个步骤 ...
  • ​Z时代时尚SUV新宠:起亚赛图斯值不值得年轻人买?
  • # windows 运行框输入mrt提示错误:Windows 找不到文件‘mrt‘。请确定文件名是否正确后,再试一次
  • #565. 查找之大编号
  • #C++ 智能指针 std::unique_ptr 、std::shared_ptr 和 std::weak_ptr
  • #LLM入门|Prompt#3.3_存储_Memory
  • #QT 笔记一
  • $(selector).each()和$.each()的区别
  • (12)Hive调优——count distinct去重优化
  • (附源码)springboot青少年公共卫生教育平台 毕业设计 643214
  • (十六)一篇文章学会Java的常用API
  • (原创) cocos2dx使用Curl连接网络(客户端)
  • (终章)[图像识别]13.OpenCV案例 自定义训练集分类器物体检测
  • (转)Unity3DUnity3D在android下调试
  • **登录+JWT+异常处理+拦截器+ThreadLocal-开发思想与代码实现**
  • .h头文件 .lib动态链接库文件 .dll 动态链接库
  • .NET Compact Framework 多线程环境下的UI异步刷新
  • .NET Core 中的路径问题
  • .NET/MSBuild 中的发布路径在哪里呢?如何在扩展编译的时候修改发布路径中的文件呢?
  • .NETCORE 开发登录接口MFA谷歌多因子身份验证