Community discussions

MikroTik App
 
mightywill
just joined
Topic Author
Posts: 5
Joined: Mon Sep 28, 2015 6:52 pm

ether2 as gateway

Mon Nov 09, 2015 7:40 pm

Hello

It looks like my 951 router has stability issues with ether1 similar to that
http://forum.mikrotik.com/viewtopic.php?t=93908

so I would like to try ether2 as a gateway - how to configure that? my skills are not very high in such things
Th router is working as DCHP client and server
 
User avatar
mbfound
Member Candidate
Member Candidate
Posts: 135
Joined: Tue Jul 01, 2014 1:18 pm
Location: South Africa

Re: ether2 as gateway

Mon Nov 09, 2015 7:50 pm

So ether1 was the client and im guessing the rest of the ports (probably wireless too) were bridged and had a dhcp server on the bridge?

edit: btw i've had 951s where ether1 stopped working temporarily (about 3) and 1 permanently.
 
mightywill
just joined
Topic Author
Posts: 5
Joined: Mon Sep 28, 2015 6:52 pm

Re: ether2 as gateway

Mon Nov 09, 2015 9:38 pm

yes, but not sure about whether there is a bridge or not - where can I check that? I suppose it's in the bridge mode but help me please to ensure that.
 
User avatar
PaulsMT
MikroTik Support
MikroTik Support
Posts: 282
Joined: Tue Feb 10, 2015 3:21 pm

Re: ether2 as gateway

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
}
}

Who is online

Users browsing this forum: No registered users and 185 guests