HCIP---三层架构实验
一、实验要求
1.内网IP用172.16.0.0 /16合理分配
2.SW1/2之间互为备份
3.VRRP/STP/VLAN/TRUNK均使用
4.所有PC通过DHCP获取IP地址
二、实验拓扑
三、实验配置
[sw1]interface Eth-Trunk 0
[sw1-Eth-Trunk0]q
[sw1]port-group group-member GigabitEthernet 0/0/23 to GigabitEthernet 0/0/24
[sw1]int g0/0/23
[sw1-GigabitEthernet0/0/23]eth-trunk 0
[sw1-GigabitEthernet0/0/23]int g0/0/24
[sw1-GigabitEthernet0/0/24]eth-trunk 0
[sw2]interface Eth-Trunk 0
[sw2-Eth-Trunk0]q
[sw2]interface g0/0/23
[sw2-GigabitEthernet0/0/23]eth-trunk 0
[sw2-GigabitEthernet0/0/23]int g0/0/24
[sw2-GigabitEthernet0/0/24]eth-trunk 0
创建VLAN2:
[sw1]vlan 2
[sw1-vlan2]q
[sw1]port-group group-member GigabitEthernet 0/0/2 to GigabitEthernet 0/0/3 Eth-
Trunk 0
[sw1-port-group]port link-type trunk
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/3]port link-type trunk
[sw1-Eth-Trunk0]port link-type trunk
[sw1-port-group]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2
[sw1-Eth-Trunk0]port trunk allow-pass vlan 2
[sw2]vlan 2
[sw2-vlan2]q
[sw2]port-group group-member GigabitEthernet 0/0/2 to GigabitEthernet 0/0/3 Eth-
Trunk 0
[sw2-port-group]port link-type trunk
[sw2-GigabitEthernet0/0/2]port link-type trunk
[sw2-GigabitEthernet0/0/3]port link-type trunk
[sw2-Eth-Trunk0]port link-type trunk
[sw2-port-group]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2
[sw2-Eth-Trunk0]port trunk allow-pass vlan 2
[sw3]vlan 2
[sw3-vlan2]q
[sw3]interface Eth0/0/4
[sw3-Ethernet0/0/4]port link-type access
[sw3-Ethernet0/0/4]port default vlan 2
[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
[sw3-Ethernet0/0/1]port trunk allow-pass vlan 2
[sw3-Ethernet0/0/2]port trunk allow-pass vlan 2
[sw4]vlan 2
[sw4-vlan2]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
[sw4]interface Ethernet 0/0/4
[sw4-Ethernet0/0/4]port link-type access
[sw4-Ethernet0/0/4]port default vlan 2
调生成树:
[sw1]stp enable
[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
[sw2]stp enable
[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
[sw3]stp enable
[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]stp enable
[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
调整根网桥:
[sw1]stp instance 1 root primary
[sw1]stp instance 2 root secondary
[sw2]stp instance 1 root secondary
[sw2]stp instance 2 root primary
[sw3]port-group group-member Ethernet 0/0/3 to Ethernet 0/0/4
[sw3-port-group]stp edged-port enable
[sw3-Ethernet0/0/3]stp edged-port enable
[sw3-Ethernet0/0/4]stp edged-port enable
[sw4]port-group group-member Ethernet 0/0/3 to Ethernet 0/0/4
[sw4-port-group]stp edged-port enable
[sw4-Ethernet0/0/3]stp edged-port enable
[sw4-Ethernet0/0/4]stp edged-port enable
做SVI:
[sw1]interface Vlanif 1
[sw1-Vlanif1]ip address 172.16.1.1 25
[sw1]interface Vlanif 2
[sw1-Vlanif2]ip address 172.16.1.129 25
[sw2]interface Vlanif 1
[sw2-Vlanif1]ip address 192.16.1.2 25
[sw2]interface Vlanif 2
[sw2-Vlanif2]ip address 172.16.1.130 25
做VRRP:
[sw1]interface Vlanif 1
[sw1-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.126
[sw1-Vlanif1]vrrp vrid 1 priority 105
[sw1-Vlanif1]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 6
[sw1]interface Vlanif 2
[sw1-Vlanif2]vrrp vrid 1 virtual-ip 172.161.254
[sw2]interface Vlanif 1
[sw2-Vlanif1]vrrp vrid 1 virtual-ip172.16.1.126
[sw2]interface Vlanif 2
[sw2-Vlanif2]vrrp vrid 2 virtual-ip 172.16.1.254
[sw2-Vlanif2]vrrp vrid 1 priority 105
[sw2-Vlanif2]vrrp vrid 1 track interface GigabitEthernet 0/0/1 reduced 6
做DHCP:
[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 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
[sw1]interface Vlanif 1
[sw1-Vlanif1]dhcp select global
[sw1]interface Vlanif 2
[sw1-Vlanif2]dhcp select global
sw2一样的做法
交换下边做完了 开始配置公网:
[r1]interface g0/0/2
[r1-GigabitEthernet0/0/2]ip address 12.1.1.1 24
[r1-GigabitEthernet0/0/2]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 172.16.0.1 30
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 172.16.0.5 30
[isp]interface g0/0/2
[isp-GigabitEthernet0/0/2]ip add 12.1.1.2 24
[isp-GigabitEthernet0/0/2]int l0
[isp-LoopBack0]ip add 6.6.6.6 24
[sw1]vlan 99
[sw1-vlan99]q
[sw1]interface Vlanif 99
[sw1-Vlanif99]ip add 172.16.0.2 30
[sw1]interface g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 99
[sw2]vlan 99
[sw2-vlan99]q
[sw2]interface Vlanif 99
[sw2-Vlanif99]ip address 172.16.0.6 30
[sw2-Vlanif99]q
[sw2]interface g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access
[sw2-GigabitEthernet0/0/1]port default vlan 99
核心层跑ospf,但是无法汇总:
[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.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 172.16.0.5 0.0.0.0
[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.2 0.0.0.0
[sw1-ospf-1]area 1
[sw1-ospf-1-area-0.0.0.1]
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.1 0.0.0.0
[sw1-ospf-1-area-0.0.0.1]network 172.16.1.129 0.0.0.0
[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.6 0.0.0.0
[sw2-ospf-1]area 1
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.2 0.0.0.0
[sw2-ospf-1-area-0.0.0.1]network 172.16.1.130 0.0.0.0
[sw1-ospf-1]silent-interface all
[sw1-ospf-1]undo silent-interface GigabitEthernet 0/0/1
[sw1-ospf-1]undo silent-interface Eth-Trunk 0
[sw1-ospf-1]undo silent-interface Vlanif 1
[sw1-ospf-1]undo silent-interface Vlanif 99
[sw1-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
[sw2-ospf-1]silent-interface GigabitEthernet 0/0/2
[sw2-ospf-1]silent-interface GigabitEthernet 0/0/3
[sw2-ospf-1]silent-interface Vlanif 2
[sw2-ospf-1-area-0.0.0.1]abr-summary 172.16.1.0 255.255.255.0
最后做缺省和nat:
[r1]ip route-static 0.0.0.0 0 12.1.1.2
[r1]ospf 1
[r1-ospf-1]default-route-advertise
[r1-ospf-1]q
[r1]acl 2000
[r1-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[r1]interface GigabitEthernet 0/0/2
[r1-GigabitEthernet0/0/2]nat outbound 2000
防环;
[sw1]ip route-static 172.16.1.0 24 NULL 0
[sw2]ip route-static 172.16.1.0 24 NULL 0
四、测试
作者:ChAn
-------------------------------------------
个性签名:今天做了别人不想做的事,明天你就做得到别人做不到的事,尝试你都不敢,你拿什么赢!
如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!