博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
DHCP relay 原理
阅读量:6214 次
发布时间:2019-06-21

本文共 5158 字,大约阅读时间需要 17 分钟。

DHCP relay 原理

    1 当dhcp client 启动并进行dhcp 初始化时,它会在本地网络广播配置请求报文。     2 如果本地网络存在dhcp server,则可以直接进行dhcp 配置,不需要dhcp relay。     3 如果本地网络没有dhcp server,则与本地网络相连的具有dhcprelay 功能的网络设

备收到该广播报文后,将进行适当处理并转发给指定的其它网络上的dhcp server。     4 dhcp server 根据dhcp client 提供的信息进行相应的配置,并通过dhcp relay 将配置信息发送给dhcp client,完成对dhcp client 的动态配置。     事实上,从开始到最终完成配置,需要多个这样的交互过程。     报文交互过程如下图:    

     dhcp relay设备修改dhcp消息中的相应字段,把dhcp的广播包改成单播包,并负责在服务器与客户机之间转换。   

 

--------------------------------------------------

 http://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Relay

Manual:IP/DHCP Relay

Summary

DHCP Relay is just a proxy that is able to receive a DHCP request and resend it to the real DHCP server.

Properties

Sub-menu: /ip dhcp-relay

Property Description
add-relay-info (yes | no; Default: no) Adds DHCP relay agent information if enabled according to . Agent Circuit ID Sub-option contains mac address of an interface, Agent Remote ID Sub-option contains MAC address of the client from which request was received.
delay-threshold (time | none; Default: none) If secs field in DHCP packet is smaller than delay-threshold, then this packet is ignored
dhcp-server (string; Default: ) List of DHCP servers' IP addresses which should the DHCP requests be forwarded to
interface (string; Default: ) Interface name the DHCP relay will be working on.
local-address (IP; Default: 0.0.0.0) The unique IP address of this DHCP relay needed for DHCP server to distinguish relays. If set to 0.0.0.0 - the IP address will be chosen automatically
name (string; Default: ) Descriptive name for the relay

DHCP relay does not choose the particular DHCP server in the dhcp-server list, it just send the incoming request to all the listed servers.

Example setup

Let us consider that you have several IP networks 'behind' other routers, but you want to keep all DHCP servers on a single router. To do this, you need a DHCP relay on your network which relies DHCP requests from clients to DHCP server.

This example will show you how to configure a DHCP server and a DHCP relay which serve 2 IP networks - 192.168.1.0/24 and 192.168.2.0/24 that are behind a router DHCP-Relay.

IP Address Configuration

IP addresses of DHCP-Server:

[admin@DHCP-Server] ip address> printFlags: X - disabled, I - invalid, D - dynamic #   ADDRESS            NETWORK         BROADCAST       INTERFACE 0   192.168.0.1/24     192.168.0.0     192.168.0.255   To-DHCP-Relay 1   10.1.0.2/24	10.1.0.0	10.1.0.255	Public[admin@DHCP-Server] ip address>

IP addresses of DHCP-Relay:

[admin@DHCP-Relay] ip address> printFlags: X - disabled, I - invalid, D - dynamic #   ADDRESS            NETWORK         BROADCAST       INTERFACE 0   192.168.0.2/24     192.168.0.0     192.168.0.255   To-DHCP-Server 1   192.168.1.1/24     192.168.1.0     192.168.1.255   Local1 2   192.168.2.1/24     192.168.2.0     192.168.2.255   Local2[admin@DHCP-Relay] ip address>

DHCP Server Setup

To setup 2 DHCP Servers on DHCP-Server router add 2 pools. For networks 192.168.1.0/24 and 192.168.2.0:

/ip pool add name=Local1-Pool ranges=192.168.1.11-192.168.1.100/ip pool add name=Local1-Pool ranges=192.168.2.11-192.168.2.100[admin@DHCP-Server] ip pool> print # NAME                                         RANGES 0 Local1-Pool                                  192.168.1.11-192.168.1.100 1 Local2-Pool                                  192.168.2.11-192.168.2.100[admin@DHCP-Server] ip pool>

Create DHCP Servers:

/ip dhcp-server add interface=To-DHCP-Relay relay=192.168.1.1 \   address-pool=Local1-Pool name=DHCP-1 disabled=no/ip dhcp-server add interface=To-DHCP-Relay relay=192.168.2.1 \   address-pool=Local2-Pool name=DHCP-2 disabled=no[admin@DHCP-Server] ip dhcp-server> printFlags: X - disabled, I - invalid #   NAME         INTERFACE     RELAY           ADDRESS-POOL LEASE-TIME ADD-ARP 0   DHCP-1       To-DHCP-Relay 192.168.1.1     Local1-Pool  3d00:00:00 1   DHCP-2       To-DHCP-Relay 192.168.2.1     Local2-Pool  3d00:00:00[admin@DHCP-Server] ip dhcp-server>

Configure respective networks:

/ip dhcp-server network add address=192.168.1.0/24 gateway=192.168.1.1 \   dns-server=159.148.60.20/ip dhcp-server network add address=192.168.2.0/24 gateway=192.168.2.1 \   dns-server 159.148.60.20[admin@DHCP-Server] ip dhcp-server network> print # ADDRESS            GATEWAY         DNS-SERVER      WINS-SERVER     DOMAIN 0 192.168.1.0/24     192.168.1.1     159.148.60.20 1 192.168.2.0/24     192.168.2.1     159.148.60.20[admin@DHCP-Server] ip dhcp-server network>

DHCP Relay Config

Configuration of DHCP-Server is done. Now let's configure DHCP-Relay:

/ip dhcp-relay add name=Local1-Relay interface=Local1 \   dhcp-server=192.168.0.1 local-address=192.168.1.1 disabled=no/ip dhcp-relay add name=Local2-Relay interface=Local2 \   dhcp-server=192.168.0.1 local-address=192.168.2.1 disabled=no[admin@DHCP-Relay] ip dhcp-relay> printFlags: X - disabled, I - invalid #   NAME                        INTERFACE      DHCP-SERVER     LOCAL-ADDRESS 0   Local1-Relay                Local1         192.168.0.1     192.168.1.1 1   Local2-Relay                Local2         192.168.0.1     192.168.2.1[admin@DHCP-Relay] ip dhcp-relay>

转载于:https://www.cnblogs.com/kungfupanda/archive/2013/05/30/3108786.html

你可能感兴趣的文章
Kubernetes Deployment滚动更新场景分析
查看>>
多线程 3道题目 一
查看>>
我的友情链接
查看>>
c# 二维数组
查看>>
解决mx:AdvancedDataGrid表格中向上滚动导致数据混乱的非主流方法
查看>>
Buffer Cache内容强制写出到数据文件 alter system flush buffer_cache
查看>>
MicropPython的学习,如何从0到1?
查看>>
DNS(BIND) 服务器主从,实现高效率域名解析
查看>>
PHP 字符串变量
查看>>
Nginx+Lua环境安装
查看>>
Linuxshell快捷键
查看>>
three js相关的文档
查看>>
PHP获取和操作配置文件php.ini的几个函数
查看>>
83.LAMP设置默认主机
查看>>
sql笔记(来自oracle 的scott用户)
查看>>
bash_profile和.bashrc
查看>>
CGI解释
查看>>
matlab-线性代数 det 各阶主子式、余子式、代数余子式
查看>>
Activiti系列(二)集成Activiti Modeler
查看>>
eclipse中的.project 和 .classpath文件的具体作用
查看>>