Community discussions

MikroTik App
 
YordanY1
newbie
Topic Author
Posts: 35
Joined: Tue Sep 07, 2021 2:54 am
Location: Bulgaria

add a static IP in the DHCP list?

Sun Oct 31, 2021 10:19 am

Hello.
I have a DHCP running in the range 192.168.10.2-192.168.10.200
Anyway, I wish to make static every device on the network, yet there is a few devices which is with preset IPs (ESP32 and other microcontrolers).
How to add these devices to the list, so no conflicts could be caused eventually ?
I am currently doing it from IP->ARP->Make Static, but I am not quite sure that this is the proper way.
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11433
Joined: Thu Mar 03, 2016 10:23 pm

Re: add a static IP in the DHCP list?  [SOLVED]

Sun Oct 31, 2021 10:31 am

It should be done as IP -> DHCP Server -> Leases -> Add New ... you will need to know devices' MAC addresses to make leases meaningfull - theoretically you could enter just any MAC address but that would a) allow for problems in rare case when a device with configured MAC appeared in the network and b) it's harder to relate static leases to actual devices (one has to rely on comments) ...
 
holvoetn
Forum Guru
Forum Guru
Posts: 5403
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: add a static IP in the DHCP list?

Sun Oct 31, 2021 11:13 am

Or use the dynamic lease, make static and then set the desired IP.
Then you don't need to fiddle with the MAC address.
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11433
Joined: Thu Mar 03, 2016 10:23 pm

Re: add a static IP in the DHCP list?

Sun Oct 31, 2021 1:04 pm

Or use the dynamic lease, make static and then set the desired IP.
Then you don't need to fiddle with the MAC address.

This only works if client device is actually running DHCP client and network admin wants client to have a particular IP address.

@OP indicated that devices had truely static setup and he only wants to "punch holes in DHCP address pool" to avoid any possibility of address clashes which might come true if a static-address device is switched off for a while, DHCP server offers address to another device and check for address availability thus doesn't trigger. After static-address device joins the network again, it'll shamelessly resume using its address and thus creating address clash with the DHCP device.
 
YordanY1
newbie
Topic Author
Posts: 35
Joined: Tue Sep 07, 2021 2:54 am
Location: Bulgaria

Re: add a static IP in the DHCP list?

Sun Oct 31, 2021 2:07 pm

Or use the dynamic lease, make static and then set the desired IP.
Then you don't need to fiddle with the MAC address.

This only works if client device is actually running DHCP client and network admin wants client to have a particular IP address.

@OP indicated that devices had truely static setup and he only wants to "punch holes in DHCP address pool" to avoid any possibility of address clashes which might come true if a static-address device is switched off for a while, DHCP server offers address to another device and check for address availability thus doesn't trigger. After static-address device joins the network again, it'll shamelessly resume using its address and thus creating address clash with the DHCP device.
yep. this is exactly what hapening.
So ARP->Make Static is different from IP->DHCP Server->Leases->Make Static ? :| I am confused.
Than what does ARP->Make Static does ?
 
sutrus
Frequent Visitor
Frequent Visitor
Posts: 58
Joined: Fri Jun 30, 2017 11:27 pm

Re: add a static IP in the DHCP list?

Sun Oct 31, 2021 4:43 pm

ARP is not related to DHCP at all.
The protocol is used to map L3 IP addresses to L2 MAC addresses. And that is what the ARP table is.
L2 device does not need an IP address to send data over the local network and uses the ARP table.

edit:
ARP table says
A device with this MAC address has this IP address and is reachable on this network port.
 
User avatar
k6ccc
Forum Guru
Forum Guru
Posts: 1490
Joined: Fri May 13, 2016 12:01 am
Location: Glendora, CA, USA (near Los Angeles)
Contact:

Re: add a static IP in the DHCP list?

Sun Oct 31, 2021 6:46 pm

The vast majority of my devices are DHCP reservations (what MT calls Static). ALL of the reservations are outside of my DHCP pool range. For devices that are truly static, they are also assigned addresses that are outside the DHCP range. The MT DHCP server knows nothing of them so they are not listed in the leases page. I have a separate listing for all of my IP assignments (both static and reservations). Because of having every with reservations, my DHCP pool for each LAN is very small 192.168.VLAN-ID.201 to 192.168.VLAN-ID.209

I do like mkx's idea of putting the truly static devices into the lease list. Keeps you from causing an issue if you typo a number. My OCD would require that the correct MAC be there however...
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11433
Joined: Thu Mar 03, 2016 10:23 pm

Re: add a static IP in the DHCP list?

Sun Oct 31, 2021 8:57 pm

Than what does ARP->Make Static does ?

When IP device wants to communicate with another IP device over ethernet (or wifi), it sends packets to MAC address. ARP is protocol suite to map IP addresses to MAC addresses. And when device resolves MAC address for connection peer, it temporarily stores the MAC address in ARP table so that it doesn't have to resolve it for each individual packet. ARP table entries time-out in configured time, Mikrotik's default seems to be 30 seconds, other vendors may have it much longer (can be in order of hour).
If ARP resolution procedures are not successfull (e.g. because broadcasts are blocked network-wide or some otger reason), then it's possible to add static entries to ARP table (which don't get timed-out). This should be used carefully because things will break if for any reason mapping between IP and MAC addresses change (e.g. because host gets NIC replaced).
 
YordanY1
newbie
Topic Author
Posts: 35
Joined: Tue Sep 07, 2021 2:54 am
Location: Bulgaria

Re: add a static IP in the DHCP list?

Sun Oct 31, 2021 9:11 pm

Thank You fellows for explaining me ! :)

Who is online

Users browsing this forum: Google [Bot] and 37 guests