DHCP 动态主机配置协议

1.1         DHCP Server

1.1.1         拓扑

 

1.1.2         配置

1)配置接口IP

xNet#con t

xNet(config)#interface ge48

xNet(config-if)#ip address 192.168.15.1/24

xNet(config-if)#end

xNet#

2)配置DHCP Server地址池,网段与ge48匹配

xNet#con t

xNet(config)#ip dhcp pool xxx   //地址池

xNet(dhcp-config)#network 192.168.15.0/24    //地址池网段设置

xNet(dhcp-config)#range 192.168.15.100 192.168.15.110  //地址池添加范围

xNet(dhcp-config)#default-router 192.168.15.1

xNet(dhcp-config)#dns-server 192.168.15.1

xNet(dhcp-config)#end

xNet#

3)打开DHCP Server服务

xNet#con t

xNet(config)#service dhcp

xNet(config)#end

xNet#

 

1.1.3         结果

1)利用DHCP Client去动态获取IP

 

 

 

1.2         DHCP Relay

1.2.1         拓扑

 

1.2.2         配置

1)Server端添加一个其它网段的地址池

xNet#con t

xNet(config)#ip dhcp pool yyy

xNet(dhcp-config)#network 192.168.207.0/24

xNet(dhcp-config)#range 192.168.207.100 192.168.207.110

xNet(dhcp-config)#exit

xNet(config)#service dhcp

xNet(config)#end

xNet#

2)在中继端配置好相关配置并启动dhcp relay

xNet#con t

xNet(config)#ip dhcp relay server-ip 192.168.15.1

xNet(config)#ip dhcp relay information option

xNet(config)#ip dhcp relay information policy forward

xNet(config)#service dhcp relay

xNet(config)#end

xNet#

注:在Server端要回复外网段的地址时,需要配置路由,不然DHCP应答时找不到下一跳,该例配置一条静态路由

xNet#con t

xNet(config)#ip route 192.168.207.0/24 192.168.15.207

xNet(config)#end

xNet#

 

posted @ 2019-06-24 09:16  聂忠乐  阅读(474)  评论(0编辑  收藏  举报