HCIP---三层架构

1. 基本配置 IP地址环回地址
(1) r1
[r1]int g0/0/2
[r1-GigabitEthernet0/0/2]ip add 12.1.1.1 24
[r1-GigabitEthernet0/0/2]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 23.1.1.1 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 34.1.1.1 24
[r1]int LoopBack 0
[r1-LoopBack0]ip add 1.1.1.1 32

(2) r2

[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[r2]int LoopBack 0
[r2-LoopBack0]ip add 2.2.2.2 32
2.划分vlan区域
(1) SW1
[SW1]interface Vlanif 1
[SW1-Vlanif1]ip add 23.1.1.2 24

(2) SW2

[SW2]interface Vlanif 1
[SW2-Vlanif1]ip add 34.1.1.2 24
3.SW1和SW2之间接口汇聚
(1) SW1
[SW1]interface Eth-Trunk 1
[SW1-Eth-Trunk1]q
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]eth-trunk 1
[SW1]int g0/0/3
[SW1-GigabitEthernet0/0/3]eth-trunk 1
[SW1]int g0/0/7
[SW1-GigabitEthernet0/0/3]eth-trunk 1
[SW1]interface Eth-Trunk 1    
[SW1-Eth-Trunk1]port link-type trunk 
[SW1-Eth-Trunk1]port trunk allow-pass vlan all 

(2) SW2

[SW2]interface Eth-Trunk 1
[SW2-Eth-Trunk1]q
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]eth-trunk 1
[SW2-GigabitEthernet0/0/2]int g0/0/3
[SW2-GigabitEthernet0/0/3]eth-trunk 1
[SW2-GigabitEthernet0/0/3]int g0/0/7
[SW2-GigabitEthernet0/0/7]eth-trunk 1
[SW2]interface Eth-Trunk 1
[SW2-Eth-Trunk1]port link-type trunk 
[SW2-Eth-Trunk1]port trunk allow-pass vlan all 
3.启用端口接入模式并修改vlan区域
(1) vlan2
[SW1]interface g0/0/4	
[SW1-GigabitEthernet0/0/4]port link-type access 
[SW1-GigabitEthernet0/0/4]port default vlan 2
[SW2]int g0/0/4
[SW2-GigabitEthernet0/0/4]port link-type access 	
[SW2-GigabitEthernet0/0/4]port default vlan 2
[SW3]vlan 2
[SW3-vlan2]q
[SW3]port-group 1
[SW3-port-group-1]group-member e0/0/1 to e0/0/4
[SW3-port-group-1]port link-type access 	
[SW3-port-group-1]port default vlan 2

(2) vlan3

[SW1]interface g0/0/5
[SW1-GigabitEthernet0/0/5]port link-type access 
[SW1-GigabitEthernet0/0/5]port default vlan 3
[SW2]interface g0/0/5
[SW2-GigabitEthernet0/0/5]port link-type access 
[SW2-GigabitEthernet0/0/5]port default vlan 3
[SW4]vlan 3
[SW4-vlan3]q
[SW4]port-group 1
[SW4-port-group-1]group-member e0/0/1 to e0/0/4
[SW4-port-group-1]port link-type access 	
[SW4-port-group-1]port default vlan 3

(3)vlan3 和4

[SW1]interface g0/0/6
[SW1-GigabitEthernet0/0/6]port link-type trunk 
[SW1-GigabitEthernet0/0/6]port trunk allow-pass vlan all 
[SW2]interface g0/0/6	
[SW2-GigabitEthernet0/0/6]port link-type trunk 	
[SW2-GigabitEthernet0/0/6]port trunk allow-pass vlan all 
[SW5]interface e0/0/1	
[SW5-Ethernet0/0/1]port link-type access 
[SW5-Ethernet0/0/1]port link-type trunk 
[SW5-Ethernet0/0/1]port trunk allow-pass vlan all
[SW5-Ethernet0/0/1]int e0/0/2
[SW5-Ethernet0/0/2]port link-type trunk 	
[SW5-Ethernet0/0/2]port trunk allow-pass vlan all
[SW5-Ethernet0/0/2]int e0/0/3
[SW5-Ethernet0/0/3]port link-type access 
[SW5-Ethernet0/0/3]port default vlan 2
[SW5-Ethernet0/0/3]int e0/0/4
[SW5-Ethernet0/0/4]port link-type access 
[SW5-Ethernet0/0/4]port default vlan 3
4.MSTP协议生成树
(1)SW1
[SW1]stp mode mstp
[SW1]stp region-configuration 
[SW1-mst-region]region-name a
[SW1-mst-region]instance 1 vlan 2
[SW1-mst-region]instance 2 vlan 3
[SW1-mst-region]active region-configuration 
[SW1]stp instance 1 root primary 
[SW1]stp instance 2 root secondary 
(2)SW2
[SW2]stp mode mstp
[SW2]stp region-configuration 
[SW2-mst-region]region-name a
[SW2-mst-region]instance 1 vlan 2
[SW2-mst-region]instance 2 vlan 3
[SW2-mst-region]active region-configuration 
[SW2]stp instance 1 root secondary 
[SW2]stp instance 2 root primary 
5.ospf宣告已知网段
(1)r1
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0	
[r1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[r1-ospf-1]default-route-advertise
[r1]ip route-static 0.0.0.0 0 12.1.1.2
(2)SW1
[SW1]ospf 1 router-id 2.2.2.2
[SW1-ospf-1]area 0
[SW1-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
(3)SW2
[SW2]ospf 1 router-id 3.3.3.3
[SW2-ospf-1]area 0
[SW2-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
6.管理vlan
(1)SW1
[SW1]interface Vlanif 2
[SW1-Vlanif2]ip address 192.168.1.1 24
[SW1]interface Vlanif 3
[SW1-Vlanif2]ip address 172.16.1.1 24
[SW1]interface Vlanif 2
[SW1-Vlanif2]ip address 192.168.1.1 24
[SW1]interface Vlanif 3
[SW1-Vlanif2]ip address 172.16.1.1 24
7.在汇聚层配置VRRP协议
(1)SW1
[SW1]interface Vlanif 2	
[SW1-Vlanif2]vrrp vrid 1 virtual-ip 192.168.1.1
[SW1-Vlanif2]ip address 192.168.1.1 24
[SW1-Vlanif2]vrrp vrid 1 priority 120	
[SW1-Vlanif2]vrrp vrid 1 preempt-mode timer delay 20
[SW1]interface Vlanif 3
[SW1-Vlanif3]vrrp vrid 2 virtual-ip 172.16.1.2
(2)SW2
[SW2]interface Vlanif 2
[SW2-Vlanif2]vrrp vrid 1 virtual-ip 192.168.1.1
[SW2]interface Vlanif 3
[SW2-Vlanif3]vrrp vrid 2 virtual-ip 172.16.1.2
[SW2-Vlanif3]vrrp vrid 2 priority 120
[SW2-Vlanif3]vrrp vrid 2 preempt-mode timer delay 20
8.书写DHCP协议自动分配IP地址
(1)SW1
[SW1]ip pool 1
[SW1-ip-pool-1]network 192.168.1.0 mask 24	
[SW1-ip-pool-1]gateway-list 192.168.1.1
[SW1-ip-pool-1]dns-list 8.8.8.8
[SW1]interface Vlanif 2
[SW1-Vlanif2]dhcp select global 
[SW1]ip pool 2
[SW1-ip-pool-2]network 172.16.1.0 mask 24
[SW1-ip-pool-2]gateway-list 172.16.1.2
[SW1-ip-pool-2]dns-list 8.8.8.8	
[SW1]interface Vlanif 3	
[SW1-Vlanif3]dhcp select global 

(2)SW2

[SW2]ip pool 1
[SW2-ip-pool-1]network 192.168.1.0 mask 24
[SW2-ip-pool-1]gateway-list 192.168.1.1
[SW2-ip-pool-1]dns-list 8.8.8.8
[SW2]interface Vlanif 2
[SW2-Vlanif2]dhcp select global 
[SW2]ip pool 3
[SW2-ip-pool-3]network 172.16.1.0 mask 24	
[SW2-ip-pool-3]gateway-list 172.16.1.2
[SW2-ip-pool-3]dns-list 8.8.8.8
[SW2]interface Vlanif 3
[SW2-Vlanif3]dhcp select global 
9.开启各PC的DHCP服务

image-20240126185519970

10.r1配置NAT策略可以访问外网
[r1]acl 2000	
[r1-acl-basic-2000]rule permit source any 
[r1]interface g0/0/2
[r1-GigabitEthernet0/0/2]nat outbound 2000


 

  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值