检查虚拟机和本机网络是否在同一网段
检查虚拟机和本机网络是否在同一网段例一Ip地址:192.168.1.1子网掩码:255.255.255.0(and运算)1100000010101000 00000001 000000011111111111111111 11111111 000000001100000010101000 00000001 00000000192.168.2.1255.255.255.0(and运算)192.168
检查虚拟机和本机网络是否在同一网段
例一
Ip地址:192.168.1.1 子网掩码:255.255.255.0 (and运算)
11000000 10101000 00000001 00000001
11111111 11111111 11111111 00000000
11000000 10101000 00000001 00000000
192.168.2.1 255.255.255.0 (and运算)
192.168.2.1
11000000 10101000 00000010 00000001
255.255.255.0
11111111 11111111 11111111 00000000
and运算结果:
11000000 10101000 00000010 00000000
192.168.1.1和192.168.2.1不在同一网段
例二
192.168.43.13 255.255.255.0 (and运算)
192.168.43.13:
11000000 10101000 11010100 00001101
255.255.255.0 :
11111111 11111111 11111111 00000000
and运算结果:
11000000 10101000 11010100 00000000
192.168.56.1 255.255.255.0 (and运算)
192.168.56.1:
11000000 10101000 00011100 00000001
255.255.255.0:
11111111 11111111 11111111 00000000
and运算结果:
11000000 10101000 00011100 00000000
11000000 10101000 11010100 00000000
和11000000 10101000 00011100 00000000不同
所以192.168.43.13和192.168.56.1不在同一网段
例三
192.168.5.13 255.255.255.0 (and运算)
192.168.5.13:
11000000 10101000 00000101 00001101
255.255.255.0:
11111111 11111111 11111111 00000000
and运算结果:
11000000 10101000 00000101 00000000
192.168.5.38 255.255.255.0 (and运算)
192.168.5.38:
11000000 10101000 00000101 00100110
255.255.255.0:
11111111 11111111 11111111 00000000
and运算结果:
11000000 10101000 00000101 00000000
11000000 10101000 00000101 00000000
和11000000 10101000 00000101 00000000相同
所以192.168.43.13和192.168.56.1在同一网段
更多推荐
所有评论(0)