通过IP地址和子网掩码与运算计算相关地址
2008-10-24 18:56
507 查看
通过IP地址和子网掩码与运算计算相关地址 知道ip地址和子网掩码后可以算出: 1、 网络地址 2、 广播地址 3、 地址范围 4、 本网有几台主机 例1:下面例子IP地址为192·168·100·5 子网掩码是255·255·255·0。算出网络地址、广播地址、地址范围、主机数。 一)分步骤计算 1) 将IP地址和子网掩码换算为二进制,子网掩码连续全1的是网络地址,后面的是主机地址。 虚线前为网络地址,虚线后为主机地址 1) 将IP地址和子网掩码换算为二进制,子网掩码连续全1的是网络地址,后面的是主机地址。 虚线前为网络地址,虚线后为主机地址 screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www.cnpaf.net/Files/BeyondPic/385403.jpg');}" onmousewheel="return imgzoom(this);" alt=""> 2)IP地址和子网掩码进行与运算,结果是网络地址 screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www.cnpaf.net/Files/BeyondPic/385405.jpg');}" onmousewheel="return imgzoom(this);" alt=""> 3) 将上面的网络地址中的网络地址部分不变,主机地址变为全1,结果就是广播地址。 screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www.cnpaf.net/Files/BeyondPic/385407.jpg');}" onmousewheel="return imgzoom(this);" alt=""> 4) 地址范围就是含在本网段内的所有主机 网络地址+1即为第一个主机地址,广播地址-1即为最后一个主机地址,由此可以看出 地址范围是: 网络地址+1 至 广播地址-1 本例的网络范围是:192·168·100·1 至 192·168·100·254 也就是说下面的地址都是一个网段的。 192·168·100·1、192·168·100·2 。。。 192·168·100·20 。。。 192·168·100·111 。。。 192·168·100·254 5) 主机的数量 主机的数量=2二进制的主机位数-2 减2是因为主机不包括网络地址和广播地址。本例二进制的主机位数是8位。 主机的数量=28-2=254 二)总体计算 我们把上边的例子合起来计算一下过程如下: screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www.cnpaf.net/Files/BeyondPic/385417.jpg');}" onmousewheel="return imgzoom(this);" alt=""> 例2: IP地址为128·36·199·3 子网掩码是255·255·240·0。算出网络地址、广播地址、地址范围、主机数。 1) 将IP地址和子网掩码换算为二进制,子网掩码连续全1的是网络地址,后面的是主机地址, 虚线前为网络地址,虚线后为主机地址 screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www.cnpaf.net/Files/BeyondPic/390529.jpg');}" onmousewheel="return imgzoom(this);" alt=""> 2)IP地址和子网掩码进行与运算,结果是网络地址 screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www.cnpaf.net/Files/BeyondPic/390531.jpg');}" onmousewheel="return imgzoom(this);" alt=""> 3)将运算结果中的网络地址不变,主机地址变为1,结果就是广播地址。 screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window/nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www.cnpaf.net/Files/BeyondPic/390533.jpg');}" onmousewheel="return imgzoom(this);" alt=""> 4) 地址范围就是含在本网段内的所有主机 网络地址+1即为第一个主机地址,广播地址-1即为最后一个主机地址,由此可以看出 地址范围是: 网络地址+1 至 广播地址-1 本例的网络范围是:128·36·192·1 至 128·36·207·254 5) 主机的数量 主机的数量=2二进制位数的主机-2 主机的数量=212-2=4094 减2是因为主机不包括网络地址和广播地址。 从上面两个例子可以看出不管子网掩码是标准的还是特殊的,计算网络地址、广播地址、地址数时只要把地址换算成二进制,然后从子网掩码处分清楚连续1以前的是网络地址,后是主机地址进行相应计算即可。 |
相关文章推荐
- 通过IP地址和子网掩码与运算计算相关地址
- 通过IP地址和子网掩码与运算计算相关地址
- 通过IP地址和子网掩码与运算计算相关地址
- 通过IP地址和子网掩码与运算计算相关地址
- 通过IP地址和子网掩码与运算计算相关地址
- 通过IP地址和子网掩码与运算计算相关地址
- 通过IP地址和子网掩码与运算计算相关地址
- 通过IP地址和子网掩码与运算计算相关地址
- C#根据IP地址和子网掩码计算广播地址
- 通过IP地址和子网掩码计算主机数
- 通过主机IP地址和子网掩码计算主机网络号
- 根据ip地址和子网掩码计算网段地址和广播地址(原创)
- 通过IP地址和子网掩码计算主机数
- 给出IP地址和子网掩码,如何计算该网段的广播地址
- C#根据IP地址和子网掩码计算广播地址
- 通过IP地址和子网掩码计算相关地址
- 彻底明白IP地址——计算相关地址
- 彻底明白IP地址――计算相关地址
- 如何将一个网络分为两个子网、如何通过已知IP和子网掩码计算其同一网段的主机IP
- 使用php根据起始ip地址和掩码 计算广播地址(网段结束地址)