Check if interface has no IP

Hello, I’m trying to update my DDNS interfaces but when I try to obtain the IP of an interface that has no IP, sometimes some interfaces did not get IP by DHCP cause the ISP is down, then the script abort in that interface, this is the line I use to obtain the ip

:local ddnsinterface "wan3_route"
:local ifip;

:set ifip [ /ip address get [/ip address find interface=$ddnsinterface] address ];
:log info "Actual IP is: $ifip
[code]

If wan3_route get an ip, the line works perfect, if not, then the scripts abort or get sucked in that line.

Thanks

Nobody? :open_mouth:

I would recommend that you put all the script in if clause

If ([:len [/ip adress find where interface=interface_name]] > 0) do={}

The problem its that when the system evaluates the line it stop running the script, to be or not inside the if.

163 Views and nobody knows, I can’t believe it.

Why can you not use the Cloud function on the router?

IP->Clould

Just enable it and then you get a free DNS name from Mikrotik, based on your serial number, some like this
5fa34452b.sn.mynetname.net

It updates automatically all the time.

Then you can just point your outer DNS service to it.
myhost.dyndns.biz → 5fa34452b.sn.mynetname.net → your IP