使用 ISC DHCPd 4.3 设置供应商封装选项(代码 125)失败

使用 ISC DHCPd 4.3 设置供应商封装选项(代码 125)失败

我正在尝试设置我的 Ubuntu 服务器 16.04 LTS Xenial 来运行 DHCP 服务器,该服务器向特定的设备提供所需的信息。

该设备是 Orange ISP(法国供应商为 Sagem)的电视解码器,只有当 IP 地址由 Orange (TM)(同一供应商)的 Livebox 3 分配时,它才能工作。此限制可避免使用与 Orange 提供的 DHCP 服务器不同的 DHCP 服务器。

如果我想使用在 Ubuntu 16.04 中运行的自己的 DHCP 服务器来避免在 Livebox 上运行的服务器(它很糟糕),我需要调整我的配置。

使用 TV 解码器和 DHCP 的引导协议 (ACK),均来自 Sagem

Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x35139a37
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
Client IP address: 0.0.0.0
Your (client) IP address: 192.168.1.153
Next server IP address: 192.168.1.1
Relay agent IP address: 0.0.0.0
Client MAC address: Sagemcom_37:a1:9a (f0:82:61:37:a1:9a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
    Length: 1
    DHCP: ACK (5)
Option: (54) DHCP Server Identifier
    Length: 4
    DHCP Server Identifier: 192.168.1.1
Option: (51) IP Address Lease Time
    Length: 4
    IP Address Lease Time: (843s) 14 minutes, 3 seconds
Option: (58) Renewal Time Value
    Length: 4
    Renewal Time Value: (421s) 7 minutes, 1 second
Option: (59) Rebinding Time Value
    Length: 4
    Rebinding Time Value: (737s) 12 minutes, 17 seconds
Option: (1) Subnet Mask
    Length: 4
    Subnet Mask: 255.255.255.0
Option: (6) Domain Name Server
    Length: 4
    Domain Name Server: 192.168.1.1
Option: (15) Domain Name
    Length: 4
    Domain Name: home
Option: (28) Broadcast Address
    Length: 4
    Broadcast Address: 192.168.1.255
Option: (3) Router
    Length: 4
    Router: 192.168.1.1
Option: (125) V-I Vendor-specific Information
    Length: 41
    Enterprise: The Broadband Forum (formerly 'ADSL Forum') (3561)
        Length: 36
        Option 125 Suboption: (4) GatewayManufacturerOUI
            Length: 6
            GatewayManufacturerOUI: 307CB2
        Option 125 Suboption: (5) GatewaySerialNumber
            Length: 15
            GatewaySerialNumber: AN16XXXXXXXXXX
        Option 125 Suboption: (6) GatewayProductClass
            Length: 9
            GatewayProductClass: Livebox 3
Option: (255) End
    Option End: 255

为了在 Ubuntu 中模拟我自己的 ISC DHCP 服务器的相同行为,我根据找到的文档和选项对其进行了定制。

基本上,关键是仅向电视解码器发送以下附加代码:

  • 代码 15:域名
  • 代码 72:默认万维网服务器。
  • 代码 125:VI 供应商特定信息

根据 ISC DHCP 服务器文档,存在三个代码,并且可以通过添加方便的选项轻松发送它们:

  • 域名文本
  • www 服务器 ip 地址
  • 供应商封装选项字符串

首先,我尝试过这种方法:

/etc/dhcp/dhcpd.conf

# Create an option namespace called orangetv
option space orangetv code width 1 length width 1;
option orangetv.GatewayManufacturerOUI code 4 = text;
option orangetv.GatewaySerialNumber code 5 = text;
option orangetv.GatewayProductclass code 6 = text;
    
# Linux Router
subnet 192.168.1.0 netmask 255.255.255.0 {
    option domain-name-servers 192.168.1.1;
    option broadcast-address 192.168.1.255;
    option subnet-mask 255.255.255.0;
    option routers 192.168.1.5;
    range 192.168.1.100 192.168.1.199;    
    class "sagem-vendor-classes" {
    match if substring(option vendor-class-identifier, 0, 5) = "sagem";        
    option domain-name "home";        
    option www-server 193.253.67.89;
    vendor-options-space orangetv;
    option orangetv.GatewayManufacturerOUI "307CB2";
    option orangetv.GatewaySerialNumber "AN16XXXXXXXXXXX";
    option orangetv.GatewayProductclass "Livebox 3";                       
    }

}

保存新配置后,我通过运行以下命令检查配置语法:sudo dhcpd -t -cf /etc/dhcp/dhcpd.conf

然后,我重新启动了 DHCP 服务器以重新加载新配置(ISC DHCP 4.3 有时无法重新启动并重新加载新配置。这在某种程度上与 Apache2 服务器有关。因此我建议强制执行此操作):

sudo -i
service dhcp restart
service isc-dhcp-server restart
service isc-dhcp-server6 restart
service apache2 restart

现在,我重启了电视解码,并再次用Wireshark跟踪网络。Bootstrap ACK的结果是

Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x70907f18
Seconds elapsed: 0
Bootp flags: 0x8000, Broadcast flag (Broadcast)
Client IP address: 0.0.0.0
Your (client) IP address: 192.168.1.153
Next server IP address: 192.168.1.5
Relay agent IP address: 0.0.0.0
Client MAC address: Sagemcom_37:a1:9a (f0:82:61:37:a1:9a)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
    Length: 1
    DHCP: ACK (5)
Option: (54) DHCP Server Identifier
    Length: 4
    DHCP Server Identifier: 192.168.1.5
Option: (51) IP Address Lease Time
    Length: 4
    IP Address Lease Time: (843s) 14 minutes, 3 seconds
Option: (1) Subnet Mask
    Length: 4
    Subnet Mask: 255.255.255.0
Option: (3) Router
    Length: 4
    Router: 192.168.1.5
Option: (6) Domain Name Server
    Length: 4
    Domain Name Server: 192.168.1.1
Option: (15) Domain Name
    Length: 4
    Domain Name: home
Option: (28) Broadcast Address
    Length: 4
    Broadcast Address: 192.168.1.255
Option: (72) Default WWW Server
    Length: 4
    Default WWW Server: 193.253.67.89
Option: (255) End
    Option End: 255
Padding: 0000000000000000

正如您所注意到的,选项 15 和 72 被正确解析,但缺少选项 125。因此,我尝试按照手册中的建议使用封装的供应商选项。我使用了

option vendor-encapsulated-options 7d:29:00:00:0d:XXXXXXXX:20:33

而不是 vendor-options-space 方法,但再次失败。

我使用了另一种解决方法来发送代码 125,如 [https://lists.isc.org/pipermail/dhcp-users/2012-July/015793.html][1] 中所述

/etc/dhcp/dhcpd.conf

# Create an option namespace called orangetv
option space orangetv code width 1 length width 1;
option orangetv.GatewayManufacturerOUI code 4 = text;
option orangetv.GatewaySerialNumber code 5 = text;
option orangetv.GatewayProductclass code 6 = text;

# Package the orangetv namespace into option 125
option space vivso code width 4 length width 1;
option vivso.orangetv code 3561 = encapsulate orangetv;
option vivso.iana code 0 = string;
option op125 code 125 = encapsulate vivso;

# Linux Router
subnet 192.168.1.0 netmask 255.255.255.0 {
    option domain-name-servers 192.168.1.1;
    option broadcast-address 192.168.1.255;
    option subnet-mask 255.255.255.0;
    option routers 192.168.1.5;
    range 192.168.1.100 192.168.1.199;    
    class "sagem-vendor-classes" {
    match if substring(option vendor-class-identifier, 0, 5) = "sagem";        
    option domain-name "home";        
    option www-server 193.253.67.89;
    option vivso.iana 01:01:01;
    option orangetv.GatewayManufacturerOUI "307CB2";
    option orangetv.GatewaySerialNumber "AN16XXXXXXXXXXX";
    option orangetv.GatewayProductclass "Livebox 3";                       
    }

}

尽管进行了这些配置,DHCP 服务器仍未根据供应商详细信息发送代码 125。

还有其他建议吗?

答案1

尝试这个

option op125 code 125 = string;

然后将 op125 插入子网块中,如下所示:

option op125 7d:29:00:00:0d:XXXXXXXX:20:33;

vendor-encapsulated-options是选项 43

答案2

我最近遇到了同样的问题。我将其用作dnsmasq服务器(以 pi-hole 为基础,略作修改),但结果发现 DHCP 客户端不请求选项 125,因此dnsmasq不会将其发送出去。

它看起来相当于dhcpddhcp-parameter-request-list尽管我不确定如何使用它。这一页提供了我能找到的少数例子之一。

作为参考,这是仅有的配置我需要注意力量dhcp-option-force

dhcp-host=d0:84:aa:bb:cc:dd,set:decodeur,10.1.2.3,OrangeTV
dhcp-option=tag:decodeur,option:dns-server,10.1.2.1
# Enterprise: Broadband Forum (previously 'DSL Forum') (3561)
        # Option 125 Suboption: (4) GatewayManufacturerOUI
        dhcp-option-force=tag:decodeur,vi-encap:3561,4,"A43E51"
        # Option 125 Suboption: (5) GatewaySerialNumber
        dhcp-option-force=tag:decodeur,vi-encap:3561,5,"AN16XXXXXXXXXXX"
        # Option 125 Suboption: (6) GatewayProductClass
        dhcp-option-force=tag:decodeur,vi-encap:3561,6,"Livebox 3"

和:

  • 直播箱 IP:10.1.2.1
  • 解码器IP:10.1.2.3
  • 解码器MAC:d0:84:aa:bb:cc
  • Livebox 序列号:AN16XXXXXXXXXXX

在我的案例中,角色 15 和 72 不是必需的。我还有一个自定义搜索域。但是,在我的案例中,将 livebox 作为 DNS 是强制性的。在互联网上的多个地方可以找到略有不同的信息(例子)。

答案3

我希望我回答这个问题还不算太晚。

7天:29意味着选择125(7d)以及二十九长度 =41

因此要发送的字符串开始于00:00:0天:.............

相关内容