DHCP server: have static IP on one subnet, dynamic IP on another subnet

I have the following configuration:

/interface set [ find default-name=ether1 ] name="wan"
/interface set [ find default-name=ether7 ] name="physical-lan"

/interface bridge add name=lan
/interface bridge port add bridge=lan interface=physical-lan
/interface bridge port add bridge=lan interface=ether2
/interface bridge port add bridge=lan interface=ether3
/interface bridge port add bridge=lan interface=ether4
/interface bridge port add bridge=lan interface=ether5
/interface bridge port add bridge=lan interface=ether6
/interface bridge port add bridge=lan interface=combo1

/ip address add address=192.168.1.254/24 interface=lan network=192.168.1.0

/interface vlan add interface=physical-lan name=wifi-guest vlan-id=200
/ip address add address=192.168.200.254/24 interface=wifi-guest

/ip dhcp-server config set store-leases-disk 24h
/ip pool add name=dhcp-lan ranges=192.168.1.50-192.168.1.150
/ip pool add name=dhcp-wifi-guest ranges=192.168.200.50-192.168.200.150

/ip dhcp-server add address-pool=dhcp-lan disabled=no interface=lan name=dhcp-lan lease-time=1h
/ip dhcp-server add address-pool=dhcp-wifi-guest disabled=no interface=wifi-guest name=dhcp-wifi-guest lease-time=1h
    
/ip dhcp-server network add address=192.168.1.0/24 netmask=24 gateway=192.168.1.254 dns-server=192.168.1.254 domain=lan
/ip dhcp-server network add address=192.168.200.0/24 netmask=24 gateway=192.168.200.254 dns-server=192.168.200.254 domain=lan

I also have a static lease for a laptop on dhcp-lan:

/ip dhcp-server lease add address=192.168.1.1   mac-address=<redacted> comment="laptop"

That all works fine. Laptop can get on the lan using a wifi connection and gets the 1.1 static IP. Guest devices can get on wifi-guest, and they are assigned a 200 dynamic IP. However, when laptop gets on wifi-guest (using wifi so same MAC address as when on lan), it cannot get a 200 address. It hangs for a while and then is eventually assigned 192.168.1.1, which can’t do anything on wifi-guest. Why doesn’t it assign a 200 address when laptop gets on wifi-guest?

on the lease you have to restrict the assignment to the (1.x) specific dhcp instance, now I don’t remember by hart the command .. but you’ll find easily

I haven’t found anything in the docs that indicate you can do that.

Make sure this is set to the name of your DHCP server instance for the subnet that the address is on - ‘dhcp-lan’ in your case - so that

/ip dhcp-server lease add address=192.168.1.1 mac-address=<redacted> comment="laptop"

becomes

/ip dhcp-server lease add address=192.168.1.1 mac-address=<redacted> comment="laptop" server=dhcp-lan

That way the router won’t try to hand out the reserved address unless the DHCP request comes in on the correct server/interface.

ok, exactly as @aholmes says :smiley:

That’s what I get for reading the documentation instead of looking at the GUI (I’m doing my config in a script). The docs have the “server” property listed as read only. Anyway, I added it and all is well. Thanks!