if ([/interface get wlan1 disabled] = yes) do={ /interface enable wlan1 }
/ip route set [find comment="Group B"] gateway=10.254.254.255;
/ip route set [find comment="Group B"] gateway=10.254.254.255;
:local gw;
/ip route
:foreach i in=[find] do={
:set gw [get $i gateway];
if ($gw = "10.254.254.250") do={
set $i gateway=10.254.254.255;
}
}
My AP's are configured with IP addresses as per image below....Often IP addresses that end in .255 are broadcast addresses and cannot be gateways. Yours might be OK since we don't know the subnet mask of your IP address on that network.
then use yourMaybe I am not following, this will change any gw with 250 to 255, then both load groups go via gw 255. Now can not separate them again, as they identical Both gateways area active (load balancing), unless one falls over then, the failed GW is routed to the remaining active gateway, which is why I thought searching it on the "Comment" or maybe even "routing mark" field would be the easiest....
:foreach i in=[find comment="Group B"]
:foreach i in=[find]
this should do the same:Ok I solved it without using a if statement.
:foreach i in=[interface wireless find default-forwarding=yes] do={/interface wireless set $i default-forwarding=no}
:foreach i in=[interface wireless find default-authentication=yes] do={/interface wireless set $i default-authentication=no}
:foreach i in=[interface wireless find hide-ssid=no] do={/interface wireless set $i hide-ssid=yes}
/interface wireless set [find] default-forwarding=no default-authentication=no hide-ssid=yes
/system script add name=test source=":foreach i in=[interface wireless find default-forwarding=yes] do={/interface wireless set $i default-forwarding=no}"
do={/interface wireless set default-forwarding=no}
Dears,
I am trying to use this script to check two-parameter but it just executes without any action.
:foreach i in=[ip firewall nat find action=masquerade chain=srcnat src-address-list=no dst-address-list=no ] do={/ip firewall nat set src-address-list=AllowedSrc dst-address-list=AllowedDst}
I'd like to check inside of my NAT if the "src-address-list & dst-address-list" exist do nothing and IF they are not specified and not exist add "src-address-list=AllowedSrc" & dst-address-list=AllowedDst
I would be very grateful if someone helps me with this issue.
{
:foreach i in=[ip firewall nat find where action="masquerade" && chain="srcnat" && src-address-list="no" && dst-address-list="no"]
do={/ip firewall nat set src-address-list=AllowedSrc dst-address-list=AllowedDst}
}
{
/ip firewall nat
set [find action=masquerade chain=srcnat] src-address-list="AllowedSrc" dst-address-list="AllowedDst"
}
{
/ip firewall nat
set [find action=masquerade chain=srcnat src-address-list=""] src-address-list="AllowedSrc" dst-address-list="AllowedDst"
}
Dear msatter,{
/ip firewall nat
[set [find masquerade chain=srcnat] src-address-list="AllowedSrc" dst-address-list="AllowedDst"]
}
My guess.
{
/ip firewall nat
# only marked and no src-address-list present
set [find action=masquerade chain=srcnat src-address-list="" comment="only-src-address-list"] src-address-list="AllowedSrc"
# only marked and no dst-address-list present
set [find action=masquerade chain=srcnat dst-address-list="" comment="only-dst-address-list"] dst-address-list="AllowedDst"
# all the rest which have no address-list attached to them
set [find action=masquerade chain=srcnat src-address-list="" dst-address-list=""] src-address-list="AllowedSrc" dst-address-list="AllowedDst"
}
{
/ip firewall nat
set [find action=masquerade chain=srcnat src-address-list=""] src-address-list="AllowedSrc"
set [find action=masquerade chain=dstnat dst-address-list=""] dst-address-list="AllowedDst"
}
{
/ip firewall nat
set [find action=masquerade chain=srcnat src-address-list!="" dst-address-list=""] src-address-list="AllowedSrc"
set [find action=masquerade chain=dstnat dst-address-list!="" src-address-list=""] dst-address-list="AllowedDst"
set [find action=masquerade chain=dstnat dst-address-list="" src-address-list=""] src-address-list="AllowedSrc" dst-address-list="AllowedDst"
}
{
/ip firewall nat
set [find action=masquerade chain=srcnat src-address-list!="" dst-address-list=""] src-address-list="AllowedSrc"
set [find action=masquerade chain=dstnat dst-address-list!="" src-address-list=""] dst-address-list="AllowedDst"
set [find action=masquerade chain=dstnat dst-address-list="" src-address-list=""] src-address-list="AllowedSrc" dst-address-list="AllowedDst"
}
find !src-address-list !dst-address-list
Dear ChupakaI believe that's what you're looking for:Code: Select allfind !src-address-list !dst-address-list
{
:foreach i in=[ip firewall nat find where action="masquerade" && chain="srcnat" && !src-address-list && !dst-address-list]
do={/ip firewall nat set src-address-list=AllowedSrc dst-address-list=AllowedDst}
}
Dear CZFanThis should set src/dst address lists where both are none
Code: Select all{ :foreach i in=[ip firewall nat find where action="masquerade" && chain="srcnat" && !src-address-list && !dst-address-list] do={/ip firewall nat set src-address-list=AllowedSrc dst-address-list=AllowedDst} }
{
:foreach i in=[/ip firewall nat find where action="masquerade" && chain="srcnat" && !src-address-list && !dst-address-list] \
do={/ip firewall nat set $i src-address-list=AllowedSrc dst-address-list=AllowedDst}
}
apologies, left out the reference to the variable ($i) in the "do" statement, try below:
Code: Select all{ :foreach i in=[/ip firewall nat find where action="masquerade" && chain="srcnat" && !src-address-list && !dst-address-list] \ do={/ip firewall nat set $i src-address-list=AllowedSrc dst-address-list=AllowedDst} }
:if ([/interface wireless get wlan1 hide-ssid]) do={
/interface wireless set wlan1 hide-ssid=no
} else={
/interface wireless set wlan1 hide-ssid=yes
}
:local Wlan [find name=wlan1]
/interface wireless
:if [get $Wlan hide-ssid] do={
set $Wlan hide-ssid=no
} else={
set $Wlan hide-ssid=yes
}
:local Wlan [find name=wlan1];/interface wireless;:if [get $Wlan hide-ssid] do={set $Wlan hide-ssid=no} else={set $Wlan hide-ssid=yes}
/interface wireless set wlan1 hide-ssid=(![get wlan1 hide-ssid])
/interface wireless set wlan1 hide-ssid=(![get wlan1 hide-ssid])
# force show the ssid
/interface wireless; :if [get wlan1 hide-ssid] do={set wlan1 hide-ssid=no}
# force hide the ssid
/interface wireless; :if (![get wlan1 hide-ssid]) do={set wlan1 hide-ssid=yes}
# force show the ssid
/interface wireless set [find name=wlan1 and hide-ssid] hide-ssid=no
# force hide the ssid
/interface wireless set [find name=wlan1 and !hide-ssid] hide-ssid=yes
/ip firewall nat
remove [find action=masquerade]
add action=masquerade chain=srcnat out-interface-list=WAN place-before=0
False security!!Thanks a lot guys again. I know that wifi is still alive when SSID is hidden but for my work is the best that only I know to connect based on my known wifi profile.
For all others is not necessary to know that exists.
I will save all these scripts to learn it as well.
Thanks again men.
Zdenek
0 do not exist, and is wrong use numbers or IDs on script.
first check how many rules are presents, if present at least one execute the command wiith place-before=([find]->0) else with nothing.
I see you read what I wrote... yes, but whatever you like...so in this case command "place-before=([find]->0)" doesn't work.