DHCP-Server for 2 different subnets on 2 different NICs

I have 2 LAN-Nics with IPs from different subnets.
How can i configure the dhcp server to provide the correct IPs on each subnet/NIC?
Sounds like an easy task - create 2 shared networks and bind each one to the right NIC.

But how do i do the binding?

dhcp-server {
shared-network-name SCOPE1 {
authoritative
subnet 10.0.1.0/24 {
range 0 {
start 10.0.1.100
stop 10.0.1.200
}
}
}
shared-network-name SCOPE2 {
authoritative
subnet 10.0.2.0/24 {
range 0 {
start 10.0.2.100
stop 10.0.2.200
}
}
}
}

That’s it. You shouldn’t have to bind them to an interface. Based on the subnet they are on, they should know where to go, assuming you have IP addresses on your interfaces.

Hello @foxit-eu. @pirateghost is right about IP address on interfaces. I prepared config for you.

set interfaces ethernet eth1 address 10.0.1.1/24
set interfaces ethernet eth2 address 10.0.2.1/24

set service dhcp-server shared-network-name SCOPE1 authoritative
set service dhcp-server shared-network-name SCOPE1 subnet 10.0.1.0/24 default-router '10.0.1.1'
set service dhcp-server shared-network-name SCOPE1 subnet 10.0.1.0/24 range 0 start '10.0.1.100'
set service dhcp-server shared-network-name SCOPE1 subnet 10.0.1.0/24 range 0 stop '10.0.1.200'

set service dhcp-server shared-network-name SCOPE2 authoritative
set service dhcp-server shared-network-name SCOPE2 subnet 10.0.2.0/24 default-router '10.0.2.1'
set service dhcp-server shared-network-name SCOPE2 subnet 10.0.2.0/24 range 0 start '10.0.2.100'
set service dhcp-server shared-network-name SCOPE2 subnet 10.0.2.0/24 range 0 stop '10.0.2.200'

Thx for the replies. Unfortunately it doesn’t work as expected with the given config.

On one interface the dhcp leases are handed out just fine - on the other one there’s no reaction from the dhcp-server. In tcpdump I can see the dhcp-requests packets arriving on the nic but the dhcp-server log shows no activity.

I’ll dig a bit deeper on tuesday and report back after i tried with another client.

Try use restart dhcp server command if address on interface was added after dhcp configuration

Figured it out. Nothing wrong about the dhcp-server configuration - just a problem with my test methotology. I’m in the process of transfering the 1.1.7 config from the currently active firewall to a new box with VyOS 1.2.3 and my minimal test-environment with firewall + Laptop was of course way too minimalistic.

Not a huge surprise it doesn’t work as expected - with only one link active during dhcp-service start.
Added a switch on each network and now it’s working just fine.

Sorry for wasting your time.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.