0

Our dhcpd.conf defines two subnets such like,

subnet 192.168.0.0 netmask 255.255.255.0 {
  option routers 192.168.0.1; # internet gateway
}

subnet 192.168.1.0 netmask 255.255.255.0 {
  option routers 192.168.1.10; # internal network gateway
}

But a dhcp client receives both gateway address as default gateways such like,

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.0.1     192.168.0.78     35
          0.0.0.0          0.0.0.0     192.168.1.10     192.168.0.78     35 <-This is a bad one.

Why does this happen? And how can we do anything to fix that?

jumeno
  • 25
  • 6

1 Answers1

1

I don't have enough reputation points to ask a couple of questions via comment. It would help to see your entire dhcpd.conf file and your network interfaces config as well as what distribution you are using.

From the information you provided I would assume you have a multi-homed DHCP server with at least two interface cards configured for, and connected to, the subnets you are serving. Or, you have configured DHCP Relay for the appropriate subnet.

If so, your subnet declarations should look something like this:

subnet 192.168.0.0 netmask 255.255.255.0 {
    option subnet-mask 255.255.255.0;
    option routers 192.168.0.1;
    range 192.168.0.5 192.168.0.15;
}
subnet 192.168.1.0 netmask 255.255.255.0 {
    option subnet-mask 255.255.255.0;
    option routers 192.168.1.10;
    range 192.168.1.5 192.168.1.15;
}

The DHCP Daemon will listen on all network interfaces unless specified otherwise by a DHCPDARGS declaration in dhcpd.conf ex. - DHCPDARGS="eth0 eth1";

sc608
  • 141
  • 1