Community discussions

 
severinoeuclides
just joined
Topic Author
Posts: 2
Joined: Sun May 27, 2018 6:19 am

Script to exchange dynamic ip gateway in IP / Routes

Sun May 27, 2018 6:36 am

Hello there everyone of the forum, I am new and would like a help on a Script

I'm trying to find a script to automatically change the dynamic ip of my carrier, where I want to capture the gateway of a rule in IP / DHCP Client and update the route gateway automatically !!

I could leave it there normal, but there is issue and I have 2 internet links and I want to put the rules of routes and execute this script with there rule of sheduler dripping to the dns ip of google 8.8.8.8 if the link signal falls of the operator the script will run automatically, updating the gateway and there is a route !!
 
severinoeuclides
just joined
Topic Author
Posts: 2
Joined: Sun May 27, 2018 6:19 am

Re: Script to exchange dynamic ip gateway in IP / Routes

Sat Jun 09, 2018 7:15 am

I've tried with this script but it does not run at all, can someone help me in this matter !!

:global newgw [/ip dhcp-client get [find interface="ether4" ] gateway ]
:global activegw [/ip routes get [/ip routes find comment="ether4"] gateway ]
:if ($newgw != $activegw) do={
/ip routes set [find comment="ether4"] gateway=$newgw
/ip routes set [find comment="ether4-Wan routing gateway"] gateway=$newgw
}
 
User avatar
ekarin
Trainer
Trainer
Posts: 16
Joined: Fri Jun 01, 2018 9:12 pm
Contact:

Re: Script to exchange dynamic ip gateway in IP / Routes

Mon Sep 24, 2018 6:13 pm

I have seen your issue that is quite similar to my current issue.
Please have a look at the followingpost.
viewtopic.php?f=9&t=139597&p=688423#p688423

Hopefully it helps.

Who is online

Users browsing this forum: No registered users and 9 guests