Tue Nov 10, 2015 8:15 am
It is possible to see the board default configuration with command:
/system default-configuration print
You can do little changes in this script to change WAN and LAN ports, after modifying the script do:
1. remove any configuration you have:
/system reset-configuration skip-backup=yes no-defaults=yes
2. Connect to the board using ether3-ether5
3. Paste modified script to the terminal
Here is example for your board:
:global ssid;
:global action "apply"
:log info "act=$action";
:if ($action = "apply") do={
# wait for interfaces
:local count 0;
:while ([/interface ethernet find] = "") do={
:if ($count = 30) do={
:log warning "DefConf: Unable to find ethernet interfaces";
/quit;
}
:delay 1s; :set count ($count +1);
};
:local count 0;
:while ([/interface wireless find name=wlan1] = "") do={
:set count ($count +1);
:if ($count = 30) do={
:log warning "DefConf: Unable to find wireless interface";
/ip address add address=192.168.88.1/24 interface=ether3;
/quit
}
:delay 1s;
};
/interface wireless set wlan1 mode=ap-bridge band=2ghz-b/g/n tx-chains=0 rx-chains=0 \
disabled=no wireless-protocol=802.11 distance=indoors
:local wlanMac [/interface wireless get wlan1 mac-address];
:set ssid "MikroTik-$[:pick $wlanMac 9 11]$[:pick $wlanMac 12 14]$[:pick $wlanMac 15 17]"
/interface wireless set wlan1 ssid=$ssid
/interface wireless set wlan1 frequency=auto
/interface wireless set wlan1 channel-width=20/40mhz-Ce ;
/ip dhcp-client add interface=ether2 disabled=no comment="default configuration";
/interface ethernet {
set ether1 name=ether1-slave-local;
set ether3 name=ether3-master-local;
set ether4 name=ether4-slave-local;
set ether5 name=ether5-slave-local;
set ether1-slave-local master-port=ether3-master-local;
set ether4-slave-local master-port=ether3-master-local;
set ether5-slave-local master-port=ether3-master-local;
}
/interface bridge
add name=bridge-local disabled=no auto-mac=yes protocol-mode=rstp;
:local bMACIsSet 0;
:foreach k in=[/interface find] do={
:local tmpPortName [/interface get $k name];
:if (!($tmpPortName~"bridge" || $tmpPortName~"ether2"|| $tmpPortName~"slave")) do={
:if ($bMACIsSet = 0) do={
:if ([/interface get $k type] = "ether") do={
/interface bridge set "bridge-local" auto-mac=no admin-mac=[/interface ethernet get $tmpPortName mac-address];
:set bMACIsSet 1;
}
}
/interface bridge port
add bridge=bridge-local interface=$tmpPortName;
}
}
/ip address add address=192.168.88.1/24 interface=bridge-local comment="default configuration";
/ip pool add name="default-dhcp" ranges=192.168.88.10-192.168.88.254;
/ip dhcp-server
add name=default address-pool="default-dhcp" interface=bridge-local lease-time=10m disabled=no;
/ip dhcp-server network
add address=192.168.88.0/24 gateway=192.168.88.1 comment="default configuration";
/ip dns {
set allow-remote-requests=yes
static add name=router address=192.168.88.1
}
/ip firewall nat add chain=srcnat out-interface=ether2 action=masquerade comment="default configuration"
/ip firewall {
filter add chain=input action=accept protocol=icmp comment="default configuration"
filter add chain=input action=accept connection-state=established,related comment="default configuration"
filter add chain=input action=drop in-interface=ether2 comment="default configuration"
filter add chain=forward action=fasttrack-connection connection-state=established,related comment="default configuration"
filter add chain=forward action=accept connection-state=established,related comment="default configuration"
filter add chain=forward action=drop connection-state=invalid comment="default configuration"
filter add chain=forward action=drop connection-state=new connection-nat-state=!dstnat in-interface=ether2 comment="default configuration"
}
/tool mac-server disable [find];
/tool mac-server mac-winbox disable [find];
:foreach k in=[/interface find] do={
:local tmpName [/interface get $k name];
:if (!($tmpName~"ether2")) do={
/tool mac-server add interface=$tmpName disabled=no;
/tool mac-server mac-winbox add interface=$tmpName disabled=no;
}
}
/ip neighbor discovery set [find name="ether2"] discover=no
}
}