# DHCP default router ignored



## Yiv (Mar 23, 2018)

Hello,

trying setting up a DHCP server on my main host machine (virtualized with Proxmox) I ran into an issue I could not solve myself.
The machine is hosted by the OVH company, therefore the IP addresses too. The IP addresses are Failover IPs.

First of all, the configurations:
Variables (censored)

```
FAILOVER-MAC - The virtual mac address of the failover ip.
FAILOVER-IP - The failover ip itself.
GATEWAY - The main machines gateway.
DEFAULT-DNS - The OVH default dns.
```

dhcpd.conf (on my physical machine):

```
default-lease-time 21600000;
max-lease-time 432000000;

subnet 0.0.0.0 netmask 0.0.0.0 {
    authoritative;
}

# Bind IPs by MAC
host VM103 {
    hardware ethernet FAILOVER-MAC;
    fixed-address FAILOVER-IP;
    option broadcast-address FAILOVER-IP;
    
    option routers GATEWAY;
    option subnet-mask 255.255.255.255;
    option domain-name-servers 8.8.8.8,DEFAULT-DNS;
}
```

/etc/rc.conf (on my virtual machine, regarding network configuration):

```
ifconfig_em0="DHCP"
```

The problem now is that the "netstat -rn" command looks like this:

```
FAILOVER-IP            link#1            UHS        lo0
FAILOVER-IP/32        link#1            U        em0
127.0.0.1            link#2            UH        lo0
```

With the manual configuration (working internet connection, but I need to configure it on the VM itself):

```
default                GATEWAY            UGS        em0
GATEWAY/32            FAILOVER-MAC    US        em0
FAILOVER-IP            link#1            UHS        lo0
FAILOVER-IP/32        link#1            U        em0
127.0.0.1            link#2            UH        lo0
```

As you can see the first two entries regarding the gateway are missing and I'm unable to configure the DHCP server in a correct way to get this stuff working.

Can anyone help me?

With kind regards
Yiv


----------



## ShelLuser (Mar 23, 2018)

If you don't want to share IP addresses then please either change them to 127.* types or don't share anything at all. My problem with this is that it makes it too hard to determine if you made an actual mistake somewhere or intended to hide something. I'll just have to assume that GATEWAY/32 is actually a substitute for an actual IP address (which makes it harder to grasp) and worse yet: if you made a typoe somewhere (with the IP address for example) then this also made it impossible to spot any of that.

Either share the actual data or don't.

Alas... I think I may have spotted something: the subnet mask of an individual host should never be 255.255.255.255 because that basically disconnects them from the entire network, thus leading up to not having a default gateway because there's no point to it: it's unreachable anyway.

Make that /24 aka 255.255.255.0 instead.


----------



## leebrown66 (Mar 23, 2018)

The gateway has to reside within the subnet in order to be reachable at layer 2.


----------



## Yiv (Mar 23, 2018)

ShelLuser Typos are checked several times (by me and another guy). I can change the "variables" to 127.* IPs tomorrow if that's easier to read. But anyways, you can simply think of it as a search-n'-replace thing.

Also, why shouldn't the subnet not be 255.255.255.255? Because we only got one failover IP for now and not a whole subnet that's why this should be correct, in my opinion. Furthermore, the IP is assigned correctly, the only problem is with the router imo but maybe you're right, I get your point. But as I said, we only have the one FAILOVER-IP that's why I thought the 255.255.255.255 (/32) should be correct.

leebrown66 Is there a way around? Because the gateway is the IP of the main physical machine ending at 254. The FAILOVER-IP could be anything else as it's assigned by OVH and we cannot request something special.

With kind regards


----------

