Community discussions

MikroTik App
 
wpeople
Member
Member
Topic Author
Posts: 378
Joined: Sat May 26, 2007 6:36 pm

Check-gateway on DHCP and PPPoE

Sun Nov 14, 2021 2:25 pm

Hello,
I'm interested if there is a possiblity to set "check-gateway" feature on default gateway pushed by DHCP or PPPoE server?

Is there a hidden trick, script or something to make this possible?

Both DHCP and PPPoE has the possiblity for a dynamic IP customer endpoint, that provider gives different Gateway,
so if i manually add what i know - and disable "add default route" - may hurt (unless i know all the possiblities they can push, and
manually add all of them)

If not, should we add that to feature requests?

Greets,
 
tdw
Forum Guru
Forum Guru
Posts: 1843
Joined: Sat May 05, 2018 11:55 am

Re: Check-gateway on DHCP and PPPoE  [SOLVED]

Sun Nov 14, 2021 3:11 pm

You can use/abuse routing filters, e.g.
/routing filter
add chain=dynamic-in prefix=0.0.0.0/0 set-check-gateway=ping


changes /ip route print detail from
0 ADS dst-address=0.0.0.0/0 gateway=pppoe-xxxxxxx
gateway-status=pppoe-xxxxxxx reachable distance=1 scope=30
target-scope=10

to
0 ADS dst-address=0.0.0.0/0 gateway=pppoe-xxxxxxx
gateway-status=pppoe-xxxxxxx reachable check-gateway=ping distance=1
scope=30 target-scope=10
 
entrophy
just joined
Posts: 3
Joined: Sat May 20, 2017 12:55 am

Re: Check-gateway on DHCP and PPPoE

Thu Jan 13, 2022 3:52 pm

Can somebody know how to achieve same effect on ROS 7.1.1?

Tried something like this, released and renewed dhcp client, but without effect.
/routing filter rule
add chain=dynamic_in disabled=no rule="if (distance == 20) { set distance 10; accept; set gw-check icmp; accept }"
 
Sob
Forum Guru
Forum Guru
Posts: 9119
Joined: Mon Apr 20, 2009 9:11 pm

Re: Check-gateway on DHCP and PPPoE

Thu Jan 13, 2022 4:04 pm

There's no dynamic-in in v7, but another way how to achieve what you want is using lease script:

viewtopic.php?p=898546#p898546
 
entrophy
just joined
Posts: 3
Joined: Sat May 20, 2017 12:55 am

Re: Check-gateway on DHCP and PPPoE

Thu Jan 13, 2022 4:57 pm

There's no dynamic-in in v7, but another way how to achieve what you want is using lease script:

viewtopic.php?p=898546#p898546
Thank you mate! That's quite brilliant sollution. I've even added to ignore gateway given by broadband modem while in syncing mode (It is assigning address from 192.168.100.0/24 before it sync with docsis network):
:if ($bound=1 and $"gateway-address" != "192.168.100.254") do={
/ip route set [ find where dst-address="0.0.0.0/0" and distance=1 ] disabled=no gateway=$"gateway-address"
} else={
/ip route set [ find where dst-address="0.0.0.0/0" and distance=1 ] disabled=yes
}
 
weedzer
just joined
Posts: 1
Joined: Tue May 23, 2023 7:10 pm

Re: Check-gateway on DHCP and PPPoE

Sat Jul 22, 2023 11:31 am

Thanks for your information, you can achieve this by adding this to script section of dhcp client :
:if ($bound=1) do={
/ip route set [ find where dst-address="0.0.0.0/0" and distance=1 ] check-gateway=ping
}

Who is online

Users browsing this forum: Ahrefs [Bot], anav, Bing [Bot], Cr4shOnPc and 77 guests