0% found this document useful (0 votes)
4 views

v6 Dhcp Client Script

The document contains scripts for configuring routing based on the availability of multiple WAN interfaces (ether1 to ether5) in a network. Each section checks if a specific interface is bound and manages routes accordingly, adding or updating routes with a specific comment and gateway. If an interface is not bound, the corresponding route is removed.

Uploaded by

jobel.mindac
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

v6 Dhcp Client Script

The document contains scripts for configuring routing based on the availability of multiple WAN interfaces (ether1 to ether5) in a network. Each section checks if a specific interface is bound and manages routes accordingly, adding or updating routes with a specific comment and gateway. If an interface is not bound, the corresponding route is removed.

Uploaded by

jobel.mindac
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

{

:local rmark "to_wan1"


:local GWay [/ip dhcp-client get [find interface="ether1"] gateway];
:local count [/ip route print count-only where comment="to_wan1"]
:if ($bound=1) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan1 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether1")%ether1 pref-src="" routing-
table=ISP1
/ip route add check-gateway=ping comment=to_wan1 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether1")%ether1 pref-src="" routing-
table=main
} else={
:if ($count = 1) do={
:local test [/ip route find where comment="to_wan1"]
:if ([/ip route get $test gateway] != ($GWay."%ether1")) do={
/ip route set $test gateway=($GWay."%ether1")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan1"]
}
}

------------------------------------------

{
:local rmark "to_wan2"
:local GWay [/ip dhcp-client get [find interface="ether2"] gateway];
:local count [/ip route print count-only where comment="to_wan2"]
:if ($bound=2) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan2 disabled=no distance=2
dst-address=0.0.0.0/0 gateway=($GWay."%ether2")%ether2 pref-src="" routing-
table=ISP2
/ip route add check-gateway=ping comment=to_wan2 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether2")%ether2 pref-src="" routing-
table=main
} else={
:if ($count = 2) do={
:local test [/ip route find where comment="to_wan2"]
:if ([/ip route get $test gateway] != ($GWay."%ether2")) do={
/ip route set $test gateway=($GWay."%ether2")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan2"]
}
}
---------------------------------------

{
:local rmark "to_wan3"
:local GWay [/ip dhcp-client get [find interface="ether3"] gateway];
:local count [/ip route print count-only where comment="to_wan3"]
:if ($bound=3) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan3 disabled=no distance=3
dst-address=0.0.0.0/0 gateway=($GWay."%ether3")%ether3 pref-src="" routing-
table=ISP3
/ip route add check-gateway=ping comment=to_wan3 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether3")%ether3 pref-src="" routing-
table=main
} else={
:if ($count = 3) do={
:local test [/ip route find where comment="to_wan3"]
:if ([/ip route get $test gateway] != ($GWay."%ether3")) do={
/ip route set $test gateway=($GWay."%ether3")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan3"]
}
}

----------------------------------------------

{
:local rmark "to_wan4"
:local GWay [/ip dhcp-client get [find interface="ether4"] gateway];
:local count [/ip route print count-only where comment="to_wan4"]
:if ($bound=4) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan4 disabled=no distance=4
dst-address=0.0.0.0/0 gateway=($GWay."%ether4")%ether4 pref-src="" routing-
table=ISP4
/ip route add check-gateway=ping comment=to_wan4 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether4")%ether4 pref-src="" routing-
table=main
} else={
:if ($count = 4) do={
:local test [/ip route find where comment="to_wan4"]
:if ([/ip route get $test gateway] != ($GWay."%ether4")) do={
/ip route set $test gateway=($GWay."%ether4")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan4"]
}
}

-----------------------------------------------------

{
:local rmark "to_wan5"
:local GWay [/ip dhcp-client get [find interface="ether5"] gateway];
:local count [/ip route print count-only where comment="to_wan5"]
:if ($bound=5) do={
:if ($count = 0) do={
/ip route add check-gateway=ping comment=to_wan5 disabled=no distance=5
dst-address=0.0.0.0/0 gateway=($GWay."%ether5")%ether5 pref-src="" routing-
table=ISP5
/ip route add check-gateway=ping comment=to_wan5 disabled=no distance=1
dst-address=0.0.0.0/0 gateway=($GWay."%ether5")%ether5 pref-src="" routing-
table=main
} else={
:if ($count = 5) do={
:local test [/ip route find where comment="to_wan5"]
:if ([/ip route get $test gateway] != ($GWay."%ether5")) do={
/ip route set $test gateway=($GWay."%ether5")
}
} else={
:error "Multiple routes found"
}
}
} else={
/ip route remove [find comment="to_wan5"]
}
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy