华为ensp小型综合实验

一、网络拓扑

在这里插入图片描述

二、网络配置

  • 交换机直连终端设备使用access,并划分到各自的vlan中。
  • 首先在路由器上配置DHCP(中继),并给vlan10-40配置DHCP的地址池,下发地址。
  • 使用ospf打通各个网络
  • 使用nat访问外网

1.交换机配置

交换机SW1代码如下:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys SW1
[SW1]v b 10
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]p g e0/0/1 to e0/0/2
[SW1-port-group]p l a
[SW1-Ethernet0/0/1]p l a
[SW1-Ethernet0/0/2]p l a
[SW1-port-group]p d v 10
[SW1-Ethernet0/0/1]p d v 10
[SW1-Ethernet0/0/2]p d v 10
[SW1-port-group]q
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l a
[SW1-GigabitEthernet0/0/1]p d v 10
[SW1-GigabitEthernet0/0/1]q

交换机SW2代码如下:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys SW2
[SW2]v b 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]p g e0/0/1 to e0/0/2
[SW2-port-group]p l a
[SW2-Ethernet0/0/1]p l a
[SW2-Ethernet0/0/2]p l a
[SW2-port-group]p d v 20
[SW2-Ethernet0/0/1]p d v 20
[SW2-Ethernet0/0/2]p d v 20
[SW2-port-group]q
[SW2]int g0/0/1
[SW2-GigabitEthernet0/0/1]p l a
[SW2-GigabitEthernet0/0/1]p d v 20
[SW2-GigabitEthernet0/0/1]q

交换机SW3代码如下:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys SW3
[SW3]v b 30
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW3]p g e0/0/1 to e0/0/2
[SW3-port-group]p l a
[SW3-Ethernet0/0/1]p l a
[SW3-Ethernet0/0/2]p l a
[SW3-port-group]p d v 30
[SW3-Ethernet0/0/1]p d v 30
[SW3-Ethernet0/0/2]p d v 30
[SW3-port-group]q
[SW3]int g0/0/1
[SW3-GigabitEthernet0/0/1]p l a
[SW3-GigabitEthernet0/0/1]p d v 30
[SW3-GigabitEthernet0/0/1]q

交换机SW4代码如下:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys SW4
[SW4]v b 40
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW4]p g e0/0/1 to e0/0/2
[SW4-port-group]p l a
[SW4-Ethernet0/0/1]p l a
[SW4-Ethernet0/0/2]p l a
[SW4-port-group]p d v 40
[SW4-Ethernet0/0/1]p d v 40
[SW4-Ethernet0/0/2]p d v 40
[SW4-port-group]q
[SW4]int g0/0/1
[SW4-GigabitEthernet0/0/1]p l a
[SW4-GigabitEthernet0/0/1]p d v 40
[SW4-GigabitEthernet0/0/1]q

交换机S1代码如下:

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys S1
[S1]v b 10 20 30 40 50
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1]int vlanif 10
[S1-Vlanif10]ip add 192.168.10.254 24
[S1-Vlanif10]int vlanif 20
[S1-Vlanif20]ip add 192.168.20.254 24
[S1-Vlanif20]int vlanif 30
[S1-Vlanif30]ip add 192.168.30.254 24
[S1-Vlanif30]int vlanif 40
[S1-Vlanif40]ip add 192.168.40.254 24
[S1-Vlanif40]int vlanif 50
[S1-Vlanif50]ip add 192.168.50.1 29
[S1-Vlanif50]q
[S1]int g0/0/2
[S1-GigabitEthernet0/0/2]p l a
[S1-GigabitEthernet0/0/2]p d v 10
[S1-GigabitEthernet0/0/2]int g0/0/3
[S1-GigabitEthernet0/0/3]p l a
[S1-GigabitEthernet0/0/3]p d v 20
[S1-GigabitEthernet0/0/3]int g0/0/04
[S1-GigabitEthernet0/0/4]p l a
[S1-GigabitEthernet0/0/4]p d v 30
[S1-GigabitEthernet0/0/4]int g0/0/5
[S1-GigabitEthernet0/0/5]p l a
[S1-GigabitEthernet0/0/5]p d v 40
[S1-GigabitEthernet0/0/5]int g0/0/1
[S1-GigabitEthernet0/0/1]p l t
[S1-GigabitEthernet0/0/1]p t a v a
[S1-GigabitEthernet0/0/1]p t p v 50
[S1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.

DHCP中继

[S1]int vlanif 10
[S1-Vlanif10]dhcp select relay 
[S1-Vlanif10]dhcp relay server-ip 192.168.50.2 这个IP地址是路由器连接交换机的IP地址 
[S1-Vlanif10]int vlanif 20
[S1-Vlanif20]dhcp select relay
[S1-Vlanif20]dhcp relay server-ip 192.168.50.2
[S1-Vlanif20]int vlanif 30
[S1-Vlanif30]dhcp select relay
[S1-Vlanif30]dhcp relay server-ip 192.168.50.2
[S1-Vlanif30]int vlanif 40
[S1-Vlanif40]dhcp select relay
[S1-Vlanif40]dhcp relay server-ip 192.168.50.2

[S1]ospf 1
[S1-ospf-1]area 0
[S1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
[S1-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255
[S1-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
[S1-ospf-1-area-0.0.0.0]network 192.168.40.0 0.0.0.255
[S1-ospf-1-area-0.0.0.0]network 192.168.50.0 0.0.0.7
[S1-ospf-1-area-0.0.0.0]q

2.路由器配置

代码如下(示例):

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys 	
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.50.2 29 这个IP地址要与交换机IP地址同一网段
[R1-GigabitEthernet0/0/0]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 200.200.200.1 30
[R1-GigabitEthernet0/0/1]q
[R1]ip pool vlan10
[R1-ip-pool-vlan10]network 192.168.10.0 mask 24 网段
[R1-ip-pool-vlan10]gateway-list 192.168.10.254  网关
[R1-ip-pool-vlan10]dns-list 8.8.8.8
[R1-ip-pool-vlan10]q
[R1]ip pool vlan20
[R1-ip-pool-vlan20]network 192.168.20.0 mask 24 网段
[R1-ip-pool-vlan20]gateway-list 192.168.20.254  网关
[R1-ip-pool-vlan20]dns-list 8.8.8.8
[R1-ip-pool-vlan20]q
[R1]ip pool vlan30
[R1-ip-pool-vlan30]network 192.168.30.0 mask 24 网段
[R1-ip-pool-vlan30]gateway-list 192.168.30.254  网关
[R1-ip-pool-vlan30]dns-list 8.8.8.8
[R1-ip-pool-vlan30]q
[R1]ip pool vlan40
[R1-ip-pool-vlan40]network 192.168.40.0 mask 24 网段
[R1-ip-pool-vlan40]gateway-list 192.168.40.254  网关
[R1-ip-pool-vlan40]dns-list 8.8.8.8
[R1-ip-pool-vlan40]q
[R1]dhcp enable 
Info: The operation may take a few seconds. Please wait for a moment.done.
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global 
[R1-GigabitEthernet0/0/0]q
[R1]ip route-static 0.0.0.0 0 192.168.50.1
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.50.0 0.0.0.7
[R1-ospf-1-area-0.0.0.0]network 200.200.200.0 0.0.0.3
[R1-ospf-1-area-0.0.0.0]q
[R1]acl 2000	
[R1-acl-basic-2000]rule permit source 192.168.0.0 0.0.255.255
[R1-acl-basic-2000]q
[R1]int g0/0/1  出口
[R1-GigabitEthernet0/0/1]nat outbound 2000
[R1-GigabitEthernet0/0/1]q

三.网络测试

1.dhcp测试(改IP地址方式为dhcp)
在这里插入图片描述
使用命令config
在这里插入图片描述

2.内网测试
在这里插入图片描述
在这里插入图片描述
3.内网ping外网测试
在这里插入图片描述
4.nat转换测试
在这里插入图片描述

初次写文章,实验不足之处,请多多指教。

  • 5
    点赞
  • 82
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值