SW1配置:
en
config t
vlan 11
name VLAN_BG
vlan 22
name VLAN_H1
VLAN 33
name VLAN_H2
exit
int f0/1
sw mo tr
exit
int ran f0/2 -10
sw mo acc
sw acc vlan 11
exit
int ran f0/11 -20
sw mo acc
sw acc vlan 22
exit
int ran f0/21 -24
sw mo acc
sw acc vlan 33
exit
SW2配置:
en
config t
vlan 88
name VLAN_A
vlan 99
name VLAN_B
exit
int f0/1
sw mo tr
exit
int ran f0/2 -12
sw mo acc
sw acc vlan 88
exit
int ran f0/13 -24
sw mo acc
sw acc vlan 99
exit

2811配置:
int f0/0
no shut
exit
int f0/0.88
en do 88
ip addr 192.31.7.1 255.255.255.128
exit
int f0/0.99
en do 99
ip addr 192.31.7.129 255.255.255.128
exit
int f0/1
no shut
exit
int f0/1.11
en do 11
ip addr 10.18.25.2 255.255.255.0
exit
int f0/1.22
en do 22
ip addr 192.168.0.2 255.255.255.0
exit
int f0/1.33
en do 33
ip addr 192.168.1.2 255.255.255.0
exit
access-list 101 per ip any 10.0.0.0 0.255.255.255
route-map bgh1 per 10          (匹配地址101的设置下一跳为10.18.25.1)
mat ip addr 101
set ip next-hop 10.18.25.1
exit
route-map bgh1 per 20         (匹配地址102的设置下一跳为192.168.0.1)
set ip next-hop 192.168.0.1
exit
route-map bgh2 per 10
mat ip addr 101
set ip next-hop 10.18.25.1
exit
route-map bgh2 per 20
set ip next-hop 192.168.1.1
exit
int f0/0.88
ip policy route-map bgh1      (应用策略路由)
exit
int f0/0.99
ip policy route-map bgh2
exit
access 1 per host 10.18.25.1
access 2 per host 192.168.0.1
access 3 per host 192.168.1.1
route-map natbg per 10 (匹配下一跳地址为定义的访问列表1)
mat ip next-hop 1
exit
route-map nath1 per 10
mat ip next-hop 2
exit
route-map nath2 per 10
mat ip next-hop 3
exit
ip nat inside sou route-map natbg int f0/1.11 over (下一跳为route-map所定义的地址转换为f0/1.11)
ip nat inside sou route-map nath1 int f0/1.22 over
ip nat inside sou route-map nath2 int f0/1.33 over
int f0/0.88
ip nat inside
exit
int f0/0.99
ip nat inside
exit
int f0/1.11
ip nat outside
exit
int f0/1.22
ip nat outside
exit
int f0/1.33
ip nat outside
exit