Community discussions

MikroTik App
 
ramirez
Member Candidate
Member Candidate
Topic Author
Posts: 148
Joined: Sun May 12, 2013 9:48 pm

Possible to request LAN IP, through DHCP client ?

Fri Oct 22, 2021 9:15 am

When a DHCP client is running on eth1 is it possible to "request" from the device running the DHCP server a particular IP? E.g. if the server hands out to client MT 192.168.50.10, to have MT receive 192.168.50.11 (not through "make static"), without changing anything on the first device .

P.S. Assuming of course that the requested IP is available .
 
holvoetn
Forum Guru
Forum Guru
Posts: 5481
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Possible to request LAN IP, through DHCP client ?

Fri Oct 22, 2021 9:30 am

Unclear what you are trying to achieve...

Anyhow, when a client requests a lease from the DHCP server, 2 possibilities in most cases:
1- no fixed assignment - a free IP from the pool is taken and given back to the device to use
2- fixed assignment on the DHCP server matching the clients MAC address - that IP address is given back.

If (assumption from my side) you want to have a fixed IP address without DHCP server having anything to say about it, then you should assign a fixed IP on the client device itself.
Obviously that IP address then needs to be free to be used. No way you can check without first getting a valid IP address (unless I misses something).
In most cases this is solved by keeping a part of the IP range NOT assigned to DHCP server-pool. Usually for servers etc. They should have a fixed IP anyhow (I know, I know ... but it solves quite a bit of headaches if you just set it fixed on the client itself).
E.g. I have a range 192.168.2.0/24 at home but only give out a DHCP pool from 100-250 (not that I EVER want to see 150 clients on my network :shock: ).
The devices which need to have fixed IP because I need to access them frequently, get an IP address in the bottom range.

If this does not answer your question, then you need to provide more info on what you exactly want to achieve.
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11598
Joined: Thu Mar 03, 2016 10:23 pm

Re: Possible to request LAN IP, through DHCP client ?

Fri Oct 22, 2021 2:51 pm

To clarify a bit what @holvoetn wrote:

when a device gets connected to certain L2 network (ethernet or wireless) and is configured to use DHCP to get IP details (address, gateway, DNS servers, etc.), it might include preferred IP address. It will most certainly do it when re-newing DHCP lease, but may do it when acquiring new lease as well. Then DHCP server considers the request and may offer DHCP lease with requested IP address but it might not if that IP address can not be leased to device requesting it (e.g. if it's already taken or if device has different static lease or IP address requested falls outside permitted dynamic address range).

Checking if IP address is used, is done on L2 layer (ARP procedures), so device, checking for IP address availability, doesn't have to have valid IP address beforehand. But then when device is configured with static IP address it most often doesn't check for availability. If IP address is already taken, then there will be usage clash and that will get reported (but not always, sometimes things simply misbehave in random ways).
 
holvoetn
Forum Guru
Forum Guru
Posts: 5481
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Possible to request LAN IP, through DHCP client ?

Fri Oct 22, 2021 3:58 pm

@mkx
Thanks for the added clarity and corrections.
This way I can also (re)learn things. Wasn't aware anymore of the ARP-process (has been too long since I learned OSI-model and related stuff ... that's over 30 years away)
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19325
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Possible to request LAN IP, through DHCP client ?

Fri Oct 22, 2021 4:24 pm

In my experience, both cable and Fibre, a dynamic IP is just that, you dont know what IP or even IP gateway the Modem will give you next.
Typically on both, when the lease expires one gets the same as they had before.........only after some longer period of time unknown or a power outage of some sort will the both change.
PS I hate theory, thats why I keep mkx around. ;-)

Who is online

Users browsing this forum: CGGXANNX, Google [Bot], GoogleOther [Bot], nizce and 97 guests