Community discussions

MikroTik App
 
kiharapet
just joined
Topic Author
Posts: 20
Joined: Wed Apr 15, 2020 2:30 pm

Script for Router Login DNS record

Sat Dec 04, 2021 6:25 pm

Hi
I am fairly new to scripting and would like some help of direction.
I have a cell router and i have enabled IP Pass-through so my RB2011 is being issued the IP(sometimes Public sometimes Private) from the Provider this means i cant manage the cellular Router from the configured IP i have to use the Gateway assigned to manage this means i have to login to the Router to pick the Gateway and login.
I am thinking i can have a DNS record that i use and this is updated with the Gateway of the DHCP Client connected to my router by Mikrotik
1. is this possible?
2 if Yes a guide would be ok then i can work on it on my own so that i learn

Also need it to change when the DHCP Client gets a new IP
 
ConnyMercier
Forum Veteran
Forum Veteran
Posts: 724
Joined: Tue Dec 17, 2019 1:08 pm

Re: Script for Router Login DNS record

Sat Dec 04, 2021 11:23 pm

I am not a 100% sure i understand your needs...


This will always keep your DNS-Record up to date
with the actual Internet IPv4 address.
/ip cloud
set ddns-enabled=yes ddns-update-interval=20m
If you want your DNS-Record to contain the local
IP-Adresse use the following :
/ip cloud
set ddns-enabled=yes ddns-update-interval=20m
/ip cloud advanced
set use-local-address=yes
 
kiharapet
just joined
Topic Author
Posts: 20
Joined: Wed Apr 15, 2020 2:30 pm

Re: Script for Router Login DNS record

Sun Dec 05, 2021 3:08 pm

Sorry not DDNS plain dns record this is for LAN use.
I see script in DHCP client config but not sure how it works

the comand should be
/ip dns static add name=cellrouter.lan address= gateway from the dhcp client
 
Sob
Forum Guru
Forum Guru
Posts: 9119
Joined: Mon Apr 20, 2009 9:11 pm

Re: Script for Router Login DNS record  [SOLVED]

Sun Dec 05, 2021 11:38 pm

Basic script can be for example:
/ip dns static remove [find where name=cellrouter.lan]
:if ($bound=1) do={
  /ip dns static add name=cellrouter.lan address=$"gateway-address"
}

Who is online

Users browsing this forum: drpioneer and 21 guests