ensp DHCP+子接口实验

此实验,可以学到以下知识点:

1.如何基于地址池配置dhcp

2.如何配置子接口

实验结果:

vlan10会获取pool_10内的地址,vlan20会获取pool_20内的地址

设备:AR2220*1,S5700*1,PC*2

拓扑图:

1.DHCP_Server配置:

1.配置地址池

为vlan10 创建地址池

(Huawei)sys
[Huawei]sys DHCP_server
[DHCP_server]dhcp enable//启用dhcp
[DHCP_server]ip pool pool_10创建一个全局地址池
Info: It's successful to create an IP address pool.
[DHCP_server-ip-pool-pool_10]network 192.168.10.0 mask 24//创建地址池
[DHCP_server-ip-pool-pool_10]gateway-list 192.168.10.1//网关地址,后面会被配置于g0/0/0.10
[DHCP_server-ip-pool-pool_10]dns-list 8.8.8.8//dns服务器地址
[DHCP_server-ip-pool-pool_10]excluded-ip-address 192.168.10.2 192.168.10.10//配置排除地址
[DHCP_server-ip-pool-pool_10]dis this//检查配置
[V200R003C00]
#
ip pool pool_10
 gateway-list 192.168.10.1 
 network 192.168.10.0 mask 255.255.255.0 
 excluded-ip-address 192.168.10.2 192.168.10.10 
 dns-list 8.8.8.8 
#
return

为vlan20创建地址池

[DHCP_server]ip pool pool_20
Info: It's successful to create an IP address pool.
[DHCP_server-ip-pool-pool_20]net 192.168.20.0 mask 24
[DHCP_server-ip-pool-pool_20]gateway-list 192.168.20.1
[DHCP_server-ip-pool-pool_20]dns 8.8.8.8
[DHCP_server-ip-pool-pool_20]dis this
[V200R003C00]
#
ip pool pool_20
 gateway-list 192.168.20.1 
 network 192.168.20.0 mask 255.255.255.0 
 dns-list 8.8.8.8 
#
return

2.路由器接口配置

对g0/0/0.10进行配置

[DHCP_server]int g0/0/0.10
[DHCP_server-GigabitEthernet0/0/0.10]ip add 192.168.10.1 24	
[DHCP_server-GigabitEthernet0/0/0.10]dot1q termination vid 10//封装虚拟局域网号为10 
[DHCP_server-GigabitEthernet0/0/0.10]dhcp select global //从全局地址池中获取地址
[DHCP_server-GigabitEthernet0/0/0.10]display this
[V200R003C00]
#
interface GigabitEthernet0/0/0.10
 dot1q termination vid 10
 ip address 192.168.10.1 255.255.255.0 
 dhcp select global
#
return

g0/0/0.20配置

[DHCP_server]int g0/0/0.20
[DHCP_server-GigabitEthernet0/0/0.20]ip address 192.168.20.1 24
[DHCP_server-GigabitEthernet0/0/0.20]dot1q termination v 20	
[DHCP_server-GigabitEthernet0/0/0.20]dhcp se glo
[DHCP_server-GigabitEthernet0/0/0.20]dis this
[V200R003C00]
#
interface GigabitEthernet0/0/0.20
 dot1q termination vid 20
 ip address 192.168.20.1 255.255.255.0 
 dhcp select global
#
return

路由器部分配置完毕

2.交换机配置

[SW1]vlan batch 10 20//创建vlan
[SW1]interface g0/0/3
[SW1-GigabitEthernet0/0/3]port link-type trunk 
[SW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20//配置为trunk模式并仅允许vlan10和20通过
[SW1-GigabitEthernet0/0/3]int g0/0/1
[SW1-GigabitEthernet0/0/1]port link-type access 	
[SW1-GigabitEthernet0/0/1]port default vlan 10//所属vlan
//配置g0/0/2
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port lin ac
[SW1-GigabitEthernet0/0/2]port de vlan 20

3.pc获取地址

将获取模式调为dhcp

pc2同理

目的达成,实验结束

4.疑问

为什么他们可以按照vlan地址号获取相应的地址池?

答:因为划分vlan并配置子接口后,路由器的g0/0/0.10(封装了vlan号10)与交换机的g0/0/1接口(被划分进vlan10)算是一个逻辑上的局域网,因此当pc1发出dhcp请求后,配置在g0/0/0.10上的192.168.10.1会回复pc1,并分配地址。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值