[Solved] How to add static lease

Hi i ma new to openWRT , i want to add NEW STATIC LEASES but cannot figure out what to fill in the options

Please help ,

you only have to fill in the top three fields, and they're pretty straight forward...

2 Likes

static route != static lease ?

1 Like

OOPS, lol my bad.

1 Like

Thanks for the reply
I did the same u said
my current lease is 2 mins timer after it expires timer starts again instead of new lease i just added , also new lease it shows above not in active lease section
Host name should be the same as active lease?

Post your dnsmasq config...

1 Like

where to find it good sire

1 Like

/etc/config/dhcp, mask the MAC addresses.

1 Like

says permission denied any fix ?

it's a text file, not an executable.

1 Like

Run these two lines and provide the output for us to see:

ubus call system board
cat /etc/config/dhcp
"kernel": "5.15.150",
        "hostname": "OpenWrt",
        "system": "MediaTek MT7621 ver:1 eco:3",
        "model": "TP-Link Archer AX23 v1",
        "board_name": "tplink,archer-ax23-v1",
        "rootfs_type": "squashfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "23.05.3",
                "revision": "r23809-234f1a2efa",
                "target": "ramips/mt7621",
                "description": "OpenWrt 23.05.3 r23809-234f1a2efa"

posted
thanks for reply

Please don't post screenshots... instead, use the "Preformatted text </>" button for logs, scripts, configs and general console output.
grafik
Please edit your post accordingly. Thank you! :slight_smile:

And we still need to see the dhcp file.

config dnsmasq
        option domainneeded '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option cachesize '1000'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
        option localservice '1'
        option ednspacket_max '1232'
        option sequential_ip '1'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '2m'
        option dhcpv4 'server'
        option dhcpv6 'server'
        option ra 'server'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

config host
        option ip '192.168.1.150'
        option leasetime '5m'
        list match_tag 'known'
        option name 'DESKTOP-PL3FHSU.lan'
        list mac ''

Remove the tag line, and change the name to just 'DESKTOP-PL3FHSU' (dropping the .lan from the above.

Also, I'd recommend removing the lease time from the static lease config and you should probably use a longer DHCP lease time in the lan server in general, unless you have a good reason for such short lease times.

Then, reboot your router, followed by a reboot of the host.

My purpose of doing this is to get another stactic ip from my sub router (open wrt flashed) .i already changed the name but my new lease never becomes active , my active lease timer goes expired then again it starts instead of my new lease

How exactly is this 'sub router' configured? Can you show us a topology diagram (a photo of a sketch on paper is sufficient)?

When you say "another static IP" -- what exactly do you mean by that? In most cases, a given host will have exactly one IP address. It would be good to know in more specific detail what you are aiming to achieve.

Did you try the things I recommended? The lease time issue isn't critical, but I'd still recommend those changes... they can wait, though.

My main router has static ip address so i plugged in a lan cable from my main router to a new router flashed open wrt and new router lan cable is connected to my PC giving me an ip adress thats mentioned in the static lease and cahnged arp table

i am hoping to get a dynamic ip adress from my open wrt flashed router ,is it possible or to manually change ip mentioned in static lease

yes i fixed the host name followed by save apply reboot router ,reboot host still static lease time expires and start again .
also to mention to add another static lease i filled above 3 options only , host name mac and ipv4 and selected known tag

which port (wan/lan) on the openwrt router ?