- 网络拓扑图:
配置:
- 配置过程:
- 创建vlan;
- 配置stp生成树协议;
- 配置dhcp协议;
- 接入PC和网关到vlan;
- 配置动态路由;
- 配置nat访问外网;
- LSW5:
- #
- vlan batch 10 20
- #
- stp instance 1 priority 0 #此节点为实例1的主节点,实例2的备用节点;
- stp instance 2 priority 4096
- #
- stp region-configuration #配置stp
- region-name region1
- revision-level 1
- instance 1 vlan 10
- instance 2 vlan 20
- active region-configuration
- #
- interface GigabitEthernet0/0/1
- port link-type access
- port default vlan 10 #接入vlan10的网关
- #
- interface GigabitEthernet0/0/2
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface GigabitEthernet0/0/3
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface GigabitEthernet0/0/4
- port link-type trunk
- port trunk allow-pass vlan 10 20
- LSW6:
- #
- vlan batch 10 20
- #
- stp instance 1 priority 4096 #此节点为实例1的备用节点,实例2的主节点
- stp instance 2 priority 0
- #
- stp region-configuration #配置stp
- region-name region1
- revision-level 1
- instance 1 vlan 10
- instance 2 vlan 20
- active region-configuration
- #
- interface GigabitEthernet0/0/1
- port link-type access
- port default vlan 20 #接入vlan20的网关
- #
- interface GigabitEthernet0/0/2
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface GigabitEthernet0/0/3
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface GigabitEthernet0/0/4
- port link-type trunk
- port trunk allow-pass vlan 10 20
- LSW7:
- #
- vlan batch 10 20
- #
- dhcp enable #启动dhcp
- #
- stp region-configuration #配置stp
- region-name region1
- revision-level 1
- instance 1 vlan 10
- instance 2 vlan 20
- active region-configuration
- #
- ip pool pool1 #创建ip池
- gateway-list 192.168.10.254
- network 192.168.10.0 mask 255.255.255.0
- lease unlimited
- dns-list 8.8.8.8
- #
- interface Vlanif10
- ip address 192.168.10.1 255.255.255.0
- dhcp select global #vlan10使用dhcp pool1
- #
- interface Ethernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface Ethernet0/0/2
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface Ethernet0/0/3
- port link-type trunk
- port trunk allow-pass vlan 10 20
- LSW8:
- #
- vlan batch 10 20
- #
- dhcp enable #启动dhcp
- #
- stp region-configuration #配置生成树
- region-name region1
- revision-level 1
- instance 1 vlan 10
- instance 2 vlan 20
- active region-configuration
- #
- ip pool pool2 #配置ip池
- gateway-list 192.168.20.254
- network 192.168.20.0 mask 255.255.255.0
- lease unlimited
- dns-list 8.8.8.8
- #
- interface Vlanif20
- ip address 192.168.20.1 255.255.255.0
- dhcp select global #vlan20使用dhcp pool2
- #
- interface Ethernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface Ethernet0/0/2
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface Ethernet0/0/3
- port link-type trunk
- port trunk allow-pass vlan 10 20
- LSW9:
- vlan batch 10 20
- #
- interface Ethernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface Ethernet0/0/2
- port link-type access #将PC3的接口接入vlan10
- port default vlan 10
- LSW10:
- vlan batch 10 20
- #
- interface Ethernet0/0/1
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- interface Ethernet0/0/2
- port link-type access #将PC4的接口接入vlan20
- port default vlan 20
- AR7:
- #
- acl number 2000
- rule 1 permit source 192.168.10.0 0.0.0.255
- #
- nat address-group 1 192.168.1.3 192.168.1.9
- #
- interface GigabitEthernet0/0/0
- ip address 192.168.1.1 255.255.255.0
- nat outbound 2000 address-group 1 #配置nat让内网访问外网;
- #
- interface GigabitEthernet0/0/1
- ip address 192.168.10.254 255.255.255.0
- #
- interface GigabitEthernet0/0/2
- ip address 192.168.20.254 255.255.255.0
- #
- rip 1 #配置动态路由
- network 192.168.1.0
- AR8:
- #
- interface GigabitEthernet0/0/0
- ip address 192.168.1.2 255.255.255.0
- #
- interface GigabitEthernet0/0/1
- ip address 192.168.4.254 255.255.255.0
- #
- rip 1 #配置动态路由
- network 192.168.1.0
- network 192.168.4.0