DHCP override

Hi everyone,

is it possible to override a dchp gateway for 1 client.

Let’s say a getaway for my network is 192.168.1.1, can I change it for 1 client only for 192.168.1.2 (I have another gateway with such ip on the network )?

Thank you all :slight_smile:

Alex

It seems that you can mark the packet for one IP and then set a unique route for that marking.
http://forum.mikrotik.com/t/add-route-for-1-host/59574/1
Dont ask me how, since I have not tested it and mangle is not my field :slight_smile:

Edit:
This may help:
https://wiki.mikrotik.com/wiki/Policy_Base_Routing

You mean the gateway which the DHCP server instructs the client to use, correct?

You can, if you make the lease for that client static (to convert a dynamically assigned one to a static one is the simplest way to do that), and for the address you lease to that client, you create a separate row under /ip dhcp-server network, with individual value of gateway. So the address parameter of that row will be the leased address alone (i.e. with a /32 mask), but you must specify the optional netmask value on that row, to tell the client what netmask to use.

Or if you can get my previous post to work with packed marking, you could use source mac address.
Then it does not matter what IP the client gets. The client then get routed based on its mac address.

Thanks Jotne and Sindy!

sorry just to confirm as I am very new to Mikrotik. Would that work:

/ip dhcp-server server my_dhcp network 10.0.0.18/32 gateway 10.0.0.2

Where the specific client is 10.0.0.18, second gateway 10.0.0.2

Thank you

Not enough, you must add netmask=xx, where xx matches the netmask of the subnet from which you assign the address, otherwise the client would get a /32 mask and would not be able to connect anywhere, as even the gateway would be outside its own subnet.

Ah, right, something like this?

/ip dhcp-server network server=my_dhcp address=10.0.0.18/32 netmask=24 gateway=10.0.0.2

/ip dhcp-server network server=my_dhcp address=10.0.0.18/32 netmask=24 gateway=10.0.0.2

There is no explicit link to the server.

And if you don’t specify the DNS server, the common one will not be assigned to the client - or, better to say, those specified for Mikrotik itself in /ip dns settings will be assigned to the client.