I recently got myself a MikroTik router, but its a bit to advanced for me so I’m here asking if you know how to do this. What I want to do is block a port on the router from accessing the internet (one of the physical ports). Lets say port 4 as an example. So anything I plug into port 4 would get LAN access but would be unable to access the internet. Would that be possible?
Hmm but that will only block http/https access right? So all other ports would be open to the internet? Basically you would not be able to surf using a browser but things like SMTP/FTP/Torrents and other things not requiring port 80/443 would still work?
Remove dst-port and protocol and then it SHOULD work regardless traffic type but …
If port 4 is a part of hardware switch (has master interface set ) then this rule will not work as this port (eth4) is treated as master-interface. It inherits master MAC. You can see that if you plug cable into such port then it’s led switches on and the led of master interface is also on even if the master-interface has no cable connected..
If you manage to to bridge your eth4 with the rest of LAN ports then you can use gustavomam’s rule as eth4 will be recognizable as separate interface
Having eth4 bridged you can take advantage of bridge firewalling which is similar to “normal” one but works on the bridge level so bridge is self-firewalled then. https://wiki.mikrotik.com/wiki/Manual:Interface/Bridge
If you want to block other programs, and not internet typical ports for internet browsers (80/443). You should complete with other ports, or permit all traffic in forward from your LAN ports and ether4, then the block all the traffic between ether4 and internet port ( this is more drastic solution, but it’ll works)
add ether4 to main LAN bridge1? Or I need to create another one, like bridge2? Do I need to add other interfaces to bridge2 like ether2, ether3, ether5? Thanks.
If you want ether4 to be in the same network as the rest of the LAN, then yes, add it to the same bridge.
If you want ether4 to be a completely different network, then you don’t need to add it to any bridge. Just un-slave it and then put an IP address onto the interface and configure DHCP, etc.
Yes, I want ether4 to be in the same network as ether2, ether3, ether5.
1.png
But after adding un-slaved ether4 to bridge1, ether4 become slave! And the rule does not work
2.png
3.png
‘Use IP Firewall’ on bridge1 → enabled.
Okay - so this means that even using IP firewall for the bridge won’t allow you to filter on a specific bridge port.
It’s correct for the interface to become slave when you add to a bridge. Slave means that the interface cannot be used directly as an IP interface because it’s acting as a component of some other feature - bridging in this case.
Anyway, you can achieve your goal with a layer 2 bridge filter as mentioned earlier in the thread.
This will cause the bridge not to forward any traffic to/from the interface ether4. Traffic to/from the Internet will not go into the bridge forward filter, but the bridge input / output filters.
One thing to note - if you want to make a bridge which has ALL interfaces isolated from each other but not the Internet, then you can do this easily using the split horizon feature - go into each bridge port and set horizon=1. All ports on the same horizon cannot communicate with each other, but they can communicate with all other ports. So if you want NO “east/west” communication, but ONLY “north/south” then adding all ports to the same horizon is easier than making a set of filter rules for every interface - and probably runs faster too.
/interface bridge filter print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=forward action=drop in-interface=ether4 in-bridge=bridge1 log=no log-prefix=""
1 chain=forward action=drop in-bridge=bridge1 out-interface=ether4 log=no log-prefix=""
Devices connected to physical port ether4 still have internet access.
I use default RouterBOARD 750UP r2 (hEX PoE Lite) configuration. All I want and need is device that connected to physical port ether4 have full local network access but would be unable to access the internet through any protocol (http(s),ssh,telnet,unknown or proprietary protocols,etc). No more or less. Is this possible?
/ip firewall filter
add action=drop chain=forward packet-mark=nointernet out-interface=MyWanInterface
.. place this rule immediately after your first few “accept established,related” type rules.
You really don’t have to worry too much about blocking packets going the other way because if the LAN host(s) on ether4 cannot send anything to the internet, then the Internet won’t have any reply packets to send your way.