三层交换机【实验】

目录

1、要求:

2、拓扑:

3、创建vlan和端口定义并划入vlan:

4、创建以太网中继Eth-Trunk使sw1和sw2的相互冗余并且不浪费链路:

5、使用mstp定义组和对应的根:

 6、配置网关冗余:

7、核心层的路由的IP配置:

8、通过ospf动态使核心层互通:

 9、开启DHCP:

10、配置公网ip,r2仅需写一条缺省指向r1

11、在r2上写nat并向sw1和sw2通过ospf发送一条缺省使其内网可以访问外网:

 12、将sw3、sw4的连接pc的接口设置为边缘接口,加快收敛:

13、沉默接口,减少带宽占用


1、要求:

2、拓扑:

3、创建vlan和端口定义并划入vlan:

[sw1]vlan 2
[sw1]vlan 3
[sw1]in g0/0/2
[sw1-GigabitEthernet0/0/2]port link-t trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[sw1-GigabitEthernet0/0/2]in g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type trunk 
[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2
#sw2同sw1
[sw3]vlan 2
[sw3]vlan 3
[sw3]in e0/0/2	
[sw3-Ethernet0/0/2]port link-type access 
[sw3-Ethernet0/0/2]port default vlan 2
#sw4同sw3

4、创建以太网中继Eth-Trunk使sw1和sw2的相互冗余并且不浪费链路:

[sw1]interface Eth-Trunk 1  创建通道接口
[sw1]interface GigabitEthernet 0/0/1  将物理接口加入到通道内
[sw1-GigabitEthernet0/0/1]eth-trunk 1
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]eth-trunk 1

5、使用mstp定义组和对应的根:

[sw1]stp enable
[sw1]stp region-configuration
[sw1-mst-region]region-name 2
[sw1-mst-region]instance 1 vlan 1
[sw1-mst-region]instance 2 vlan 2
[sw1-mst-region]active region-configuration 
[sw1]stp instance 1 root primary 
[sw1]stp instance 2 root secondary 

[sw2]stp enable 
[sw2]stp region-configuration 
[sw2-mst-region]region-name 2
[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]stp enable 
[sw3]stp region-configuration
[sw3-mst-region]region-name 2
[sw3-mst-region]instance 1 vlan 1
[sw3-mst-region]instance 2 vlan 2
[sw3-mst-region]active region-configuration 
#4同sw3配置

 6、配置网关冗余:

[sw1]int vlanif 1 
[sw1-Vlanif1] ip address 172.16.1.1 24
[sw1-Vlanif1] vrrp vrid 1 virtual-ip 172.16.1.250
[sw1-Vlanif1]vrrp vrid 1 priority 120  
[sw1-Vlanif1] vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 21

[sw2]int vlanif 1 
[sw2-Vlanif1] ip address 172.16.1.2 24
[sw2-Vlanif1] vrrp vrid 1 virtual-ip 172.16.1.250


[sw2]int vlanif 2 
[sw2-Vlanif2] ip address 172.16.2.1 24
[sw2-Vlanif2] vrrp vrid 2 virtual-ip 172.16.2.250
[sw2-Vlanif2]vrrp vrid 2 priority 120  
[sw2-Vlanif2] vrrp vrid 2 track interface GigabitEthernet0/0/1 reduced 21

[sw1]int vlanif2 
[sw1-Vlanif2] ip address 172.16.2.2 24
[sw1-Vlanif2] vrrp vrid 2 virtual-ip 172.16.2.250

7、核心层的路由的IP配置:

[r2]in g0/0/1
[r2-GigabitEthernet0/0/1]ip add 172.16.0.1 30
[r2-GigabitEthernet0/0/1]in g0/0/2
[r2-GigabitEthernet0/0/2]ip add 172.16.0.5 30
[sw1]vlan 3
[sw1]interface Vlanif 3
[sw1-Vlanif3]ip address 172.16.0.2 30

8、通过ospf动态使核心层互通:

[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]default-route-advertise
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 172.16.0.5 0.0.0.0

[sw1]ospf 1 router-id 11.11.11.11
[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-0.0.0.0]network 172.16.1.0 0.0.0.255
[sw1-ospf-1-area-0.0.0.0]network 172.16.2.0 0.0.0.255

[sw2]ospf 1 router-id 22.22.22.22
[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-0.0.0.0]network 172.16.1.0 0.0.0.255
[sw2-ospf-1-area-0.0.0.0]network 172.16.2.0 0.0.0.255

 9、开启DHCP:

[sw1]dhcp enable
[sw1]ip pool p1
[sw1-ip-pool-p1]network 172.16.1.0 mask 24
[sw1-ip-pool-p1]gateway-list 172.16.1.250
[sw1]ip pool p2
[sw1-ip-pool-p2]network 172.16.2.0 mask 24
[sw1-ip-pool-p2]gateway-list 172.16.2.250
#
[sw1]int Vlanif 1	
[sw1-Vlanif1]dhcp select global 	
[sw1-ip-pool-p2]int Vlanif 2
[sw1-Vlanif2]dhcp select global

10、配置公网ip,r2仅需写一条缺省指向r1

[r1]dis ip in b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.2/30          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         1.1.1.1/24           up         up(s)     
NULL0                             unassigned           up         up(s) 
#
[r2]ip route-static 0.0.0.0 0 12.1.1.2

 

11、在r2上写nat并向sw1和sw2通过ospf发送一条缺省使其内网可以访问外网:

[r2]acl 2023	
[r2-acl-basic-2023]rule permit source 172.16.0.0 0.0.255.255
[r2-acl-basic-2023]in g0/0/0
[r2-GigabitEthernet0/0/0]nat outbound 2023
#
[r2-ospf-1]default-route-advertise

 

 12、将sw3、sw4的连接pc的接口设置为边缘接口,加快收敛:

[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]stp edged-port enable	
[sw3-GigabitEthernet0/0/1]int g0/0/2
[sw3-GigabitEthernet0/0/2]stp edged-port enable
#sw4同

13、沉默接口,减少带宽占用

[sw1]ospf 1
[sw1-ospf-1]silent-interface all 
#先沉默所有,在开启需要ospf建邻的接口
[sw1-ospf-1]undo silent-interface GigabitEthernet 0/0/1
[sw1-ospf-1]undo silent-interface Eth-Trunk 1
[sw1-ospf-1]undo silent-interface vlanif 1
[sw1-ospf-1]undo silent-interface vlanif 2
[sw1-ospf-1]undo silent-interface vlanif 3
#sw2相同
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

.98℃

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值