Firewall

Block Internet for a Specific Device on MikroTik

Cut internet access for one phone, PC or user on a MikroTik router without touching others: static lease, address list, a firewall rule, and the private-MAC trap.

Commands in this article follow RouterOS v7 documentation but have not yet been marked as lab-tested on this site. Always test changes in a lab or maintenance window and keep a backup.

Problem

You want to stop internet access for one device, for example a student's phone during class or a PC that should only use the local network, while everyone else stays online.

Symptoms

  • The device keeps working after you block its IP, because it got a new IP.
  • The block works only for new websites; open apps keep working.

Likely causes

Blocking by IP fails when the DHCP address changes, and phones often use a random (private) MAC address. A firewall rule placed below the "accept established" rule only stops new connections.

Prerequisites

  • The device's MAC address (IP > DHCP Server > Leases).
  • If it is a phone, turn off "private Wi-Fi address" for your network on the phone, or the MAC can change.

Solution (WinBox / CLI)

1. Make the lease static and tag it with an address list. The router then adds the device's IP to the list automatically:

RouterOS CLI
/ip dhcp-server lease make-static [find mac-address="AA:BB:CC:DD:EE:FF"]
/ip dhcp-server lease set [find mac-address="AA:BB:CC:DD:EE:FF"] address-lists=no-internet

2. Drop its internet traffic. Place the rule at the top so even open connections stop:

RouterOS CLI
/ip firewall filter add chain=forward src-address-list=no-internet out-interface-list=WAN action=drop comment="No internet" place-before=0

The device can still reach the local network (printer, file server) because only traffic to the WAN is dropped.

Alternative: block by MAC directly for a device on the LAN bridge:

RouterOS CLI
/ip firewall filter add chain=forward src-mac-address=AA:BB:CC:DD:EE:FF out-interface-list=WAN action=drop comment="No internet MAC" place-before=0

To block only at certain times, add a time= condition. See Time-based internet rules.

Verification

  • On the device, websites stop loading; local resources still work.
  • /ip firewall address-list print where list=no-internet shows its IP.
  • /ip firewall filter print stats where comment~"No internet" shows the counter rising.

Common errors

  • The rule is below FastTrack or "accept established": existing connections continue.
  • The phone uses a private MAC: the static lease never matches.
  • The device has a static IP set by hand: use the IP or MAC rule instead of the DHCP address list.

Rollback

RouterOS CLI
/ip firewall filter remove [find comment~"No internet"]
Go deeper in class

This topic is covered hands-on in MTCNA — MikroTik Certified Network Associate.

View MTCNA
WhatsApp