目录
一、实验内容
二、实验步骤
1.实验拓扑
2.配置加换机
eth-trunk:
SW1:
[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]int g0/0/22
[sw1-GigabitEthernet0/0/22]eth-trunk 0
[sw1-GigabitEthernet0/0/22]int g0/0/23
[sw1-GigabitEthernet0/0/23]eth-trunk 0
SW2:
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]int g0/0/22
[sw2-GigabitEthernet0/0/22]eth-trunk 0
[sw2-GigabitEthernet0/0/23]eth-trunk 0
创建及划分vlan和创建trunk干道:
SW1:
[sw1-vlan2]q
[sw1]port-group group-member Eth-Trunk 0 GigabitEthernet 0/0/1 to GigabitEthernet 0/0/2
[sw1-port-group]port link-type trunk
[sw1-Eth-Trunk0]port link-type trunk
[sw1-GigabitEthernet0/0/1]port link-type trunk
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-port-group]port trunk allow-pass vlan 2
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
SW2:
[sw2]vlan 2
[sw2-vlan2]q
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]port link-type trunk
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2
[sw2-Eth-Trunk0]q
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type trunk
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2
[sw2]int g0/0/2
[sw2-GigabitEthernet0/0/2]port link-type trunk
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
SW3:
[sw3]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[sw3-port-group]port link-type trunk
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/2]port link-type trunk
[sw3-port-group]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/2]port trunk allow-pass vlan 2
[sw3-port-group]q
[sw3]int e0/0/4
[sw3-Ethernet0/0/4]port link-type access
[sw3-Ethernet0/0/4]p d v 2
[sw3-Ethernet0/0/4]stp edged-port enable
[sw3-Ethernet0/0/4]int e0/0/3
[sw3-Ethernet0/0/3]stp edged-port enable
SW4:
[sw4]vlan 2
[sw4-vlan2]q
[sw4]int e0/0/4
[sw4-Ethernet0/0/4]p l a
[sw4-Ethernet0/0/4]p d v 2
[sw4-Ethernet0/0/4]stp edged-port enable
[sw4-Ethernet0/0/4]int e0/0/3
[sw4-Ethernet0/0/3]stp edged-port enable
[sw4-Ethernet0/0/3]q
[sw4]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[sw4-Ethernet0/0/1]port link-type trunk
[sw4-Ethernet0/0/2]port link-type trunk
[sw4-port-group]port trunk allow-pass vlan 2
[sw4-Ethernet0/0/1]port trunk allow-pass vlan 2
[sw4-Ethernet0/0/2]port trunk allow-pass vlan 2
配置STP:
SW1:
[sw1]stp mode mstp
[sw1]stp region-configuration
[sw1-mst-region]region-name a
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration
[sw1-mst-region]q
[sw1]stp instance 1 root primary
[sw1]stp instance 2
[sw1]stp instance 2 root secondary
SW2:
[sw2]stp mode mstp
[sw2]stp region-configuration
[sw2-mst-region]region-name a
[sw2-mst-region]instance 1 vlan 1
[sw2-mst-region]instance 2 vlan 2
[sw2-mst-region]active region-configuration
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root primary
SW3:
[sw3]stp mode mstp
[sw3]stp region-configuration
[sw3-mst-region]region-name a
[sw3-mst-region]instance 1 vlan 1
[sw3-mst-region]instance 2 vlan 2
[sw3-mst-region]active region-configuration
SW4:
[sw4]stp mode mstp
[sw4]stp region-configuration
[sw4-mst-region]region-name a
[sw4-mst-region]instance 1 vlan 1
[sw4-mst-region]instance 2 vlan 2
[sw4-mst-region]active region-configuration
配置SVI
SW1:
[sw1]interface vlan 1
[sw1-Vlanif1]ip address 172.16.1.1 25
[sw1-Vlanif1]q
[sw1]interface vlan 2
[sw1-Vlanif2]ip address 172.16.1.129 25
SW2:
[sw2]interface vlan 1
[sw2-Vlanif1]ip address 172.16.1.2 25
[sw2-Vlanif1]q
[sw2]interface vlan 2
[sw2-Vlanif2]ip address 172.16.1.130 25
配置vrrp网关冗余
SW1:
[sw1]interface vlan1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 101
[sw1-Vlanif1]vrrp vrid 1 track interface g0/0/24 reduced 2
[sw1-Vlanif1]q
[sw1]interface vlan 2
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
SW2:
[sw2]interface vlan 1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw2-Vlanif1]q
[sw2]interface vlan 2
[sw2-Vlanif2]vrrp vrid 1 virtual-ip 172.16.1.254
[sw2-Vlanif2]vrrp vrid 1 priority 101
[sw2-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/24 reduced 2
配置DHCP
SW1:
[sw1]dhcp enable
[sw1]ip pool v1
[sw1-ip-pool-v1]network 172.16.1.0 mask 25
[sw1-ip-pool-v1]gateway-list 172.16.1.126
[sw1-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[sw1-ip-pool-v1]q
[sw1]ip pool v2
[sw1-ip-pool-v2]network 172.16.1.128 mask 25
[sw1-ip-pool-v2]gateway-list 172.16.1.254
[sw1-ip-pool-v2]dns-list 114.114.114.114 8.8.8.
[sw1]interface vlan 1
[sw1-Vlanif1]dhcp select global
[sw1-Vlanif1]q
[sw1]interface vlan 2
[sw1-Vlanif2]dhcp select global
SW2:
[sw2]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[sw2]ip pool v1
[sw2-ip-pool-v1] gateway-list 172.16.1.126
[sw2-ip-pool-v1] network 172.16.1.0 mask 255.255.255.128
[sw2-ip-pool-v1] dns-list 114.114.114.114 8.8.8.8
[sw2-ip-pool-v1]#
[sw2-ip-pool-v1]ip pool v2
Info:It's successful to create an IP address pool.
[sw2-ip-pool-v2] gateway-list 172.16.1.254
[sw2-ip-pool-v2] network 172.16.1.128 mask 255.255.255.128
[sw2-ip-pool-v2] dns-list 114.114.114.114 8.8.8.8
[sw2-ip-pool-v2]q
[sw2]interface vlan 1
[sw2-Vlanif1]dhcp select global
[sw2]interface vlan 2
[sw2-Vlanif2]dhcp select global
3.配置路由器
将SW1和SW2上设置SVI
SW1:
[sw1]vlan 100
[sw1-Vlanif100]ip address 172.16.0.1 30
[sw1-Vlanif100]q
[sw1]interface g0/0/24
[sw1-GigabitEthernet0/0/24]port link-type access
[sw1-GigabitEthernet0/0/24]p d v 100
[sw1-GigabitEthernet0/0/24]stp edged-port enable
SW2:
[sw2]vlan 100
[sw2]interface vlan 100
[sw2-Vlanif100]ip address 172.16.0.5 30
[sw2]int g0/0/24
[sw2-GigabitEthernet0/0/24]port link-type access
[sw2-GigabitEthernet0/0/24]p d v 100
[sw2-GigabitEthernet0/0/24]stp edged-port enable
配置ospf
R1:
[r1-GigabitEthernet0/0/0]int g0/0/2
[r1-GigabitEthernet0/0/2]ip address 172.16.0.6 30
[r1-GigabitEthernet0/0/2]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 172.16.0.2 30
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 12.1.1.1 24
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
SW1:
[sw1]ospf 1 router-id 2.2.2.2
[sw1-ospf-1]area 0
[sw1-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[sw1-ospf-1-area-0.0.0.0]q
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.0 0.0.0.255
SW2:
[sw2]ospf 1 router-id 3.3.3.3
[sw2-ospf-1]area 0
[sw2-ospf-1-area-0.0.0.0]network 172.16.0.5 0.0.0.255
[sw2-ospf-1]area 1
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.0 0.0.0.255
路由汇总
SW1:
[sw1]ospf 1
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
SW2:
[sw2]ospf 1
[sw2-ospf-1]area 1
[sw2-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
配置静态的缺省路由
[r1]ip route-static 0.0.0.0 0 12.1.1.2
[r1-ospf-1]default-route-advertise
配置NAT
[r1]acl 2000
[r1-acl-basic-2000]ru
[r1-acl-basic-2000]rule pe
[r1-acl-basic-2000]rule permit s
[r1-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r1-acl-basic-2000]int g0/0/1
[r1-GigabitEthernet0/0/1]na
[r1-GigabitEthernet0/0/1]nat ou
[r1-GigabitEthernet0/0/1]nat outbound 2000