Community discussions

MUM Europe 2020
 
rviteri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Fri Nov 18, 2011 5:53 pm

RIP over EoIP/VPN (Please improve script)

Wed Mar 14, 2012 11:45 am

My needs:

I have VPN connections from my main router over to several places around the world.
I need to be able to route everything across the VPN.
Easy to maintain (get rid of static routing).

Ideal solution:

Enable RIP over the EoIP tunnel.
Redistribute networks

The Catch:

RIP would brake EoIP tunnel because it would send out routing information of the WAN Network.
WAN Network assigned by DHCP (no static IP available).
Solution:

Use Routing Filter to force not redistribute WAN Network.
If tunnel is down update Filter with new network as it possibly changed IP addresses and or network.

/routing filter
add action=reject chain=rip-out disabled=no invert-match=no prefix=xxx.26.xxx.192/30 set-bgp-prepend-path=""

Make a note of the number:

/routing filter print
Flags: X - disabled
0 chain=rip-out prefix=118.26.195.192/30 invert-match=no action=reject set-bgp-prepend-path=""

Write script to update and set it up Netwatch

1 name="RIPFix" owner="rviteri" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api last-started=mar/14/2012 04:08:21 run-count=8
source=
:local newnetwork [/ip route get [find gateway=ether1-WAN(use the name of your GW)] dst-address]
/routing filter set number=0 prefix=$newnetwork;

:log info "RIPFix updated to $newnetwork1"

Netwatch:

/tool netwatch
add disabled=no down-script="/system script run RIPFix" host=(put an ip at the other side of the tunnel) interval=1s timeout=1s up-script=""

Note: Most likely there is a better way to write this script, however I am not a programmer so if you are and can improve it chime in!

Who is online

Users browsing this forum: No registered users and 7 guests