1、 Configured from console by consoleR1#copy running-config startup-configDestination filename startup-config?Building configuration.OKR1#configure tR1(config)#interface fastEthernet 0/0R1(config-if)#ip address 192.168.1.254 255.255.255.0R1(config-if)#no shutdown%LINK-5-CHANGED: Interface FastEthernet
2、0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR1(config-if)#exitR1(config)#interface serial 2/0R1(config-if)#ip address 202.96.1.1 255.255.255.0R1(config-if)#clock rate 64000R1(config)#router ripR1(config-router)#version 2R1(config-router
3、)#no auto-summaryR1(config-router)#network 202.96.1.0R1(config)#ip nat pool TIANXUAN 202.96.1.3 202.96.1.100 netmask 255.255.255.0R1(config)#access-list 1 permit 192.168.1.0 0.0.0.255R1(config)#ip nat inside source list 1 pool TIANXUANR1(config-if)#ip nat insideR1(config-if)#ip nat outsideR1(config)
4、#ZR1#show ip routeCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS
5、 level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static routeGateway of last resort is not set 2.0.0.0/24 is subnetted, 1 subnetsR 2.2.2.0 120/1 via 202.96.1.2, 00:00:15, Serial2/0C 192.168.1.0/24 is directly connec
6、ted, FastEthernet0/0 202.96.1.0/24 is directly connected, Serial2/0R1#show ip nat statisticsTotal translations: 2 (0 static, 2 dynamic, 0 extended)Outside Interfaces: Serial2/0Inside Interfaces: FastEthernet0/0Hits: 22 Misses: 2Expired translations: 0Dynamic mappings:- Inside Sourceaccess-list 1 poo
7、l TIANXUAN refCount 2pool TIANXUAN: netmask 255.255.255.0 start 202.96.1.3 end 202.96.1.100 type generic, total addresses 98 , allocated 2 (2%), misses 0R1#show ip nat translationsPro Inside global Inside local Outside local Outside global- 202.96.1.3 192.168.1.1 - - 202.96.1.4 192.168.1.2 202.96.1.
8、5 192.168.1.3 202.96.1.6 192.168.1.4R1#debug ip natIP NAT debugging is onR1#NAT: s=192.168.1.1-202.96.1.6, d=2.2.2.25NAT*: s=2.2.2.2, d=202.96.1.6-192.168.1.15二、R2配置:Router(config)#hostname R2R2(config)#R2(config)#endR2#copy running-config startup-configR2(config)#interface serial 3/0R2(config-if)#i
9、p address 202.96.1.2 255.255.255.0R2(config-if)#no shutdownR2(config)#interface loopback 0R2(config-if)#ip address 2.2.2.2 255.255.255.0R2(config)#router ripR2(config-router)#version 2R2(config-router)#no auto-summaryR2(config-router)#network 2.0.0.0R2(config-router)#network 202.96.1.0R2#ping 2.2.2.
10、2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:!Success rate is 100 percent (5/5), round-trip min/avg/max = 16/16/16 msR2#ping 202.96.1.1Sending 5, 100-byte ICMP Echos to 202.96.1.1, timeout is 2 seconds:Success rate is 100 percent (5/5), round-trip mi
11、n/avg/max = 31/31/32 msR2#ping 192.168.1.1Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:.Success rate is 0 percent (0/5)三、小结核心:动态地址池的IP地址应为合法地址,可能实际中不可能申请了这么多的IP地址。那就把内部本地IP映射到内部全局的一个合法IP上。R1(config)#ip nat pool TX 202.96.1.1 202.96.1.1 netmask 255.255.255.0R1(config)#ip nat in
12、side source list 1 pool TX overload /overload为参数,表示复用公用地址在打这个核心命令时,自己先参照书上先打ip nat pool TX .,之后很容易忘了在接口上申明,R1(config-if)#ip nat inside 做NAT时,心里首先就要想到接口申明.Trunk配置一、交换机SW1配置:Switch1(config)#vlan 20Switch1(config)#vlan 30Switch1(config)#interface fastEthernet 0/1Switch1(config-if)#switchport mode acces
13、sSwitch1(config-if)#switchport access vlan 20Switch1(config)#interface fastEthernet 0/2Switch1(config-if)#switchport access vlan 30Switch1#show vlanVLAN Name Status Ports- - - -1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6 Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13, Fa0/14 Fa0/15, Fa0/16, Fa0/
14、17, Fa0/18 Fa0/19, Fa0/20, Fa0/21, Fa0/22 Fa0/23, Fa0/2420 VLAN0020 Fa0/130 VLAN0030 Fa0/21002 fddi-default1003 token-ring-default1004 fddinet-default1005 trnet-defaultVLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2- - - - - - - - - - - enet 100001 1500 - 0 100020 1000301002 enet 1010021003 enet 1010031004 enet 1010041005 enet 101005Switch1(config)#interface fastEthernet 0/24Switch1(config-if)#switchport mode trunk /2950交换机只能封装dot1q ,所以无须键入switchport trunk encanpsulation dotiq Fa0/23
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2