拓扑图
配置文件
R1
sysname R1
#
interface GigabitEthernet0/0/0
ip address 202.10.102.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 202.10.101.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ip route-static 192.168.0.0 255.255.0.0 202.10.101.2
R2
sysname R2
#
acl number 2000
rule 5 permit source 192.168.0.0 0.0.255.255
#
interface GigabitEthernet0/0/0
ip address 202.10.101.2 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/1
ip address 192.168.15.2 255.255.255.0
#
interface GigabitEthernet1/0/0
ip address 192.168.16.2 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 192.168.10.2 255.255.255.0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
ospf 110 router-id 2.2.2.2
default-route-advertise always cost 0
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 192.168.10.0 0.0.0.255
network 192.168.15.0 0.0.0.255
network 192.168.16.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 202.10.101.1
R3
sysname R3
#
interface GigabitEthernet0/0/0
ip address 192.168.10.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.20.3 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
ospf 110 router-id 3.3.3.3
import-route rip 1 cost 100
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 192.168.10.0 0.0.0.255
#
rip 1
undo summary
default-route originate
version 2
network 3.0.0.0
network 192.168.20.0
import-route ospf 110 cost 0
R4
sysname R4
#
interface GigabitEthernet0/0/0
ip address 192.168.20.4 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.30.4 255.255.255.0
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
rip 1
undo summary
version 2
network 4.0.0.0
network 192.168.20.0
network 192.168.30.0
R5
sysname R5
#
interface GigabitEthernet0/0/0
ip address 192.168.30.5 255.255.255.0
#
interface GigabitEthernet0/0/1.1
dot1q termination vid 500
ip address 192.168.5.1 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/1.2
dot1q termination vid 600
ip address 192.168.6.1 255.255.255.0
arp broadcast enable
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
#
rip 1
undo summary
version 2
network 5.0.0.0
network 192.168.30.0
network 192.168.5.0
network 192.168.6.0
SW1
不需要配置
SW2
#
sysname SW2
#
vlan batch 100 200 300 400 555
#
stp instance 1 root primary
stp instance 2 root secondary
#
interface Vlanif100
ip address 192.168.1.10 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.1
vrrp vrid 1 priority 105
vrrp vrid 1 track interface GigabitEthernet0/0/1
#
interface Vlanif200
ip address 192.168.2.10 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.2.1
vrrp vrid 2 track interface GigabitEthernet0/0/1
#
interface Vlanif300
ip address 192.168.3.10 255.255.255.0
vrrp vrid 3 virtual-ip 192.168.3.1
vrrp vrid 3 priority 105
#
interface Vlanif400
ip address 192.168.4.10 255.255.255.0
vrrp vrid 4 virtual-ip 192.168.4.1
#
interface Vlanif555
ip address 192.168.15.10 255.255.255.0
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 555
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
eth-trunk 1
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/5
eth-trunk 1
#
interface GigabitEthernet0/0/6
eth-trunk 1
#
interface GigabitEthernet0/0/7
eth-trunk 1
#
ospf 110
area 0.0.0.0
network 192.168.15.0 0.0.0.255
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
network 192.168.3.0 0.0.0.255
network 192.168.4.0 0.0.0.255
SW3
sysname SW3
#
vlan batch 100 200 300 400 666
#
stp instance 1 root secondary
stp instance 2 root primary
#
interface Vlanif100
ip address 192.168.1.11 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.1
#
interface Vlanif200
ip address 192.168.2.11 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.2.1
vrrp vrid 2 priority 105
#
interface Vlanif300
ip address 192.168.3.11 255.255.255.0
vrrp vrid 3 virtual-ip 192.168.3.1
vrrp vrid 3 track interface GigabitEthernet0/0/1
#
interface Vlanif400
ip address 192.168.4.11 255.255.255.0
vrrp vrid 4 virtual-ip 192.168.4.1
vrrp vrid 4 priority 105
vrrp vrid 4 track interface GigabitEthernet0/0/1
#
interface Vlanif666
ip address 192.168.16.10 255.255.255.0
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 666
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
eth-trunk 1
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/5
eth-trunk 1
#
interface GigabitEthernet0/0/6
eth-trunk 1
#
interface GigabitEthernet0/0/7
eth-trunk 1
#
ospf 110
area 0.0.0.0
network 192.168.16.0 0.0.0.255
network 192.168.4.0 0.0.0.255
network 192.168.3.0 0.0.0.255
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
SW4
sysname SW4
#
vlan batch 100 200 555
#
interface Ethernet0/0/1
port link-type access
port default vlan 100
#
interface Ethernet0/0/2
port link-type access
port default vlan 200
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
SW5
sysname SW5
#
vlan batch 300 400 666
#
interface Ethernet0/0/1
port link-type access
port default vlan 300
#
interface Ethernet0/0/2
port link-type access
port default vlan 400
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
SW6
sysname SW6
#
vlan batch 500 600
#
interface Ethernet0/0/1
port hybrid pvid vlan 500
port hybrid untagged vlan 2 to 4094
#
interface Ethernet0/0/2
port hybrid pvid vlan 600
port hybrid untagged vlan 2 to 4094
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094