# DHCP Client with multiple DNS Servers on different Subnets.



## Miles (Sep 12, 2018)

Good Afternoon all,

I have a FreeBSD 11.2 machine with one NIC and two Jails; a DHCP server and a Samba4 DNS/AD server.

My physical router (ISP provided modem/router) is at address _192.168.1.254/24_. The DHCP clients are to recieve an address of _10.10.10.{31-63}/26 _(0-30 are reserved for servers)_. _
The Jail host has external address _192.168.1.1/24_ and the Samba4 Jail _192.168.1.3/24_.

I have aliased the single NIC as follows.

```
# DHCP Interface Alias.
ifconfig_bge0_alias0="inet 10.10.10.1/26"

# SMB Interface Aliases.
ifconfig_bge0_alias1="inet 10.10.10.2/26"
ifconfig_bge0_alias2="inet 192.168.1.3/24"
```

The interfaces for the DHCP and Samba Jails are as follows.

```
jail_dhcp_ip="lo1|127.0.1.1,bge0|10.10.10.1/26"
jail_smb_ip="lo2|127.0.2.1,bge0|192.168.1.3/24,bge0|10.10.10.2/26"
```

The DHCP configuration for the client subnet is as follows.

```
subnet 10.10.10.0 netmask 255.255.255.192 {
  range 10.10.10.31 10.10.10.63;
  option domain-name-servers 10.10.10.2; # Samba
  option domain-name "bayes.home.net";
  option subnet-mask 255.255.255.224;
  option routers 192.168.1.254; # ISP modem/router
  default-lease-time 600;
  max-lease-time 7200;
}
```

I have also set the nameservers in the Samba Jail accordingly.

```
search bayes.home.net
nameserver 10.10.10.2
nameserver 192.168.1.2
```

Finally, I have set the router as a DNS forwarding target in Samba, like so.

```
dns forwarder = 192.168.1.254
```

However, the DHCP clients appear to have no access to the _bayes.home.net_ domain, nor the internet. Furthermore, pinging hosts on both the _192.168.1.x/24_ and _10.10.10.x/26_ subnets fails.

I suspect that there may be a subnet clash, due to the differing subnet sizes; a 6 bit host address (or, conversely a 26 bit subnet address) range not having the capacity to contact a host with an 8 bit host address (or, conversely a 24 bit subnet address). If this is the case, I suspect the clients can access neither the Samba DNS nor the router DNS.

However, without replacing the router itself with something homegrown and VLAN based (at least, at the moment) I am not sure how to work around this, if it is indeed the issue.

Could somebody more knowledgeable than I in networking confirm that this may well be the case? If so, what are some alternative ways to proceed with this set-up?

Best regards


----------



## SirDice (Sep 12, 2018)

The 10.10.10.0/26 network will never be able to use 192.168.1.254 as a default gateway. How is it supposed to route to that IP address? It can only access addresses in the same 10.10.10.0/26 network. _Any_ gateway (including the default) has to be within that same 10.10.10.0/26 network.


----------

