IPv4 子网划分
- 每个子网的主机数
- 2(32 − prefix) − 2 (/31: 2, /32: 1)
- 块大小
- 256 − (mask octet)
- 网络地址
- IP AND 掩码
- 广播地址
- IP OR (NOT 掩码):主机位全部置 1
- 借用 n 位得到的子网数
- 2n
公式表、每个专题的关键方法步骤和 6 道练习题,完整解答附在最后。
网络 10.20.96.0/20 被划分为前缀为 /23 的等大子网。共有多少个子网 N?
一台主机的地址为 172.20.207.5/19。其所在子网广播地址的第三个八位组 x 是多少?
哪一个前缀能同时汇总 192.168.0.0/24 和 192.168.1.0/24?
在具有冗余交换机链路的网络中,哪种机制可以防止广播环路?
8 位模式 0100 1110 以补码形式存储一个有符号整数。它的十进制值 N 是多少?
某系统要为 2366 个项目中的每一个分配一个长度相同的独立二进制编码。最少需要多少位 b?
答案: N = 8
IPv4 subnetting: an address has 32 bits. The prefix /p says how many leading bits identify the network; the remaining 32 − p bits number the hosts. A subnet has 2³²⁻ᵖ addresses, but the first (network address) and last (broadcast address) cannot be given to hosts, so 2³²⁻ᵖ − 2 hosts fit. Exceptions: a /31 (point-to-point link, RFC 3021) uses both of its 2 addresses for hosts, and a /32 is one single address (a single host or a loopback).
每个 /23 子网有 29 − 2 = 510 个可用主机。
答案: x = 223
IPv4 subnetting: an address has 32 bits. The prefix /p says how many leading bits identify the network; the remaining 32 − p bits number the hosts. A subnet has 2³²⁻ᵖ addresses, but the first (network address) and last (broadcast address) cannot be given to hosts, so 2³²⁻ᵖ − 2 hosts fit. Exceptions: a /31 (point-to-point link, RFC 3021) uses both of its 2 addresses for hosts, and a /32 is one single address (a single host or a loopback).
答案: D · 192.168.0.0/23
0 和 1 在第三个八位组中除最后一位外所有位都相同,因此从 192.168.0.0 开始、少一位的前缀(/23)恰好覆盖两者。
答案: D · 生成树协议(Spanning Tree Protocol)
STP 选举根桥并阻塞冗余路径,当活动链路故障时再解除阻塞。
答案: N = 78
位置计数制:每个数位的值等于该数字乘以基数的某次幂。二进制各位的权为 1、2、4、8、16、……;十六进制为 1、16、256、……,A–F 代表 10–15。在 8 位补码中,最左边一位的权是 −128 而不是 +128,负数就是这样存储的。
其余各位保持正常的正权值。
答案: b = 12 bit
位置计数制:每个数位的值等于该数字乘以基数的某次幂。二进制各位的权为 1、2、4、8、16、……;十六进制为 1、16、256、……,A–F 代表 10–15。在 8 位补码中,最左边一位的权是 −128 而不是 +128,负数就是这样存储的。
ExamProblems · examproblems.com/courses/computer-networks