一 需求分析
本实验的目的在于建立小型局域网。由于公司由财政部、人事部、科技部三个部门组成,分布在同一个交换机下。设计以下网络:三个个部门使用两台交换机连接,然后连接到汇聚交换机,再通过路由器与外网以及其他部门网络相连。为了控制网络上的广播风暴,增加网络的安全性,在交换机上需要设置VLAN,公司内部使用动态路由OSPF协议,所有主机均可通过dhcp自动获取ip地址。
二 规划拓扑
-
划分vlan:
vlan10 |
财政部 |
vlan20 |
人事部 |
vlan30 |
科技部 |
-
ip地址规划:
部门 |
网段 |
网关 |
财政部 |
192.168.10.0/24 |
192.168.10.254 |
人事部 |
192.168.20.0/24 |
192.168.20.254 |
科技部 |
192.168.30.0/24 |
192.168.30.254 |
设备 |
接口 |
ip地址 |
LSW1 |
valnif99 |
12.1.1.1/24 |
R1 |
g0/0/1 |
12.1.2.2/24 |
R1 |
g0/0/0 |
23.1.1.2/24 |
R2 |
g0/0/0 |
23.1.1.3/24 |
-
汇聚交换机配置dhcp功能,员工无需手动配置ip
-
采用一个汇聚交换机,两个二层交换机,汇聚交换机开启dhcp服务,合理划分vlan、利用trunk和access口
三 拓扑图
四 实验配置
4.1 二层交换机配置
无脑trunk和access就行了
LSW2:
[Huawei]vlan batch 10 20 30
[Huawei-Ethernet0/0/2]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/2]int e0/0/2
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 10
[Huawei-Ethernet0/0/4]port link-type access
[Huawei-Ethernet0/0/4]port default vlan 20
LSW3:
[Huawei]vlan batch 10 20 30
[Huawei-Ethernet0/0/2]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]port link-type trunk
[Huawei-Ethernet0/0/2]port trunk allow-pass vlan all
[Huawei-Ethernet0/0/1]int e0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 10
[Huawei-Ethernet0/0/3]int e0/0/4
[Huawei-Ethernet0/0/4]port link-type access
[Huawei-Ethernet0/0/4]port default vlan 20
LSW1:
[Huawei]vlan batch 10 20 30 99
[Huawei-GigabitEthernet0/0/2]int G0/0/1
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 99
[Huawei-GigabitEthernet0/0/1]int G0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type trunk
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[Huawei-GigabitEthernet0/0/2]int G0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan all
4.2配置vlanif口
LSW1:
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
interface Vlanif30
ip address 192.168.30.254 255.255.255.0
4.3配置dhcp服务
LSW1:
配置全局地址池
ip pool vlan10//配置全局地址池
gateway-list 192.168.10.254
network 192.168.10.0 mask 255.255.255.0
#
ip pool vlan20
gateway-list 192.168.20.254
network 192.168.20.0 mask 255.255.255.0
#
ip pool vlan30
gateway-list 192.168.30.254
network 192.168.30.0 mask 255.255.255.0
#
在vlanif口开启开启dhcp
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
dhcp select global
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
dhcp select global
#
interface Vlanif30
ip address 192.168.30.254 255.255.255.0
dhcp select global
4.4 公司内用ospf内部网关协议进行通信
LSW1:
[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei]int vlan 10
[Huawei-Vlanif10]ospf enable 1 area 0
[Huawei-Vlanif10]int vlan 20
[Huawei-Vlanif20]ospf enable 1 area 0
[Huawei-Vlanif20]int vlan 30
[Huawei-Vlanif30]ospf enable 1 area 0
[Huawei-Vlanif30]int vlan 99
[Huawei-Vlanif99]ospf enable 1 area 0
R1:
[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ospf enable area 0
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ospf enable area 0
R2:
[Huawei]ospf 1
[Huawei-ospf-1]area 0
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ospf enable area 0
[Huawei]int lo0
[Huawei-LoopBack0]ip address 11.11.11.11 32//在R2上配置lo0,ip地址为11.11.11.11/32,用于测试
[Huawei-LoopBack0]ospf enable area 0
实验完成
检查实验结果
pc1:
pc2:
pc3:
pc4:
实验成功