在QQ聊天中,有网友丢了一道网工的IP地址问题如下:

对一道网工IP地址题的看法_QQ聊天第57题这样来看:

220.17.0.0~220.17.7.0一共有8个子网,快速算一下:256-8=248,所以掩码是255.255.248.0,即

220.17.0.0/21,第57题选B


第57题也可以这么来算:

220.17.0.0化为二进制为:11011100.00010001.00000000.00000000

220.17.7.0化为二进制为:11011100.00010001.00000111.00000000

从左向右数,找到不同的部分就是主机位,一共3+8=11,网络位有32-11=21位,所以是220.17.0.0/21


关键在第58题,也是很多人觉得奇怪的答案

先说教科书上的解法,由于去头掐尾那就有2^11 - 2*2^3 =  2032个主机地址,选A


再说下实际中的用法,在华为设备中用到两台路由器来做实验

R1和R2通过G0/0/0直连,下面是关键配置:

[R1]dis cur int g0/0/0

[V200R003C00]

#

interface GigabitEthernet0/0/0

 ip address 220.17.0.255 255.255.248.0 

#

return


[R2-GigabitEthernet0/0/0]dis th

[V200R003C00]

#

interface GigabitEthernet0/0/0

 ip address 220.17.7.0 255.255.248.0 

#


[R1]ping 220.17.7.0

  PING 220.17.7.0: 56  data bytes, press CTRL_C to break

    Reply from 220.17.7.0: bytes=56 Sequence=1 ttl=255 time=30 ms

    Reply from 220.17.7.0: bytes=56 Sequence=2 ttl=255 time=20 ms

    Reply from 220.17.7.0: bytes=56 Sequence=3 ttl=255 time=10 ms

    Reply from 220.17.7.0: bytes=56 Sequence=4 ttl=255 time=20 ms

    Reply from 220.17.7.0: bytes=56 Sequence=5 ttl=255 time=10 ms


  --- 220.17.7.0 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 10/18/30 ms


[R1]dis arp

IP ADDRESS      MAC ADDRESS     EXPIRE(M) TYPE        INTERFACE   ×××-INSTANCE 

                                          VLAN/CEVLAN PVC                      

------------------------------------------------------------------------------

220.17.0.255    00e0-fcbf-6fae            I -         GE0/0/0

220.17.7.0      00e0-fcbb-4fa6  19        D-0         GE0/0/0

------------------------------------------------------------------------------

Total:2         Dynamic:1       Static:0     Interface:1    

尽管按教科书的看法,尽管它们是C类地址,又是网络地址和广播地址,但在dis arp的时候,路由器认为它们是同一个网段上的,可以看到它们是相互通信的


在这里抛砖引玉了