您好,欢迎访问三七文档
配置IP地址完成本章的学习后,您可以完成下面的任务:•分配IP地址,区分地址级别,网络部分和主机部分•给定IP地址和子网掩码,计算相应的子网•根据给定的网络地址和子网掩码配置IP地址•把主机名和一个IP地址做一个映射•利用网络工具发现网络中路由器的IP地址目标TCP/IP地址概述•唯一的地址分配机制保证通讯的可靠性•根据所处的位置选择路径•用地址代表网络设备所处的位置TCP/IP地址入门UNIX主机UNIX主机公司A公司B地址分配32BitsNetworkHost8Bits172.16.122.2048Bits8Bits8Bits•ClassA:•ClassB:•ClassC:•ClassD:用于组播(multicast)•ClassE:用于研究N=网络号H=主机号IP地址分配NHHHNNHHNNNH不同IP地址Bit位的区别1724ClassA:#Bits114161ClassB:#Bits121811ClassC:#Bits0network#host#1network#host#01network#host#10识别IP地址的类别HighOrderBitsOctetinDecimalAddressClass0101101-126128-191192-223ABC练习:IP地址的级别AddressClassNetworkHost10.2.1.1128.63.2.100201.222.5.64192.6.141.2130.113.64.16256.241.201.10练习答案:IP地址的级别AddressClassNetworkHost10.2.1.1128.63.2.100201.222.5.64192.6.141.2130.113.64.16256.241.201.10ABCCBNonexistent10.0.0.0128.63.0.0201.222.5.0192.6.141.0130.113.0.00.2.1.10.0.2.1000.0.0.640.0.0.20.0.64.16配置IP地址主机地址172.16.2.1172.16.3.10172.16.12.12IP:172.16.2.110.1.1.110.250.8.1110.180.30.118IP:10.6.24.2E0E1172.161212NetworkHost..NetworkInterface172.16.0.010.0.0.0E0E1RoutingTable•Network172.16.0.0172.16.0.0无子网时的地址分配•Network172.16.0.0有子网时的地址分配172.16.1.0172.16.2.0172.16.3.0172.16.4.0子网地址172.16.2.200172.16.2.2172.16.2.160IP:172.16.2.1172.16.3.5172.16.3.100172.16.3.150IP:172.16.3.1E0E1172.162160NetworkHost..NetworkInterface172.16.2.0172.16.3.0E0E1NewRoutingTableSubnet子网掩码1721600255255002552552550IPAddressDefaultSubnetMask8-bitSubnetMaskNetworkHostUsehostbits,startingatthehighorderbitpositionNetworkHostNetworkSubnetHostIP地址的二进制和十进制表示法的对应关系10000000=12811000000=19211100000=22411110000=24011111000=24811111100=25211111110=25411111111=2551286432168421练习:子网掩码AddressSubnetMaskClassSubnet172.16.2.1010.6.24.2010.30.36.12255.255.255.0255.255.0.0255.255.255.0练习(答案):子网掩码AddressSubnetMaskClassSubnet172.16.2.1010.6.24.2010.30.36.12255.255.255.0255.255.0.0255.255.255.0BAA172.16.2.010.6.0.010.30.36.0规划IP子网Othersubnets20subnets5hostspersubnetClassCaddress:201.222.5.0201.222.5.16201.222.5.32201.222.5.48IPHostAddress:172.16.2.120SubnetMask:255.255.255.0•SubnetAddress=172.16.2.0•HostAddresses=172.16.2.1-72.16.2.254•BroadcastAddress=172.16.2.255•EightbitsofsubnettingNetworkSubnetHost1721620172.16.2.120:255.255.255.0:1010110011111111Subnet:10101100000100000001000011111111000000100000001011111111011110010000000000000000B类子网规划举例IPHostAddress:201.222.5.121SubnetMask:255.255.255.248NetworkSubnetHost2012225120201.222.5.121:1100100111111111Subnet:11001001110111101101111011111111000001010000010111111111011110011111100001111000255.255.255.248:C类子网规划举例•SubnetAddress=201.222.5.120•HostAddresses=201.222.5.121-01.222.5.126•BroadcastAddress=201.222.5.127•FiveBitsofSubnetting广播地址172.16.1.0172.16.2.0172.16.3.0172.16.4.0172.16.3.255(Directedbroadcast)255.255.255.255(Localnetworkbroadcast)X练习:广播地址AddressClassSubnetBroadcast201.222.10.60255.255.255.248SubnetMask15.16.193.6255.255.248.0128.16.32.13255.255.255.252153.50.6.27255.255.255.128练习(答案):广播地址AddressClassSubnetBroadcast201.222.10.60255.255.255.248C201.222.10.63201.222.10.56SubnetMask15.16.193.6255.255.248.0A15.16.199.25515.16.192.0128.16.32.13255.255.255.252B128.16.32.15128.16.32.12153.50.6.27255.255.255.128B153.50.6.127153.50.6.0地址子网化的例子CiscoACiscoBE0S0E0S0To0CiscoAE0:172.16.2.1S0:172.16.1.1S0:172.16.1.2E0:144.254.4.1To0:144.254.16.1CiscoBMask255.255.255.0Subnet172.16.2.0172.16.1.0172.16.1.0144.254.16.0144.254.4.0MaskSubnet255.255.255.0255.255.255.0255.255.252.0255.255.252.0TokenRing配置IP地址Router(config-if)#•分配一个IP地址和子网掩码•在端口上运行IP进程ipaddressip-addresssubnet-maskRouter(config-line)#ipnetmask-format{bitcount|decimal|hexadecimal}•在端口配置模式下配置网络地址的表示格式Router#termipnetmask-format{bitcount|decimal|hexadecimal}•配置网络地址的表示格式Router(config)#•给主机名静态的指定一个IP地址•可以有多个IP地址与主机名对应主机名iphostname[tcp-port-number]address[address]iphostP1R11.0.0.52.0.0.8iphostP1R21.0.0.4•指定一个或多个主机提供从主机名到逻辑地址的映射服务Router(config)#配置名字服务器ipname-serverserver-address1[[server-address2]...server-address6]•路由器缺省启用DNS服务•关闭名字服务Router(config)#Router(config)#名字系统ipdomain-lookupnoipdomain-lookup显示主机名Router#showhostsDefaultdomainisnotsetName/addresslookupusesstaticmappingsHostFlagsAgeTypeAddress(es)P1R1(perm,OK)5IP144.253.100.200133.3.13.2133.3.5.1P2R1(perm,OK)5IP144.253.100.201153.50.3.2153.50.5.6P2R2(perm,OK)**IP128.45.17.4153.50.3.200153.50.34.17P2R3(perm,OK)**IP172.26.40.11153.50.5.7153.50.34.1--More--检验配置的地址ApplicationTransportInternetNetworkInterfaceHardwareTelnetICMPtracepingApplicationTransportInternetNetworkInterfaceHardwareTelnetICMPtracetelnettrace•检查IP网络的连通性简化的PingRouterping172.16.101.1Typeescapesequencetoabort.Sending5,100-byteICMPEchosto172.16.101.1,timeoutis2seconds:.!!!!Successrateis80percent,round-tripmin/avg/max=6/6/6msRouter•很多协议都支持ping扩展的PingRouter#pingProtocol[ip]:TargetIPaddress:192.168.101.162Repeatcount[5]:Datagramsize[100]:Timeoutinseconds[2]:Extendedcommands[n]:ySourceaddress:Typeofservice[0]:SetDFbitinIPheader?[no]:yesDatapattern[0xABCD]:Loose,Strict,Record,Timestamp,Verbose[none]:Sweeprangeofsizes[n]:Typeescapesequencetoabort.Sending5,100-byteICMPEchosto192.168.101.162,timeoutis2secon
本文标题:配置IP地址
链接地址:https://www.777doc.com/doc-2012997 .html