What's new

YazDHCP Yazfi with static IP

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Chewie420

Regular Contributor
I tried looking for an answer but could find one. I'm loving Yazfi for my IoT devices and guests but I was hoping to use static IPs for my devices within the subnet assigned by Yazfi.

I was having issues with some WeMo and Yazfi and I'd re-try after every update and finally my issues are now resolved. I'm using it now but just would like this feature of static IP, I thought YazDHCP would but don't see how unless it's in GUI.

When I try to use the merlin dhcp with the addresses used in yazfi subnets it give an error that its not a valid IP.

Thanks for any help or letting me know if it's even possible at this time.
 
Last edited:
I tried looking for an answer but could find one. I'm loving Yazfi for my IoT devices and guests but I was hoping to use static IPs for my devices within the subnet assigned by Yazfi.
The answer is there in the earlier YazFi thread and on the YazFi GitHub Wiki page. See my post in the earlier YazFi thread where I posted about using fixed IP addresses on guest IoT YazFi clients and why I was doing so:
https://www.snbforums.com/threads/y...inc-ssid-vpn-client.45924/page-32#post-473403

And see the YazFi GitHub site's Wiki post:
https://github.com/jackyaz/YazFi/wi...e-and-ARP-records#a-note-on-dhcp-reservations
 
I have tried following the user guides to get DHCP reservations to work for a couple of my IOT devices as well.
It seems either I am doing something wrong or there is a step not quite as it should be.

I have tried it a couple different variations but neither seems to make a difference.
I have validated that the file is correctly set as executable.
Code:
v125027@AX86U:/tmp/home/root# ls -al /jffs/scripts/dnsmasq.postconf
-rwxr-xr-x    1 v125027  root           465 Apr  1 22:03 /jffs/scripts/dnsmasq.postconf

Here is what I have in my ax86u (ver 186.1_2) - YazFi


Code:
v125027@AX86U:/tmp/home/root# cat /jffs/scripts/dnsmasq.postconf
#!/bin/sh
. /opt/share/diversion/file/post-conf.div # Added by Diversion
/jffs/scripts/uiDivStats dnsmasq & # uiDivStats

#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,Amcrest_1,192.168.6.195" $CONFIG
pc_append "dhcp-host=9C:8E:CD:24:6E:E3,Amcrest_3,192.168.6.196" $CONFIG

#Set Hostname
pc_append "dhcp-host=9c:8e:cd:24:03:c2,Amcrest_1" $CONFIG
pc_append "dhcp-host=9C:8E:CD:24:6E:E3,Amcrest_3" $CONFIG
 
I have tried following the user guides to get DHCP reservations to work for a couple of my IOT devices as well.
It seems either I am doing something wrong or there is a step not quite as it should be.
How are you validating that it is not working? Have you checked the System Log > Wireless Log section of the Asus Merlin GUI? Or run the following command via SSH while connected to the router: cat /var/lib/misc/dnsmasq.leases

While the YazFi wiki mentions a second section for adding the HostName, I don't use it. I also am not using Diversion or any other third party scripts other than YazFi. I just have one set of pc_append in the dnsmasq.postconf file. I also do not use underscores or similar characters for IoT device names.

Edit to add: Also the current file permissions via SSH are (0777):
Code:
-rwxrwxrwx    1 XYZ    root           926 Jan 31 11:18 /jffs/scripts/dnsmasq.postconf
This was set by issuing the command (mentioned in my linked post in other YazFi thread) on the initially created dnsmasq.postconf file: chmod +xxx /jffs/scripts/dnsmasq.postconf
 
Last edited:
How are you validating that it is not working? Have you checked the System Log > Wireless Log section of the Asus Merlin GUI? Or run the following command via SSH while connected to the router: cat /var/lib/misc/dnsmasq.leases

While the YazFi wiki mentions a second section for adding the HostName, I don't use it. I also am not using Diversion or any other third party scripts other than YazFi. I just have one set of pc_append in the dnsmasq.postconf file. I also do not use underscores or similar characters for IoT device names.

Edit to add: Also the current file permissions via SSH are (0777):
Code:
-rwxrwxrwx    1 XYZ    root           926 Jan 31 11:18 /jffs/scripts/dnsmasq.postconf
This was set by issuing the command (mentioned in my linked post in other YazFi thread) on the initially created dnsmasq.postconf file: chmod +xxx /jffs/scripts/dnsmasq.postconf
I validate the cameras' IPs in the application that is using the cameras.
They are still showing other IPs which are NOT the two I have statically assigned.
In the application Synology Survelliance station, the cameras are pointed at the cameras' IPs.
If the cameras IPs change for any reason then the app wont collect video from that camera until I change the IP either in the camera or in the app.

Here is the validating output of
cat /var/lib/misc/dnsmasq.leases

Code:
ASUSWRT-Merlin RT-AX86U 386.1_2 Fri Feb 12 22:47:25 UTC 2021
v125027@AX86U:/tmp/home/root# cat /var/lib/misc/dnsmasq.leases
86356 2c:d9:74:a0:27:a0 192.168.1.20 55TCLRokuTV *
83028 04:a2:22:5b:79:ac 192.168.1.25 LGwebOSTV 01:04:a2:22:5b:79:ac
84053 86:10:fe:14:8e:8c 192.168.1.116 OnePlus7T 01:86:10:fe:14:8e:8c
50050 88:03:55:9a:25:99 192.168.1.26 * *
64031 44:65:0d:ce:77:0a 192.168.1.138 * 01:44:65:0d:ce:77:0a
66321 50:ec:50:18:65:42 192.168.3.142 * 01:50:ec:50:18:65:42
50167 22:ad:ac:06:f5:05 192.168.1.153 Galaxy-Tab-S6 01:22:ad:ac:06:f5:05
50014 9c:8e:cd:24:03:c2 192.168.6.197 Amcrest_1 01:9c:8e:cd:24:03:c2
50013 9c:8e:cd:24:6e:e3 192.168.6.124 Amcrest_3 01:9c:8e:cd:24:6e:e3
50013 64:52:99:f2:cf:0e 192.168.3.141 MyQ-747 *
50011 64:52:99:f4:69:4b 192.168.3.168 MyQ-895 *
50008 6c:6a:77:61:d6:86 192.168.1.164 Ryzen5-2400g 01:6c:6a:77:61:d6:86
50019 b8:2c:a0:77:a6:b7 192.168.1.159 TSTAT-77A6B7 01:b8:2c:a0:77:a6:b7
50017 0e:78:c0:0c:4a:75 192.168.1.121 OnePlus6T 01:0e:78:c0:0c:4a:75
50009 88:de:a9:be:14:a5 192.168.1.21 RokuPremiere-887 *
86400 00:11:32:15:f1:02 192.168.1.19 slidersportal 01:00:11:32:15:f1:02
48058 00:8e:25:70:01:90 192.168.1.253 Tower 01:00:8e:25:70:01:90
50015 b8:3e:59:62:21:71 192.168.1.22 SpareBedroom *

You will notice that I "assigned" IPs .6.195 & .196
Neither of which is being used.

I don't mind removing the "Host Names" section if it is believed to be an issue but I was following the directions.
 
As a troubleshooting step if you haven't tried this already. Try using the naming method in my previous thread post which I pulled from another post in that earlier YazFi thread.

Your current code:
Code:
#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,Amcrest_1,192.168.6.195" $CONFIG
pc_append "dhcp-host=9C:8E:CD:24:6E:E3,Amcrest_3,192.168.6.196" $CONFIG
Try changing it to THIS:
Code:
#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,192.168.6.195,Amcrest_1" $CONFIG
pc_append "dhcp-host=9C:8E:CD:24:6E:E3,192.168.6.196,Amcrest_3" $CONFIG

Reverse the device name and it's IP address in the code line. From <devicename>,<IPaddress> to <IPaddress>,<devicename>.

Also double check the MAC address's used. Make sure they match exactly with the device. If listed as upper case by the device, use upper case in the code.
 
Last edited:
As a troubleshooting step if you haven't tried this already. Try using the naming method in my previous thread post which I pulled from another post in that earlier YazFi thread.

Your current code:
Code:
#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,Amcrest_1,192.168.6.195" $CONFIG
pc_append "dhcp-host=9C:8E:CD:24:6E:E3,Amcrest_3,192.168.6.196" $CONFIG
Try changing it to THIS:
Code:
#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,192.168.6.195,Amcrest_1" $CONFIG
pc_append "dhcp-host=9C:8E:CD:24:6E:E3,192.168.6.196,Amcrest_3" $CONFIG

Reverse the device name and it's IP address in the code line. From <devicename>,<IPaddress> to <IPaddress>,<devicename>.

Also double check the MAC address's used. Make sure they match exactly with the device. If listed as upper case by the device, use upper case in the code.
Thank you for the suggestions bennor.
I am going to implement them for lack of a better option.
I have validated that both MAC are correct.
Both devices MAC are reported by themselves as lower case but if that turns out to be the issue I will be stumped but happy.

I have D&D on roll20 coming up and someone is streaming plex so I cannot reboot the router until later this evening. I will report back after the fact.

Changes applied (pending reboot)

Code:
v125027@AX86U:/tmp/home/root# cat /jffs/scripts/dnsmasq.postconf
#!/bin/sh
. /opt/share/diversion/file/post-conf.div # Added by Diversion
/jffs/scripts/uiDivStats dnsmasq & # uiDivStats

#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,192.168.6.195,Amcrest_1" $CONFIG
pc_append "dhcp-host=9c:8e:cd:24:6e:e3,192.168.6.196,Amcrest_3" $CONFIG



v125027@AX86U:/tmp/home/root# cat /var/lib/misc/dnsmasq.leases | grep Amcrest
85568 9c:8e:cd:24:6e:e3 192.168.6.124 Amcrest_3 01:9c:8e:cd:24:6e:e3
85568 9c:8e:cd:24:03:c2 192.168.6.197 Amcrest_1 01:9c:8e:cd:24:03:c2
 
As a troubleshooting step if you haven't tried this already. Try using the naming method in my previous thread post which I pulled from another post in that earlier YazFi thread.

Your current code:
Code:
#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,Amcrest_1,192.168.6.195" $CONFIG
pc_append "dhcp-host=9C:8E:CD:24:6E:E3,Amcrest_3,192.168.6.196" $CONFIG
Try changing it to THIS:
Code:
#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,192.168.6.195,Amcrest_1" $CONFIG
pc_append "dhcp-host=9C:8E:CD:24:6E:E3,192.168.6.196,Amcrest_3" $CONFIG

Reverse the device name and it's IP address in the code line. From <devicename>,<IPaddress> to <IPaddress>,<devicename>.

Also double check the MAC address's used. Make sure they match exactly with the device. If listed as upper case by the device, use upper case in the code.
bennor,
interestingly the change you suggested worked.
Probably switching the IP | host name in the dnsmasq.leases file.

Puzzling is that in Wireless Logs it is not accurately reporting the devices IPs. (less important than working as needed)

Code:
v125027@AX86U:/tmp/home/root# cat /var/lib/misc/dnsmasq.leases | grep Amcrest
86385 9c:8e:cd:24:6e:e3 192.168.6.196 Amcrest_3 01:9c:8e:cd:24:6e:e3
86381 9c:8e:cd:24:03:c2 192.168.6.195 Amcrest_1 01:9c:8e:cd:24:03:c2
v125027@AX86U:/tmp/home/root# cat /jffs/scripts/dnsmasq.postconf
#!/bin/sh
. /opt/share/diversion/file/post-conf.div # Added by Diversion
/jffs/scripts/uiDivStats dnsmasq & # uiDivStats

#!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
#Set IP reservation
pc_append "dhcp-host=9c:8e:cd:24:03:c2,192.168.6.195,Amcrest_1" $CONFIG
pc_append "dhcp-host=9c:8e:cd:24:6e:e3,192.168.6.196,Amcrest_3" $CONFIG
1617421983378.png

The Synology NAS is working with the 2 reserved IPs I set in the dnsmasq so I call it a win.
Asus gui incorrectly showing the previous IP is not of great importance.
Thank you sir.
 
Good to see you got it working. The Asus-Merlin GUI (Network Map section) showing the incorrect IP addresses is a known issue. The workaround is to check the GUI's System Logs > Wireless Logs. Most times that will display the correct IP address assignments when using YazFi. Or one can issue (using SSH to the router): cat /var/lib/misc/dnsmasq.leases to see the current IP address assignments.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top