实验要求及拓扑
一、思路
1. 先配置接入层的接口类型及划分
2.配置汇聚层的接口类型及划分
3.配置汇聚层的IP地址及编写缺省、NAT--IP地址转换
4. 给vlan分组,定义组 的主根,组的备份根
5.汇聚层之间使用通道技术(华为:以太网中继Eth-Trunk) 通道技术将多个接口逻辑的整合为一个接口
6.给汇聚层和核心层之间的交换机接口配置IP地址
7.在汇聚层配置DHCP服务
8.使用OSPF使汇聚层与核心层互通
9.给公网配置IP及环回及给汇聚层写缺省
二、上机操作
1. 先配置接入层的接口类型及划分
因lsw3和lsw4配置相同,故只写一次配置
vlan batch 2 to 3
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface Ethernet0/0/3
port link-type access
port default vlan 2
interface Ethernet0/0/4
port link-type access
port default vlan 3
2.配置汇聚层的接口类型及划分
因lsw1和lsw2配置相同,故只写一次配置
vlan batch 2 to 3 6
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface GigabitEthernet0/0/1
port link-type access
port default vlan 6
3.配置汇聚层的IP地址及编写缺省、NAT--IP地址转换
配置IP地址
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.1.1 255.255.255.0
interface GigabitEthernet0/0/2
ip address 192.168.0.1 255.255.255.0
缺省
ip route-static 0.0.0.0 0.0.0.0 12.1.1.1
NAT--IP地址转换
acl number 2000
rule 5 permit source 192.168.0.0 0.0.255.255
interface GigabitEthernet0/0/0
nat outbound 2000
4. 给vlan分组,定义组的主根,组的备份根
给lsw1到lsw4 的vlan分组
因lsw1到lsw4配置相同,故只写一次配置
stp region-configuration
instance 1 vlan 2
instance 2 vlan 3
active region-configuration
lsw1定义组1的主根,组2的备份根
stp instance 1 root primary
stp instance 2 root secondary
lsw2定义组2的主根,组1的备份根
stp instance 2 root primary
stp instance 1 root secondary
5.汇聚层之间使用通道技术(华为:以太网中继Eth-Trunk) 通道技术将多个接口逻辑的整合为一个接口
因lsw1和lsw2配置相同,故只写一次配置
interface Eth-Trunk0
interface Ethernet0/0/3
eth-trunk 0
interface Ethernet0/0/4
eth-trunk 0
interface Eth-Trunk0
port link-type trunk
port trunk allow-pass vlan 2 to 3
6.给汇聚层和核心层之间的交换机接口配置IP地址
interface Vlanif6
ip address 192.168.0.2 255.255.255.0
interface Vlanif6
ip address 192.168.1.2 255.255.255.0
为什么给vlan配置IP因为
interface GigabitEthernet0/0/1
port link-type access
port default vlan 6
7.在汇聚层配置DHCP服务
配地址池
lsw1
ip pool vlan2
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
ip pool vlan3
gateway-list 192.168.3.254
network 192.168.3.0 mask 255.255.255.0
lsw2
ip pool vlan2
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
ip pool vlan3
gateway-list 192.168.3.254
network 192.168.3.0 mask 255.255.255.0
配虚拟网关
lsw1
interface Vlanif2
ip address 192.168.2.1 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.2.254
vrrp vrid 1 priority 120
vrrp vrid 1 preempt-mode timer delay 20
vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 30
dhcp select global
interface Vlanif3
ip address 192.168.3.1 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.3.254
dhcp select global
lsw2
interface Vlanif2
ip address 192.168.2.2 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.2.254
dhcp select global
interface Vlanif3
ip address 192.168.3.2 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.3.254
vrrp vrid 1 priority 120
vrrp vrid 1 preempt-mode timer delay 20
vrrp vrid 1 track interface GigabitEthernet0/0/1 reduced 30
dhcp select global
8.使用OSPF使汇聚层与核心层互通
核心层
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 192.168.0.0 0.0.255.255
核心层
lsw1
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 192.168.0.0 0.0.255.255
lsw2
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.0.0 0.0.255.255
9.给公网配置IP及环回及给汇聚层写缺省
给公网R2配置IP及环回
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
给汇聚层写缺省
ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
ip route-static 0.0.0.0 0.0.0.0 192.168.0.1
三、检验
1.看路由表
2.看DHCP自动分配情况
3.持续ping一个IP然后关闭它的网关会如何
说明他会自动切换网关
4.ping一个IP看流量走向
文章来源:https://www.toymoban.com/news/detail-662059.html
文章来源地址https://www.toymoban.com/news/detail-662059.html
结果:如上图
vlan2流量以从Ethernet0/0/1出
vlan3流量以从Ethernet0/0/2回
lsw1为vlan2根
lsw1为vlan3根
到了这里,关于关于vlan的三层架构实验的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!