一、实验拓扑
二、实验要求
1、内网IP地址172.16.0.0/16 合理分配
2、SW1/2之间互为备份
3、vrrp/stp/vlan/trunk均可使用
4、所有PC通过dhcp获取ip地址
三、实验配置
sw1:
stp instance 1 root primary
stp instance 2 root secondary
#
cluster enable
ntdp enable
ndp enable
#
dhcp enable
#
diffserv domain default
#
stp region-configuration
region-name a
instance 1 vlan 1
instance 2 vlan 2
active region-configuration
#
drop-profile default
#
ip pool v1
gateway-list 172.16.1.126
network 172.16.1.0 mask 255.255.255.128
#
ip pool v2
gateway-list 172.16.1.254
network 172.16.1.128 mask 255.255.255.128
#
interface Vlanif1
ip address 172.16.1.1 255.255.255.128
vrrp vrid 1 virtual-ip 172.16.1.126
vrrp vrid 1 priority 105
vrrp vrid 1 track interface Ethernet0/0/4 reduced 30
dhcp select global
#
interface Vlanif2
ip address 172.16.1.129 255.255.255.128
vrrp vrid 1 virtual-ip 172.16.1.254
dhcp select global
#
interface Vlanif99
ip address 172.16.0.2 255.255.255.252
#
interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/3
eth-trunk 0
#
interface Ethernet0/0/4
port link-type access
port default vlan 99
#
interface Ethernet0/0/5
eth-trunk 0
#
ospf 1
area 0.0.0.0
network 172.16.0.2 0.0.0.0
area 0.0.0.1
network 172.16.1.1 0.0.0.0
network 172.16.1.129 0.0.0.0
sw2:
#
vlan batch 2 99
#
stp instance 1 root secondary
stp instance 2 root primary
#
cluster enable
ntdp enable
ndp enable
stp region-configuration
region-name a
instance 1 vlan 1
instance 2 vlan 2
active region-configuration
#
ip pool v1
gateway-list 172.16.1.126
network 172.16.1.0 mask 255.255.255.128
#
ip pool v2
gateway-list 172.16.1.254
network 172.16.1.128 mask 255.255.255.128
#
interface Vlanif1
ip address 172.16.1.2 255.255.255.128
vrrp vrid 1 virtual-ip 172.16.1.126
dhcp select global
#
interface Vlanif2
ip address 172.16.1.130 255.255.255.128
vrrp vrid 1 virtual-ip 172.16.1.254
vrrp vrid 1 priority 105
vrrp vrid 1 track interface Ethernet0/0/4 reduced 30
dhcp select global
#
interface Vlanif99
ip address 172.16.0.6 255.255.255.252
#
interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/2
eth-trunk 0
#
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/4
port link-type access
port default vlan 99
#
ospf 1
area 0.0.0.0
network 172.16.0.6 0.0.0.0
area 0.0.0.1
network 172.16.1.130 0.0.0.0
network 172.16.1.2 0.0.0.0
sw3:
#
stp region-configuration
region-name a
instance 1 vlan 1
instance 2 vlan 2
active region-configuration
#
interface MEth0/0/1
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/2
stp edged-port enable
#
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/4
port link-type access
port default vlan 2
stp edged-port enable
sw4:
#
stp region-configuration
region-name a
instance 1 vlan 1
instance 2 vlan 2
active region-configuration
#
interface MEth0/0/1
#
interface Ethernet0/0/1
stp edged-port enable
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2
#
interface Ethernet0/0/4
port link-type access
port default vlan 2
stp edged-port enable
r1:
#
acl number 2000
rule 5 permit source 172.16.0.0 0.0.255.255
#
firewall zone Local
priority 15
#
interface GigabitEthernet0/0/0
ip address 172.16.0.1 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.0.5 255.255.255.252
#
interface GigabitEthernet0/0/2
ip address 12.1.1.1 255.255.255.0
nat outbound 2000
#
interface NULL0
#
ospf 1
default-route-advertise
area 0.0.0.0
network 172.16.0.1 0.0.0.0
network 172.16.0.5 0.0.0.0
#
ip route-static 0.0.0.0 0.0.0.0 12.1.1.2
r2:
#
interface LoopBack0
ip address 6.6.6.6 255.255.255.0
四、实验结果
四台PC均通过dhcp获取ip
pc1
pc2
pc3
pc4
四台电脑均可ping通isp
pc1
pc2
pc3
pc4
实验结束