Community discussions

MikroTik App
 
cillininfo
just joined
Topic Author
Posts: 16
Joined: Thu Apr 23, 2020 11:09 am

Each time the LAN IP obtained from dhcp after the host restarts is different from the last time

Thu Apr 23, 2020 12:06 pm

I'm sorry to bother you again, but can you help me? I want to know if there is a way to get the LAN IP from dhcp different each time after the host restarts.
Last edited by cillininfo on Mon Apr 27, 2020 4:55 am, edited 4 times in total.
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: After an IP of the intranet goes offline, the following command is automatically executed

Thu Apr 23, 2020 1:05 pm

/tool netwatch
add down-script="/int pppoe-client set pppoe-out10 disabled=yes
    \n:delay 3s\r\
    \n/int pppoe-client set pppoe-out10 disabled=no\r\
    \n" host=192.168.88.10
 
cillininfo
just joined
Topic Author
Posts: 16
Joined: Thu Apr 23, 2020 11:09 am

Re: After an IP of the intranet goes offline, the following command is automatically executed

Mon Apr 27, 2020 4:46 am

I'm sorry to bother you again, but can you help me? I want to know if there is a way to get the LAN IP from dhcp different each time after the host restarts.
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: Each time the LAN IP obtained from dhcp after the host restarts is different from the last time

Mon Apr 27, 2020 12:06 pm

The easiest way would be making the lease static. If not possible for whichever reason, you can retrieve the active IP by mac address with
/ip dhcp-server lease get [find mac-address=00:01:02:03:04:05] address
And use this to adjust the netwatch script.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3300
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: Each time the LAN IP obtained from dhcp after the host restarts is different from the last time

Mon Apr 27, 2020 12:41 pm

I do convert all DHCP leases to static using this sctipt:

viewtopic.php?t=147251

Who is online

Users browsing this forum: maldridge and 30 guests