MikroTik Basic Internet Setup from Scratch (DHCP, NAT, DNS, Firewall)
Configure a new MikroTik router for internet from a blank configuration: WAN and LAN, DHCP server, DNS, NAT masquerade and a safe basic firewall, step by step.
Problem
You have a MikroTik router with no configuration (or you removed the default one) and you need to give internet to a LAN step by step, the way it is taught in MTCNA.
Symptoms
- PCs on the LAN get no IP address.
- The router has internet, but the LAN does not.
- The router is reachable from the internet on WinBox or DNS.
Likely causes
A working setup needs six parts: a WAN address, a LAN address, a DHCP server, DNS, NAT and a firewall. Missing any one of them causes the symptoms above.
Prerequisites
- WAN cable from the ISP in
ether1, LAN devices onether2-ether5. - The ISP connection type: DHCP, static IP or PPPoE. This example uses DHCP. For PPPoE see MikroTik PPPoE client setup.
Solution (WinBox / CLI)
1. Interface lists and LAN bridge
/interface list add name=WAN
/interface list add name=LAN
/interface bridge add name=bridge-lan
/interface bridge port add bridge=bridge-lan interface=ether2
/interface bridge port add bridge=bridge-lan interface=ether3
/interface list member add list=WAN interface=ether1
/interface list member add list=LAN interface=bridge-lan2. WAN and LAN addresses
/ip dhcp-client add interface=ether1 disabled=no
/ip address add address=192.168.88.1/24 interface=bridge-lan3. DHCP server and DNS
/ip pool add name=lan-pool ranges=192.168.88.10-192.168.88.254
/ip dhcp-server add name=lan-dhcp interface=bridge-lan address-pool=lan-pool disabled=no
/ip dhcp-server network add address=192.168.88.0/24 gateway=192.168.88.1 dns-server=192.168.88.1
/ip dns set servers=8.8.8.8,1.1.1.1 allow-remote-requests=yes4. NAT
/ip firewall nat add chain=srcnat out-interface-list=WAN action=masquerade5. Basic firewall (the same idea as MikroTik's default configuration):
/ip firewall filter
add chain=input action=accept connection-state=established,related,untracked
add chain=input action=drop connection-state=invalid
add chain=input action=accept protocol=icmp
add chain=input action=drop in-interface-list=!LAN
add chain=forward action=accept connection-state=established,related,untracked
add chain=forward action=drop connection-state=invalid
add chain=forward action=drop connection-state=new connection-nat-state=!dstnat in-interface-list=WANWarning: Add the firewall while connected from the LAN side, or use Safe Mode in WinBox, so you do not lock yourself out.
Verification
/ip dhcp-client printshowsboundwith an address from the ISP.- A LAN PC gets an address from 192.168.88.10-254 and can open websites.
/ping 8.8.8.8and/ping google.comwork from the router.
Common errors
- DHCP server on the wrong interface (ether2 instead of the bridge).
- Forgot NAT: the router has internet, LAN clients do not.
allow-remote-requests=yeswithout the input firewall: your router becomes an open DNS server.
Rollback
Remove the parts you added in reverse order, or reset to the default configuration with /system reset-configuration. Export first with /export file=basic-setup so you can compare later.
This topic is covered hands-on in MTCNA — MikroTik Certified Network Associate.
View MTCNA