Unknown network segment, simple class, custom client

michael kapelko kornerr at gmail.com
Tue Jun 2 02:23:24 UTC 2009


Hello.

I try to simulate sending of DHCP packet from a certain relay (without
adding Relay agent option) using the following perl script:

#!/usr/bin/env perl
use strict;
use warnings;
use Net::DHCP::Packet;
use Net::DHCP::Constants;
use Net::RawIP;

my $sock = new Net::RawIP({udp => {}});
my $p = new Net::DHCP::Packet(
    Chaddr  => '000BCDEF',
    Xid     => int(rand(0xFFFFFFFF)),
    Ciaddr  => '0.0.0.0',
    Yiaddr  => '0.0.0.0',
    Siaddr  => '0.0.0.0',
    Giaddr  => '10.106.250.2',
    Hops    => 1,
    Flags   => 0x8000,
    DHO_DHCP_MESSAGE_TYPE() => DHCPDISCOVER());
$sock->set({
        ip => {
            saddr   => "10.106.250.2",
            daddr   => "10.102.101.13",
            tos     => 22
        },
        udp => {
            source  => 68,
            dest    => 67,
            data    => $p->serialize()
        }
    });
$sock->send();

But in response for that dhcpd syslogs:

Jun  2 10:12:51 zond2 dhcpd: DHCPDISCOVER from 00:0b:cd:ef:00:00 via
10.106.250.2: unknown network segment

My /etc/dhcpd.conf is

failover peer "elt-dhcp" {
         primary;
         address 10.102.101.13;
         port 519;
         peer address 10.102.101.23;
         peer port 520;
         max-response-delay 180;
         max-unacked-updates 10;
         mclt 180;
#         mclt 3600;
#         split 128;
         split 255;
#         load balance max seconds 3;
}
include "/etc/dhcpd.master";

and my /etc/dhcpd.master is

ddns-update-style none;
default-lease-time 500;
max-lease-time 600;
local-address 10.102.101.13;
authoritative;
class "10.106.250.2:10" {
#   match if (suffix(option agent.circuit-id, 1) = A) and
    match if (packet(24, 4) = 0A:6A:FA:02);
}

shared-network "clients" {
subnet 10.102.101.0 netmask 255.255.255.0 { }
subnet 10.104.67.0 netmask 255.255.255.0 {
    option routers 10.104.67.1;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 91.196.207.62, 91.196.206.2;
  pool {
        failover peer "elt-dhcp";
        deny dynamic bootp clients;
        allow members of "10.106.250.2:10";
        range 10.104.67.205;
      }
  }
}


Please tell me what I am doing wrong. Thanks.



More information about the dhcp-users mailing list