DHCP中继实战配置

一、配置拓扑

DHCP中继实战配置

文章插图
 
二、 关键配置1、配置VLAN、Trunk
1)、SW1的配置
SW1#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Et0/3
10 VLAN0010 active
20 VLAN0020 active
interface Ethernet0/0 //交换机互联接口配置为Trunk
switchport trunk encapsulation dot1q
switchport mode trunk
DHCP服务端口配置为Access vlan30
interface Ethernet0/1
switchport access vlan 30
switchport mode access
2、SW1的VLANIF配置
DHCP中继实战配置

文章插图
 
3、SW2的配置
划分接口VLAN:
interface Ethernet0/1
【DHCP中继实战配置】switchport access vlan 10
switchport mode access
interface Ethernet0/2
switchport access vlan 20
switchport mode access
配置Trunk:
interface Ethernet0/0
switchport trunk encapsulation dot1q
switchport mode trunk
4、DHCP服务器配置
ip dhcp pool VLAN10 //配置地址池分配IP地址段及掩码DNS
network 192.168.10.0 255.255.255.0
default-router 192.168.10.254
dns-server 8.8.8.8
lease 7
ip dhcp pool VLAN20 //配置地址池分配IP地址段及掩码DNS
network 192.168.20.0 255.255.255.0
default-router 192.168.20.254
dns-server 8.8.8.8
lease 7
ip dhcp excluded-address 192.168.10.254 //排除地址
ip dhcp excluded-address 192.168.20.254
配置DHCP中继:
interface Vlan10
ip address 192.168.10.254 255.255.255.0
ip helper-address 192.168.30.1
interface Vlan20
ip address 192.168.20.254 255.255.255.0
ip helper-address 192.168.30.1
三、DHCP测试PC1可以正常获取IP地址
DHCP中继实战配置

文章插图
 
PC2可以正常获取IP地址
PC2(config-if)#
*Aug 29 07:58:03.838: %DHCP-6-ADDRESS_ASSIGN: Interface Ethernet0/2 assigned DHCP address 192.168.20.1, mask 255.255.255.0, hostname PC2
DHCP中继实战配置

文章插图




    推荐阅读