实训分解实验
1、VLAN 及 TRUNK SW1: vlan 10!vlan 20!int f0/2 sw mo ac sw ac vl 10!int f0/3 sw mo ac sw ac vl 20!int f0/1 sw tr en dot sw mo tr ==================== 2、静态路由 R1:
hostname R1!int f0/0 ip add 10.1.1.1 255.255.255.0 no sh
!int f0/1 ip add 10.1.2.1 255.255.255.0 no sh!ip route 10.1.4.0 255.255.255.0 10.1.2.2---------------------------R2 hostname R2!int f0/0 ip add 10.1.2.2 255.255.255.0 no sh!int f0/1 ip add 10.1.3.1 255.255.255.0 no sh!ip route 10.1.1.0 255.255.255.0 10.1.2.1 ip route 10.1.4.0 255.255.255.0 10.1.3.2 =================================== R3 hostname R3!int f0/0 ip add 10.1.3.2 255.255.255.0 no sh!int f0/1 ip add 10.1.4.1 255.255.255.0 no sh!ip route 10.1.1.0 255.255.255.0 10.1.3.1 ====================== 3、ACL 4、PPP 验证(1)PPP 验证之 PAP
hostname R1!username xxx password 0 yyy!interface Serial0/0/0 ip address 10.1.1.1 255.255.255.0 encapsulation ppp ppp authentication pap ppp pap sent-username abc password 0 xyz clock rate 64000-----------------------------------------------hostname R2!username abc password 0 xyz!interface Serial0/0/0 ip address 10.1.1.2 255.255.255.0 encapsulation ppp ppp authentication pap ppp pap sent-username xxx password 0 yyy(2)PPP 验证之 CHAP hostname R1!username R2 password 0 cisco!interface Serial0/0/0 ip address 10.1.1.1 255.255.255.0 encapsulation ppp ppp authentication chap clock rate 64000 ================================== hostname R2!username R1 password 0 cisco!interface Serial0/0/0 ip address 10.1.1.2 255.255.255.0 encapsulation ppp ppp authentication chap 5、DHCP
hostname Router!ip dhcp excluded-address 10.1.1.1!ip dhcp pool xxx network 10.1.1.0 255.255.255.0 default-router 10.1.1.1 dns-server 218.2.135.1!interface FastEthernet0/0 ip address 10.1.1.1 255.255.255.0 ======================================================================== 6、单臂路由 需求:
1、主机 A 在 VLAN10 内,ip 地址为 10.1.1.2/24,网关 10.1.1.1 2、主机 B 在 vlan20 内,ip 地址为 10.1.2.2/24,网关 10.1.2.1 3、在路由器 R1 上配置单臂路由,使主机 A 和主机 B 相互通信。
路由器 R1:
hostname R1!
interface FastEthernet0/0 no ip address duplex auto speed auto!interface FastEthernet0/0.100 encapsulation dot1Q 10 ip address 10.1.1.1 255.255.255.0!interface FastEthernet0/0.200 encapsulation dot1Q 20 ip address 10.1.2.1 255.255.255.0 ============================================= 交换机 SW1 hostname SW1!!interface FastEthernet0/1 switchport mode trunk!interface FastEthernet0/2 switchport access vlan 10 switchport mode access!interface FastEthernet0/3 switchport access vlan 20 switchport mode access!--------------------------------------SW1# sh vlan b VLAN Name Status Ports----------------------------------------------------------------------------1 default active 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/17, Fa0/18, Fa0/19 Fa0/20, Fa0/21, Fa0/22, Fa0/23 Fa0/24, Gig1/1, Gig1/2 10 VLAN0010 active Fa0/2 20 VLAN0020 active Fa0/3------------------------------------------------------------------------------------------------------------------------------------主机 A:
主机 B:
-----------------------------------------------------------------------------------------------------------------------------------
NAT 配置步骤:
1、动态 NAT(1)定义内部地址 access-list 10 permit 10.1.1.0 0.0.0.255(2)定义外部地址 ip nat pool xxx 61.1.1.1 61.1.1.254 mask 255.255.255.0(3)将内部地址和外部地址关联 ip nat inside source list 10 pool xxx(4)定义内部接口和外部接口 router(config-if)#ip nat inside router(config-if)#ip nat outside 2、端口地址翻译(PAT)(1)定义内部地址 access-list 10 permit 10.1.1.0 0.0.0.255(2)将内部地址与外部接口关联 ip nat inside source list 10 interface s0/0/0 overload(3)定义内部接口和外部接口 router(config-if)#ip nat inside router(config-if)#ip nat outside 3、静态 NAT ip nat inside source static tcp 10.1.1.254 80 61.1.1.1 80 内网的主机 10.1.1.254 通过外网地址 61.1.1.1 向外部提供 www 服务。
PAT 实验:
如下图所示,要求内网能够访问外网,并且内网的服务器向外网提供 WWW 服务。
路由器 R1 配置如下:
hostname r1!
interface FastEthernet0/0 ip address 10.1.1.1 255.255.255.0 ip nat inside duplex auto speed auto!interface FastEthernet0/1 no ip address duplex auto speed auto shutdown!interface Serial0/0/0 ip address 61.1.1.1 255.255.255.0 ip nat outside clock rate 64000!interface Vlan1 no ip address shutdown!ip nat inside source list 10 interface Serial0/0/0 overload ip nat inside source static tcp 10.1.1.254 80 61.1.1.1 80 ip classless ip route 0.0.0.0 0.0.0.0 Serial0/0/0!access-list 10 permit 10.1.1.0 0.0.0.255!line con 0 line vty 0 4 login!end--------------------------------------------------------路由器 R2 的配置如下: hostname R2!interface FastEthernet0/0 ip address 81.1.1.1 255.255.255.0 duplex auto speed auto!interface FastEthernet0/1 ip address 71.1.1.1 255.255.255.0
duplex auto speed auto!interface Serial0/0/0 ip address 61.1.1.2 255.255.255.0!interface Vlan1 no ip address shutdown!ip classless!line con 0 line vty 0 4 login!end
