1. VLAN 1 的虚拟网关是192.168.1.254 ;SWA作为VLAN 1的master和stp的根,SWB作为BACKUP ,阻塞了SWC的F0/11号端口和SWD的F0/10号端口,并设置SWA的监听端口fa0/0
2.VLAN 100 的虚拟网关是192.168.100.254 ;SWA作为VLAN 100的master和stp的根,SWB作为BACKUP ,阻塞了SWC的F0/11号端口,并设置SWA的监听端口fa0/0
3. VLAN 101 的虚拟网关是192.168.101.254 ;SWA作为VLAN 101的BACKUP,SWB作为master和stp的根 ,阻塞了SWD的F0/11号端口,并设置SWB的监听端口fa0/0
配置步骤:
Router#sh ru
r1#sh running-config
Building configuration...
Current configuration : 1496 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
no ip domain lookup
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Serial0/0
ip address 202.101.224.1 255.255.255.252
ip nat outside
ip virtual-reassembly
serial restart-delay 0
!
interface Serial0/1
ip address 202.101.225.1 255.255.255.252
ip nat outside
ip virtual-reassembly
serial restart-delay 0
!
interface Serial0/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial0/3
no ip address
shutdown
serial restart-delay 0
!
interface FastEthernet1/0
ip address 192.168.2.2 255.255.255.0
ip nat inside
ip virtual-reassembly
duplex auto
speed auto
!
interface FastEthernet2/0
ip address 192.168.3.2 255.255.255.0
ip nat inside
ip virtual-reassembly
duplex auto
speed auto
!
router rip
version 2
network 1.0.0.0
network 192.168.2.0
network 192.168.3.0
default-information originate
no auto-summary
!
ip http server
ip route 0.0.0.0 0.0.0.0 202.101.224.2
ip route 0.0.0.0 0.0.0.0 202.101.225.2
!
!
ip nat inside source list 1 interface Serial0/0 overload
ip nat inside source list 2 interface Serial0/1 overload
!
access-list 1 permit 192.168.100.100
access-list 2 permit 192.168.101.100
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
end
r1#sh ip ro
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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 202.101.225.2 to network 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
202.101.224.0/30 is subnetted, 1 subnets
C 202.101.224.0 is directly connected, Serial0/0
202.101.225.0/30 is subnetted, 1 subnets
C 202.101.225.0 is directly connected, Serial0/1
R 192.168.1.0/24 [120/1] via 192.168.3.1, 00:00:18, FastEthernet2/0
[120/1] via 192.168.2.1, 00:00:06, FastEthernet1/0
C 192.168.2.0/24 is directly connected, FastEthernet1/0
R 192.168.100.0/24 [120/1] via 192.168.3.1, 00:00:18, FastEthernet2/0
[120/1] via 192.168.2.1, 00:00:06, FastEthernet1/0
C 192.168.3.0/24 is directly connected, FastEthernet2/0
R 192.168.101.0/24 [120/1] via 192.168.3.1, 00:00:18, FastEthernet2/0
[120/1] via 192.168.2.1, 00:00:06, FastEthernet1/0
S* 0.0.0.0/0 [1/0] via 202.101.225.2
[1/0] via 202.101.224.2
SW1配置:
swa#sh ru
Building configuration...
Current configuration : 2188 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname swa
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
no ip domain lookup
!
!
spanning-tree vlan 1 priority 0
spanning-tree vlan 100 priority 0
spanning-tree vlan 101 priority 4096
!
!
!
track 1 interface FastEthernet0/0 line-protocol
!
!
interface Port-channel1
switchport mode trunk
!
interface FastEthernet0/0
switchport access vlan 2
!
interface FastEthernet0/1
switchport mode trunk
duplex full
speed 100
channel-group 1 mode on
!
interface FastEthernet0/2
switchport mode trunk
duplex full
speed 100
channel-group 1 mode on
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
switchport mode trunk
!
interface FastEthernet0/11
switchport mode trunk
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface Vlan1
ip address 192.168.1.1 255.255.255.0
vrrp 1 description vlan_1
vrrp 1 ip 192.168.1.254
vrrp 1 preempt delay minimum 5
vrrp 1 priority 90
vrrp 1 track 1 decrement 20
!
interface Vlan2
ip address 192.168.2.1 255.255.255.0
!
interface Vlan3
no ip address
!
interface Vlan100
ip address 192.168.100.252 255.255.255.0
vrrp 1 description vlan_100
vrrp 1 ip 192.168.100.254
vrrp 1 preempt delay minimum 5
vrrp 1 priority 90
vrrp 1 track 1 decrement 20
!
interface Vlan101
ip address 192.168.101.252 255.255.255.0
vrrp 1 description vlan_101
vrrp 1 ip 192.168.101.254
vrrp 1 preempt delay minimum 5
vrrp 1 priority 80
!
router rip
version 2
network 192.168.1.0
network 192.168.2.0
network 192.168.100.0
network 192.168.101.0
no auto-summary
!
ip http server
!
!
!
mac-address-table static 0000.5e00.0101 interface FastEthernet0/1 vlan 1
mac-address-table static 0000.5e00.0101 interface FastEthernet0/1 vlan 100
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
SW2的配置:
sw2#sh ru
Building configuration...
Current configuration : 2024 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname swb
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
no ip domain lookup
!
!
spanning-tree vlan 1 priority 4096
spanning-tree vlan 100 priority 4096
spanning-tree vlan 101 priority 0
!
!
!
track 1 interface FastEthernet0/0 line-protocol
!
!
interface Port-channel1
switchport mode trunk
!
interface FastEthernet0/0
switchport access vlan 2
!
interface FastEthernet0/1
switchport mode trunk
duplex full
speed 100
channel-group 1 mode on
!
interface FastEthernet0/2
switchport mode trunk
duplex full
speed 100
channel-group 1 mode on
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
switchport mode trunk
!
interface FastEthernet0/11
switchport mode trunk
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface Vlan1
ip address 192.168.1.2 255.255.255.0
vrrp 1 description vlan_1
vrrp 1 ip 192.168.1.254
vrrp 1 preempt delay minimum 5
vrrp 1 priority 80
!
interface Vlan2
ip address 192.168.3.1 255.255.255.0
!
interface Vlan100
ip address 192.168.100.253 255.255.255.0
vrrp 1 description vlan_100
vrrp 1 ip 192.168.100.254
vrrp 1 preempt delay minimum 5
vrrp 1 priority 80
!
interface Vlan101
ip address 192.168.101.253 255.255.255.0
vrrp 1 description vlan_101
vrrp 1 ip 192.168.101.254
vrrp 1 priority 90
vrrp 1 track 1 decrement 20
!
router rip
version 2
network 192.168.1.0
network 192.168.3.0
network 192.168.100.0
network 192.168.101.0
no auto-summary
!
ip http server
!
!
!
mac-address-table static 0000.5e00.0101 interface FastEthernet0/1 vlan 101
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
end
SW3与SW4相同,配置如下:
swc#sh ru
Building configuration...
Current configuration : 1013 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname swc
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
no ip domain lookup
!
!
!
!
!
interface FastEthernet0/0
switchport access vlan 100
!
interface FastEthernet0/1
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
switchport mode trunk
!
interface FastEthernet0/11
switchport mode trunk
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface Vlan1
ip address 192.168.1.3 255.255.255.0
!
ip http server
ip route 0.0.0.0 0.0.0.0 192.168.1.254
!
control-plane
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!