isc-dhcp 自定义option 配置, option 43, option 60

@font-face { font-family: 宋体 }
@font-face { font-family: “Cambria Math” }
@font-face { font-family: “Calibri Light” }
@font-face { font-family: Calibri }
@font-face { font-family: “@宋体” }
p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0 0 0.0001pt; text-align: justify; text-justify: inter-ideograph; font-size: 10.5pt; font-family: “Calibri”, “sans-serif” }
h1 { mso-style-link: “标题 1 Char”; margin: 17pt 0 16.5pt; text-align: justify; text-justify: inter-ideograph; line-height: 240%; page-break-after: avoid; font-size: 22pt; font-family: “Calibri”, “sans-serif” }
h2 { mso-style-link: “标题 2 Char”; margin: 13pt 0; text-align: justify; text-justify: inter-ideograph; line-height: 173%; page-break-after: avoid; font-size: 16pt; font-family: “Calibri Light”, “sans-serif” }
h3 { mso-style-link: “标题 3 Char”; margin: 13pt 0; text-align: justify; text-justify: inter-ideograph; line-height: 173%; page-break-after: avoid; font-size: 16pt; font-family: “Calibri”, “sans-serif” }
h4 { mso-style-link: “标题 4 Char”; margin: 14pt 0 14.5pt; text-align: justify; text-justify: inter-ideograph; line-height: 156%; page-break-after: avoid; font-size: 14pt; font-family: “Calibri Light”, “sans-serif” }
p.MsoHeader, li.MsoHeader, div.MsoHeader { mso-style-link: “页眉 Char”; margin: 0 0 0.0001pt; text-align: center; layout-grid-mode: char; border: none; padding: 0; font-size: 9pt; font-family: “Calibri”, “sans-serif” }
p.MsoFooter, li.MsoFooter, div.MsoFooter { mso-style-link: “页脚 Char”; margin: 0 0 0.0001pt; layout-grid-mode: char; font-size: 9pt; font-family: “Calibri”, “sans-serif” }
a:link, span.MsoHyperlink { color: rgba(5, 99, 193, 1); text-decoration: underline }
a:visited, span.MsoHyperlinkFollowed { color: rgba(149, 79, 114, 1); text-decoration: underline }
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph { margin: 0 0 0.0001pt; text-align: justify; text-justify: inter-ideograph; text-indent: 21pt; font-size: 10.5pt; font-family: “Calibri”, “sans-serif” }
span.Char { mso-style-name: “页眉 Char”; mso-style-link: 页眉 }
span.Char0 { mso-style-name: “页脚 Char”; mso-style-link: 页脚 }
{ mso-style-name: “标题 2 Char”; mso-style-link: “标题 2”; font-family: “Calibri Light”, “sans-serif”; font-weight: bold }
{ mso-style-name: “标题 1 Char”; mso-style-link: “标题 1”; font-weight: bold }
{ mso-style-name: “标题 3 Char”; mso-style-link: “标题 3”; font-weight: bold }
{ mso-style-name: “标题 4 Char”; mso-style-link: “标题 4”; font-family: “Calibri Light”, “sans-serif”; font-weight: bold }
@page WordSection1 { size: 595.3pt 841.9pt margin-top: 72pt margin-right: 90pt margin-bottom: 72pt margin-left: 90pt layout-grid: 15.6pt }
div.WordSection1 { page: WordSection1 }
ol { margin-bottom: 0 }
ul { margin-bottom: 0 }

本文为原创, 转载请注明出处

 

 

配置选项对应的指令列表:

isc-dhcp-ipv4/dhcp-4.2.4/common/tables.c

 

私有编号:

1.      定义:

# 配置文件有声明的编号 会在接收的时候 替换成类似new_acip1=value 形式

# 声明一个私有编号名字: acip1, 编号: 234, 值类型: string

# string类型: 一种 “abc”形式, 另一种十六进制形式:

option acip1 code 234 = string;

 

# 向目标请求一个选项acip1, 数据包里面的 option-55(参数请求列表) 就会带上这个编号, # request 请求要写在{}类里面, 并且最后一个request 才生效

request acip1;

 

# 强制发送, 向目标发送一个私有选项 acip1 编号 234, 内容acip138

send acip1 “acip138”;

 

# 选择发送, 如果目标有请求 234编号, 就发送

option acip1 “acip138”

 

2.      请求:

# 公共规则

# 声明一个选项 , private1 编号 234(个人私有编号, 随便写的) 值类型 string

option private1 code 234 = string;

# 指定接口规则, 优先级高

interface “eth0” {

    # 请求234选项

    request subnet-mask,vendor-encapsulated-options;

}

 

3.      处理:

# 声明

option acip code 138 = string;

option private1 code 234 = string;

option vendor-encapsulated-options code 43 = string;

 

subnet 192.168.5.0 netmask 255.255.255.0 {

    range  192.168.5.2 192.168.5.254;

 

    # 根据请求发送

    option routers 192.168.5.1;

    option subnet-mask 255.255.255.0;

    option vendor-encapsulated-options “dhcp43”;

    #option serverip 03:0C:31:39:32:2E:31:36:38:2E:32:32:2E:31;

 

    # 强制发送

    send acip “acip”;

}

dhclient 配置

dhclient –d eth0

debug模式运行

1.    拓普图:

2.    配置信息:

isc-dhcp

dhclient.conf 配置:

 

 

timeout 300;

retry 15;

reboot 10;

select-timeout 5;

initial-interval 5;

 

# 公共规则

send vendor-class-identifier “dhcp60”;

send vendor-encapsulated-options “dhcp43”;

request routers, host-name;

 

# 指定接口规则, 优先级高

interface “eth0” {

send vendor-class-identifier “acdhcp60”;

send vendor-encapsulated-options “acdhcp43”;

request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, host-name, netbios-name-servers, netbios-scope;

}

 

 

dhcpd option 43配置

vendor-encapsulated-options 通告另一个设备的IP

dhcpd  -d -cf dhcpd.conf -lf dhcpd.leases

debug模式运行

1.    拓普图:

2.    配置信息:

option vendor43 code 43 = string;

 

class “ac43-req” {

    # 全字符串匹配, 做标记

    match if option vendor43  = “acdhcp43”;

}

 

shared-network “dhcp” { # 用来告知是否一些子网络分享相同网络 ?

    subnet 192.168.10.0 netmask 255.255.255.0 {

        option routers 192.168.10.1;

    }

 

    pool {  # 一个IP

        # class acdhcp43

        allow members of “ac43-req”;

 

        # 地址范围

        range 192.168.10.10 192.168.10.20;

        # 根据请求发送

        option vendor43 “192.168.100.100”;

        # 强制发送

        #send vendor43 “192.168.100.100”;

    }

 

    # network interface, 绑定到 192.168.5.0 这个的接口上(至少绑定一个有效接口)

    subnet 192.168.5.0 netmask 255.255.255.0 {

        option routers 192.168.5.1;

    }

    pool {

        # class 不为 acdhcp43

        deny members of “ac43-req”;

        range 192.168.5.30 192.168.5.40;

    }

}

 

dhcpd option 60配置

使用option vendor-class-identifier 60 指定的dhcpd

1.   拓普图:

2.   配置信息:

# vendor-class-identifier == acdhcp60, 标记 members acdhcp60, 执行 pool: 192.168.5.10

# 否则: pool: 10.0.29.10

class “acdhcp60” {

    # 部分字符串匹配

    #match if substring (option vendor-class-identifier, 0, 4) = “abcd”;

    # 完整字符串匹配, 匹配:  vendor-class-identifier == acdhcp60

    match if option vendor-class-identifier = “acdhcp60”;

}

 

shared-network “dhcp” { # 用来告知是否一些子网络分享相同网络 ?

    # network interface, 绑定到 192.168.5.0 这个的接口上(至少绑定一个有效接口)

    subnet 192.168.5.0 netmask 255.255.255.0 {

        option routers 192.168.5.1;

    }

    pool {  # 一个IP

        # class acdhcp60

        allow members of “acdhcp60”;

        range 192.168.5.10 192.168.5.25;

    }

 

    subnet 10.0.29.0 netmask 255.255.255.0 {

        option routers rtr-29.example.org;

    }

    pool {

        # class 不为 acdhcp60

        deny members of “acdhcp60”;

        range 10.0.29.10 10.0.29.230;

    }

}

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注