Script Help for Newbie Enumerating Ethernet Interfaces
Posted: Tue Dec 04, 2012 2:58 am
Hi,
I'm trying to add "the rest of the Ethernet ports" to the bridge in a script where ether1 will be the WAN interface and ether2 will be the master bridge port.
This works, but I'd like to enumerate the ports rather than statically add lines:
This is my latest failed attempt at enumeration:
I would appreciate any comments including tips on how to troubleshoot scripts.
Thanks in advance,
G
I'm trying to add "the rest of the Ethernet ports" to the bridge in a script where ether1 will be the WAN interface and ether2 will be the master bridge port.
This works, but I'd like to enumerate the ports rather than statically add lines:
Code: Select all
#
# Set up the bridge and add the interfaces if required.
#
:if ($internalinterface = $bridgeinterface) do={
/interface bridge add comment="LAN Bridge" disabled=no name=$bridgeinterface;
#
/interface bridge port add bridge=$bridgeinterface comment="Master Bridge Port" disabled=no\
edge=auto external-fdb=auto horizon=none interface=$etherlaninterface path-cost=10\
point-to-point=auto priority=0x80;
#
:if ($bridgetherest = "yes") do={
/interface bridge port add bridge=$bridgeinterface comment="Bridged Port" disabled=no\
interface=ether3;
/interface bridge port add bridge=$bridgeinterface comment="Bridged Port" disabled=no\
interface=ether4;
/interface bridge port add bridge=$bridgeinterface comment="Bridged Port" disabled=no\
interface=ether5;
}
#
/interface bridge port add bridge=$bridgeinterface comment="Wireless Bridge Port" disabled=no\
interface=$wlaninterface;
}
#
Code: Select all
#
# Set up the bridge and add the interfaces if required.
#
:if ( $internalinterface = $bridgeinterface ) do={
/interface bridge add comment="LAN Bridge" disabled=no name=$bridgeinterface;
#
/interface bridge port add bridge=$bridgeinterface comment="Master Bridge Port" disabled=no\
edge=auto external-fdb=auto horizon=none interface=$etherlaninterface path-cost=10\
point-to-point=auto priority=0x80;
#
:if ( $bridgetherest = "yes" ) do={
:foreach i in [/interface find type=ether] do={
:local ethername [/interface get $i name];
:if (( $ethername != ether1 ) and ( $ethername != ether2 )) do={
/interface bridge port add bridge=$bridgeinterface comment="Bridged Port" disabled=no\
interface=$ethername;
}
}
}
# Add the wireless LAN to the bridge
/interface bridge port add bridge=$bridgeinterface comment="Wireless Bridge Port" disabled=no\
interface=$wlaninterface;
}
#
Thanks in advance,
G