Assign IP based on Ethernet port number connected

Hi,

I’d like to set up a DHCP server on a Mikrotik device which assigns an IP address based on which Ethernet interface the device is connected to. Which RB models support this, and how would I configure this?

For example, say I had an RB493 (8 ports) running RouterOS. I’d like to configure so that any device plugged into port 1 is assigned 192.168.87.1, any device plugged into port 2 is assigned 192.168.87.2, and so on..

Thanks!

if you are going to connect only 1 device, then you can do this by creating dhcp-server on each interface and assign pool you like to the dhcp-server. Pool can be only 1 address big.

Great, thanks. Yes, we will only be connecting one device per port. Cables will be routed from the router to slots in a rack, and the idea is to know which cable, and therefore which slot in the rack, a device is plugged into.

One more question. In another test setup, we’d like to assign IP addresses based on the last octet of the MAC address.

For example, for any MAC address xx-xx-xx-xx-xx-1A, assign 192.168.87.26 (26 == 0x1A).

Is that possible, and if so how?