wKioL1MriVHBUlG8AAJAD3_BnJo982.jpg

首先配置R0

Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#
Router(config)#
Router(config)#no ip domain-lo
Router(config)#no ip domain-lookup 
Router(config)#hos
Router(config)#hostname R0
R0(config)#
R0(config)#int f0/0
R0(config-if)#ip add 202.96.128.100 255.255.255.0
R0(config-if)#no sh

R0(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

R0(config-if)#
R0(config-if)#

R0(config-if)#end
R0#
%SYS-5-CONFIG_I: Configured from console by console

R0#
R0#
R0#vlan da
R0#vlan database 
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

R0(vlan)#vlan 2 name f1/1
VLAN 2 added:
    Name: f1/1
R0(vlan)#vlan 3 name f1/2
VLAN 3 added:
    Name: f1/2
R0(vlan)#exit
APPLY completed.
Exiting....
R0#
R0#

 

R0(config)#
R0(config)#
R0(config)#int vlan 2
R0(config-if)#
%LINK-5-CHANGED: Interface Vlan2, changed state to up
ip add 10.1.1.1 255.255.255.0
R0(config-if)#exit
R0(config)#int vlan 3
R0(config-if)#
%LINK-5-CHANGED: Interface Vlan3, changed state to up
ip add 10.2.2.1 255.255.255.0
R0(config-if)#exit
R0(config)#

 

 

R0(config)#int f1/1
R0(config-if)#sw mo acc
R0(config-if)#sw acc vlan 2
R0(config-if)#spa
R0(config-if)#spanning-tree po
R0(config-if)#spanning-tree portfast 
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface  when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION

%Portfast has been configured on FastEthernet1/1 but will only
have effect when the interface is in a non-trunking mode.
R0(config-if)#no shu
R0(config-if)#no shutdown 

R0(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan2, changed state to up

R0(config-if)#

 

 

R0(config)#int f1/2
R0(config-if)#sw
R0(config-if)#switchport mo
R0(config-if)#switchport mode acc
R0(config-if)#sw acc vlan 3
R0(config-if)#spa
R0(config-if)#spanning-tree po
R0(config-if)#spanning-tree portfast 
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface  when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION

%Portfast has been configured on FastEthernet1/2 but will only
have effect when the interface is in a non-trunking mode.
R0(config-if)#no sh

R0(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan3, changed state to up

 

经过以上的步骤以后路由器R0的IP地址配置完成

 

 

核心交换机SW-3L-1配置

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#
Switch(config)#no ip domain-lo
Switch(config)#no ip domain-lookup 
Switch(config)#hos
Switch(config)#hostname sw-3l-1
sw-3l-1(config)#ip routing
sw-3l-1(config)#
sw-3l-1(config)#int f0/1
sw-3l-1(config-if)#no sw
sw-3l-1(config-if)#no switchport 
sw-3l-1(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
ip add 10.1.1.10 255.255.255.0
sw-3l-1(config-if)#ip add 10.1.1.10 255.255.255.0
sw-3l-1(config-if)#no sh
sw-3l-1(config-if)#exit

sw-3l-1(config)#

 

sw-3l-1(config)#
sw-3l-1(config)#vtp do
sw-3l-1(config)#vtp domain qq
Changing VTP domain name from NULL to qq
sw-3l-1(config)#vtp mo se
sw-3l-1(config)#vtp mo server 
Device mode already VTP SERVER.
sw-3l-1(config)#vtp pass
sw-3l-1(config)#vtp password 123456
Setting device VLAN database password to 123456
sw-3l-1(config)#
sw-3l-1#

 

sw-3l-1#vlan da
sw-3l-1#vlan database 
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.

sw-3l-1(vlan)#
sw-3l-1(vlan)#vlan 10 name jishu
VLAN 10 added:
    Name: jishu
sw-3l-1(vlan)#vlan 20 name sales
VLAN 20 added:
    Name: sales
sw-3l-1(vlan)#vlan 30 name caiwu
VLAN 30 added:
    Name: caiwu
sw-3l-1(vlan)#vlan 50 name ceshi
VLAN 50 added:
    Name: ceshi
sw-3l-1(vlan)#vlan 100 name server-pt
VLAN 100 added:
    Name: server-pt
sw-3l-1(vlan)#vlan 11 name gateway
VLAN 11 added:
    Name: gateway
sw-3l-1(vlan)#

 

sw-3l-1(config)#int range f0/23 -24
sw-3l-1(config-if-range)#sw
sw-3l-1(config-if-range)#switchport tr
sw-3l-1(config-if-range)#switchport trunk en
sw-3l-1(config-if-range)#switchport trunk encapsulation do
sw-3l-1(config-if-range)#switchport trunk encapsulation dot1q 
sw-3l-1(config-if-range)#sw
sw-3l-1(config-if-range)#switchport mo
sw-3l-1(config-if-range)#switchport mode tr
sw-3l-1(config-if-range)#switchport mode trunk 


sw-3l-1(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
channel
sw-3l-1(config-if-range)#channel-gr
sw-3l-1(config-if-range)#channel-group 1 mo
sw-3l-1(config-if-range)#channel-group 1 mode 
sw-3l-1(config-if-range)#channel-group 1 mode on
sw-3l-1(config-if-range)#channel-group 1 mode on 

 

sw-3l-1(config)#int range f0/21 -22
sw-3l-1(config-if-range)#sw
sw-3l-1(config-if-range)#switchport tr
sw-3l-1(config-if-range)#switchport trunk en
sw-3l-1(config-if-range)#switchport trunk encapsulation do
sw-3l-1(config-if-range)#switchport trunk encapsulation dot1q 
sw-3l-1(config-if-range)#sw
sw-3l-1(config-if-range)#switchport mo
sw-3l-1(config-if-range)#switchport mode tr
sw-3l-1(config-if-range)#switchport mode trunk 


sw-3l-1(config-if-range)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/21, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/21, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/22, changed state to up

sw-3l-1(config)#int vlan 10
sw-3l-1(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
ip add 192.168.10.222 255.255.255.0
sw-3l-1(config-if)#ex
sw-3l-1(config)#int vlan 11
sw-3l-1(config-if)#
%LINK-5-CHANGED: Interface Vlan11, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan11, changed state to up
ip add 192.168.11.250
% Incomplete command.
sw-3l-1(config-if)#ip add 192.168.11.250 255.255.255.0
sw-3l-1(config-if)#ex
sw-3l-1(config)#
sw-3l-1(config)#int vlan 20
sw-3l-1(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
ip add 192.168.20.222 255.255.255.0
sw-3l-1(config-if)#ex
sw-3l-1(config)#int vlan 30
sw-3l-1(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan30, changed state to up
ip add 192.168.30.222 255.255.255.0
sw-3l-1(config-if)#ex
sw-3l-1(config)#int vlan 50
sw-3l-1(config-if)#
%LINK-5-CHANGED: Interface Vlan50, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan50, changed state to up
ip add 192.168.50.222 255.255.255.0
sw-3l-1(config-if)#ex
sw-3l-1(config)#
sw-3l-1(config)#int vlan 100
sw-3l-1(config-if)#
%LINK-5-CHANGED: Interface Vlan100, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan100, changed state to up
ip add 192.168.100.222 255.255.255.0
sw-3l-1(config-if)#ex
sw-3l-1(config)#

 

sw-3l-1#
sw-3l-1#ping 10.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 ms

sw-3l-1#

 

sw-3l-2>en
sw-3l-2#ping 10.2.2.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms

sw-3l-2#

 

基本上sw-3l-1配置完成,sw-3l-2配置同上就是IP地址改动一下,vtp模式配置成client模式或者server都可以,接下来配置sw-1交换机

 

 

sw-1配置

 

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#
Switch(config)#
Switch(config)#ho
Switch(config)#hostname sw-1
sw-1(config)#no ip domain-lo
sw-1(config)#no ip domain-lookup 
sw-1(config)#
sw-1(config)#
sw-1(config)#vtp d
sw-1(config)#vtp domain qq
Domain name already set to qq.
sw-1(config)#vtp mo cl
sw-1(config)#vtp mo client 
Setting device to VTP CLIENT mode.
sw-1(config)#vtp pass
sw-1(config)#vtp password 123456
Setting device VLAN database password to 123456
sw-1(config)#int range f0/21 -22
sw-1(config-if-range)#sw
sw-1(config-if-range)#switchport mo
sw-1(config-if-range)#switchport mode tr
sw-1(config-if-range)#switchport mode trunk 
sw-1(config-if-range)#no sh
sw-1(config-if-range)#ex
sw-1(config)#
sw-1(config)#
sw-1(config)#int vlan 11
sw-1(config-if)#
%LINK-5-CHANGED: Interface Vlan11, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan11, changed state to up
ip add 192.168.11.248 255.255.255.0
sw-1(config-if)#exit
sw-1(config)#
sw-1(config)#

 

 

sw-1(config)#
sw-1(config)#int range f0/1 -5
sw-1(config-if-range)#sw
sw-1(config-if-range)#switchport mo
sw-1(config-if-range)#switchport mode acc
sw-1(config-if-range)#sw acc vlan 10
sw-1(config-if-range)#spa
sw-1(config-if-range)#spanning-tree po
sw-1(config-if-range)#spanning-tree portfast 
%Warning: portfast should only be enabled on ports connected to a single
 host. Connecting hubs, concentrators, switches, bridges, etc... to this
 interface  when portfast is enabled, can cause temporary bridging loops.
 Use with CAUTION

%Portfast will be configured in 5 interfaces due to the range command
 but will only have effect when the interfaces are in a non-trunking mode.
sw-1(config-if-range)#no sh
sw-1(config-if-range)#ex
sw-1(config)#
sw-1(config)#

用此方法依次将f6/10划分到VLAN20,将f11/15划分到VLAN50,将f16/20划分到VLAN100

sw-1#
sw-1#
sw-1#sh vlan bri
sw-1#sh vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/23, Fa0/24, Gig1/1, Gig1/2
10   jishu                            active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5
11   gateway                          active    
20   sales                            active    Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10
30   caiwu                            active    
50   ceshi                            active    Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15
100  server-pt                        active    Fa0/16, Fa0/17, Fa0/18, Fa0/19
                                                Fa0/20
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
sw-1#

 

sw-1#
sw-1#ping 192.168.11.250

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.11.250, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/1 ms

sw-1#

 

sw-2#
sw-2#
sw-2#
sw-2#ping 192.168.11.250

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.11.250, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 ms

sw-2#

 

接下来配置VLAN负载均衡

sw-3l-1(config)#
sw-3l-1(config)#spa
sw-3l-1(config)#spanning-tree vlan 10,11,20 ro
sw-3l-1(config)#spanning-tree vlan 10,11,20 root pri
sw-3l-1(config)#spanning-tree vlan 10,11,20 root primary 
sw-3l-1(config)#spa
sw-3l-1(config)#spanning-tree vlan 30,50,100 ro
sw-3l-1(config)#spanning-tree vlan 30,50,100 root se
sw-3l-1(config)#spanning-tree vlan 30,50,100 root secondary 
sw-3l-1(config)#
sw-3l-1(config)#

 

sw-3l-2(config)#
sw-3l-2(config)#spa
sw-3l-2(config)#spanning-tree vlan 30,50,100 ro
sw-3l-2(config)#spanning-tree vlan 30,50,100 root pri
sw-3l-2(config)#spanning-tree vlan 30,50,100 root primary 
sw-3l-2(config)#spa
sw-3l-2(config)#spanning-tree vlan 10,11,20 ro
sw-3l-2(config)#spanning-tree vlan 10,11,20 root se
sw-3l-2(config)#spanning-tree vlan 10,11,20 root secondary 
sw-3l-2(config)#
sw-3l-2(config)#

 

sw-1#
sw-1#sh spa
sw-1#sh spanning-tree int f
sw-1#sh spanning-tree int fastEthernet 0/21
Vlan             Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
VLAN0001         Root FWD 19        128.21    P2p
VLAN0010         Root FWD 19        128.21    P2p
VLAN0011         Root FWD 19        128.21    P2p
VLAN0020         Root FWD 19        128.21    P2p
VLAN0030         Altn BLK 19        128.21    P2p
VLAN0050         Altn BLK 19        128.21    P2p
VLAN0100         Altn BLK 19        128.21    P2p
sw-1#sh spanning-tree int fastEthernet 0/22
Vlan             Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
VLAN0001         Altn BLK 19        128.22    P2p
VLAN0010         Altn BLK 19        128.22    P2p
VLAN0011         Altn BLK 19        128.22    P2p
VLAN0020         Altn BLK 19        128.22    P2p
VLAN0030         Root FWD 19        128.22    P2p
VLAN0050         Root FWD 19        128.22    P2p
VLAN0100         Root FWD 19        128.22    P2p
sw-1#
sw-1#
sw-1#

 

sw-2#
sw-2#
sw-2#sh spa
sw-2#sh spanning-tree int
sw-2#sh spanning-tree interface f
sw-2#sh spanning-tree interface fastEthernet 0/21
Vlan             Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
VLAN0001         Altn BLK 19        128.21    P2p
VLAN0010         Altn BLK 19        128.21    P2p
VLAN0011         Altn BLK 19        128.21    P2p
VLAN0020         Altn BLK 19        128.21    P2p
VLAN0030         Root FWD 19        128.21    P2p
VLAN0050         Root FWD 19        128.21    P2p
VLAN0100         Root FWD 19        128.21    P2p
sw-2#
sw-2#sh spanning-tree interface fastEthernet 0/22
Vlan             Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
VLAN0001         Root FWD 19        128.22    P2p
VLAN0010         Root FWD 19        128.22    P2p
VLAN0011         Root FWD 19        128.22    P2p
VLAN0020         Root FWD 19        128.22    P2p
VLAN0030         Altn BLK 19        128.22    P2p
VLAN0050         Altn BLK 19        128.22    P2p
VLAN0100         Altn BLK 19        128.22    P2p
sw-2#
sw-2#

 

配置HSRP

sw-3l-1(config)#
sw-3l-1(config)#int vlan 11
sw-3l-1(config-if)#stan
sw-3l-1(config-if)#standby 10 ip 192.168.11.254
sw-3l-1(config-if)#stan
sw-3l-1(config-if)#standby 10 pri
sw-3l-1(config-if)#standby 10 priority 200
sw-3l-1(config-if)#stan
sw-3l-1(config-if)#standby 10 pree
sw-3l-1(config-if)#standby 10 preempt 
sw-3l-1(config-if)#stan
sw-3l-1(config-if)#standby 20 ip 192.168.11.253
sw-3l-1(config-if)#
%HSRP-6-STATECHANGE: Vlan11 Grp 10 state Speak -> Standby
s
%HSRP-6-STATECHANGE: Vlan11 Grp 10 state Standby -> Active

sw-3l-1(config-if)#stan
sw-3l-1(config-if)#standby 20 pri
sw-3l-1(config-if)#standby 20 priority 150
sw-3l-1(config-if)#stan
sw-3l-1(config-if)#standby 20 pree
sw-3l-1(config-if)#standby 20 preempt 
sw-3l-1(config-if)#
sw-3l-1(config-if)#
sw-3l-1(config-if)#
%HSRP-6-STATECHANGE: Vlan11 Grp 20 state Speak -> Standby

%HSRP-6-STATECHANGE: Vlan11 Grp 20 state Standby -> Active

 

sw-3l-2(config)#
sw-3l-2(config)#
sw-3l-2(config)#int vlan 11
sw-3l-2(config-if)#stan
sw-3l-2(config-if)#standby 10 ip 192.168.11.254
sw-3l-2(config-if)#stan
sw-3l-2(config-if)#standby 10 pri
sw-3l-2(config-if)#standby 10 priority 150
sw-3l-2(config-if)#stan
sw-3l-2(config-if)#standby 10 pree
sw-3l-2(config-if)#standby 10 preempt 
sw-3l-2(config-if)#stan
sw-3l-2(config-if)#standby 20 ip 192.168.11.253
sw-3l-2(config-if)#stan
sw-3l-2(config-if)#standby 20 pri
sw-3l-2(config-if)#standby 20 priority 200
%HSRP-6-STATECHANGE: Vlan11 Grp 10 state Speak -> Standby

sw-3l-2(config-if)#stan
sw-3l-2(config-if)#standby 20 pree
sw-3l-2(config-if)#standby 20 preempt 
sw-3l-2(config-if)#
 %HSRP-6-STATECHANGE: Vlan11 Grp 20 state Standby -> Active

查看配置

sw-3l-2#
sw-3l-2#
sw-3l-2#sh standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Vl1         10   150 P Standby  192.168.11.250  local           192.168.11.254 
Vl1         20   200 P Active   local           192.168.11.250  192.168.11.253 
sw-3l-2#
sw-3l-2#
sw-3l-2#
sw-3l-2#
sw-3l-2#

 

sw-3l-1#sh stan
sw-3l-1#sh standby bri
sw-3l-1#sh standby brief 
                     P indicates configured to preempt.
                     |
Interface   Grp  Pri P State    Active          Standby         Virtual IP
Vl1         10   200 P Active   local           192.168.11.251  192.168.11.254 
Vl1         20   150 P Standby  192.168.11.251  local           192.168.11.253 
sw-3l-1#
sw-3l-1#
sw-3l-1#

 

路由器配置RIP

 

R0(config)#
R0(config)#rout
R0(config)#router ri
R0(config)#router rip 
R0(config-router)#net
R0(config-router)#no auto
R0(config-router)#no auto-summary 
R0(config-router)#net
R0(config-router)#network 202.96.128.0
R0(config-router)#net
R0(config-router)#network 10.1.1.0
R0(config-router)#net
R0(config-router)#network 10.2.2.0
R0(config-router)#end
R0#

 

sw-3l-1(config)#
sw-3l-1(config)#rout
sw-3l-1(config)#router ri
sw-3l-1(config)#router rip 
sw-3l-1(config-router)#net
sw-3l-1(config-router)#no auto
sw-3l-1(config-router)#no auto-summary 
sw-3l-1(config-router)#
sw-3l-1(config-router)#net
sw-3l-1(config-router)#network 10.1.1.0
sw-3l-1(config-router)#net
sw-3l-1(config-router)#network 192.168.10.0
sw-3l-1(config-router)#network 192.168.11.0
sw-3l-1(config-router)#network 192.168.20.0
sw-3l-1(config-router)#network 192.168.30.0
sw-3l-1(config-router)#network 192.168.50.0
sw-3l-1(config-router)#network 192.168.100.0
sw-3l-1(config-router)#end
sw-3l-1#

 

sw-3l-2(config)#
sw-3l-2(config)#rout
sw-3l-2(config)#router ri
sw-3l-2(config)#router rip 
sw-3l-2(config-router)#no aut
sw-3l-2(config-router)#no auto-summary 
sw-3l-2(config-router)#net
sw-3l-2(config-router)#network 10.2.2.0
sw-3l-2(config-router)#net
sw-3l-2(config-router)#network 192.168.10.0
sw-3l-2(config-router)#network 192.168.11.0
sw-3l-2(config-router)#network 192.168.20.0
sw-3l-2(config-router)#network 192.168.30.0
sw-3l-2(config-router)#network 192.168.50.0
sw-3l-2(config-router)#network 192.168.100.0
sw-3l-2(config-router)#end
sw-3l-2#

 

 

sw-3l-2#
sw-3l-2#sh ip route
Codes: 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 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 route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 2 subnets
R       10.1.1.0 [120/1] via 10.2.2.1, 00:00:17, FastEthernet0/2
C       10.2.2.0 is directly connected, FastEthernet0/2
C    192.168.10.0/24 is directly connected, Vlan10
C    192.168.11.0/24 is directly connected, Vlan11
C    192.168.20.0/24 is directly connected, Vlan20
C    192.168.30.0/24 is directly connected, Vlan30
C    192.168.50.0/24 is directly connected, Vlan50
C    192.168.100.0/24 is directly connected, Vlan100
R    202.96.128.0/24 [120/1] via 10.2.2.1, 00:00:17, FastEthernet0/2
sw-3l-2#
sw-3l-2#

 

sw-3l-1#
sw-3l-1#sh ip route
Codes: 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 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 route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.1.0 is directly connected, FastEthernet0/1
R       10.2.2.0 [120/1] via 10.1.1.1, 00:00:15, FastEthernet0/1
C    192.168.10.0/24 is directly connected, Vlan10
C    192.168.11.0/24 is directly connected, Vlan11
C    192.168.20.0/24 is directly connected, Vlan20
C    192.168.30.0/24 is directly connected, Vlan30
C    192.168.50.0/24 is directly connected, Vlan50
C    192.168.100.0/24 is directly connected, Vlan100
R    202.96.128.0/24 [120/1] via 10.1.1.1, 00:00:15, FastEthernet0/1
sw-3l-1#
sw-3l-1#
sw-3l-1#
sw-3l-1#

 

R0#
R0#sh ip route
Codes: 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 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 route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.1.0 is directly connected, Vlan2
C       10.2.2.0 is directly connected, Vlan3
R    192.168.10.0/24 [120/1] via 10.1.1.10, 00:00:05, Vlan2
                     [120/1] via 10.2.2.10, 00:00:21, Vlan3
R    192.168.11.0/24 [120/1] via 10.1.1.10, 00:00:05, Vlan2
                     [120/1] via 10.2.2.10, 00:00:21, Vlan3
R    192.168.20.0/24 [120/1] via 10.1.1.10, 00:00:05, Vlan2
                     [120/1] via 10.2.2.10, 00:00:21, Vlan3
R    192.168.30.0/24 [120/1] via 10.1.1.10, 00:00:05, Vlan2
                     [120/1] via 10.2.2.10, 00:00:21, Vlan3
R    192.168.50.0/24 [120/1] via 10.1.1.10, 00:00:05, Vlan2
                     [120/1] via 10.2.2.10, 00:00:21, Vlan3
R    192.168.100.0/24 [120/1] via 10.1.1.10, 00:00:05, Vlan2
                      [120/1] via 10.2.2.10, 00:00:21, Vlan3
C    202.96.128.0/24 is directly connected, FastEthernet0/0
R0#
R0#

 

 

 

R0配置PAT

 

R0(config)#
R0(config)#acces
R0(config)#access-list 1 per
R0(config)#access-list 1 permit an
R0(config)#access-list 1 permit any 
R0(config)#ip nat ins
R0(config)#ip nat inside so
R0(config)#ip nat inside source li
R0(config)#ip nat inside source list 1 int
R0(config)#ip nat inside source list 1 interface f0/0 over
R0(config)#ip nat inside source list 1 interface f0/0 overload 
R0(config)#int f0/0
R0(config-if)#ip nat out
R0(config-if)#ip nat outside 
R0(config-if)#ex
R0(config)#int vlan 2
R0(config-if)#ip nat ins
R0(config-if)#ip nat inside 
R0(config-if)#ex
R0(config)#int vlan 3
R0(config-if)#ip nat ins
R0(config-if)#ip nat inside 
R0(config-if)#exit
R0(config)#
R0(config)#

 

PC测试


PC>ping 202.96.128.105

Pinging 202.96.128.105 with 32 bytes of data:

Reply from 202.96.128.105: bytes=32 time=0ms TTL=126
Reply from 202.96.128.105: bytes=32 time=1ms TTL=126
Reply from 202.96.128.105: bytes=32 time=0ms TTL=126
Reply from 202.96.128.105: bytes=32 time=11ms TTL=126

Ping statistics for 202.96.128.105:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 11ms, Average = 3ms

PC>

用抓包工具检测发现,出口处地址转换成路由器接口地址,就起到了安全的作用

 

测试HSRP

拔掉路由器f1/1接口的网线,然后客户端测试ping外网地址发现仍然可以通过,说明HSRP起到了作用