Wed Feb 26, 2014 8:37 pm
Hello,
Reading some related posts i came to my config which seems to work on my ipv4 and ipv6 network.
The setup is like this:
Internet
|
ISP router with NAT (192.168.1.1; ipv6: 2axx:x:x:x/64 prefix RouterAdvertised)
|
ether5
Mikrotik + wlan
ether4
|
LAN (192.168.1.0/24; ipv6: fe80:: ; 2axx:x:x:x/64)
-----------
Somebody has suggested to create additional chains (l2in, l2out, l2in6, l2out6) to distinguish the inbound and outbound traffic. This is awkward, but is the only workaround i know so far that allows to mitigate the absence of the security zones/levels and inbound/outbound directions in Mikrotik architecture. The good things that are possible in Cisco/Juniper are still to be implemented by Mikrotik.
So, i connected my LAN switch to the port 4 (ether4), and the router to the port 5. I went to the bridge/ports and left in the bridge only ether4, ether5 and wlan. This way i have isolated them from the default ether1-gateway and ether2-master-local interfaces.
Then i have adapted/added some more rules into the IP and IPv6 sections:
-----------------#IPv4--------------------------------
[admin@MikroTik] /ip firewall filter> export
# feb/25/2014 19:27:18 by RouterOS 6.10
# software id = 7KY2-EXIY
#
/ip firewall filter
add chain=input comment="default configuration" protocol=icmp
add chain=input connection-state=new src-address=192.168.1.0/24
add chain=input comment="default configuration" connection-state=established
add chain=input comment="default configuration" connection-state=related
add action=drop chain=input comment="default configuration" in-interface=ether1-gateway
add chain=forward protocol=icmp
add chain=forward dst-address=239.0.0.0/8 protocol=udp src-address=192.168.1.0/24
add chain=forward dst-address=224.0.0.0/16 src-address=192.168.1.0/24
add chain=forward dst-address=192.168.1.255 src-address=192.168.1.0/24
add chain=forward dst-address=255.255.255.255 src-address=192.168.1.0/24
add chain=forward comment="default configuration" connection-state=established
add chain=forward comment="default configuration" connection-state=related
add chain=forward dst-address=255.255.255.255 dst-port=67,68 protocol=udp src-address=0.0.0.0
add chain=forward dst-address=239.0.0.0/8 protocol=igmp src-address=192.168.1.0/24
add action=jump chain=forward in-bridge-port=ether4 jump-target=l2out out-bridge-port=ether5
add action=jump chain=forward in-bridge-port=ether5 jump-target=l2in out-bridge-port=ether4
add action=jump chain=forward in-bridge-port=wlan1 jump-target=l2out out-bridge-port=ether5
add action=jump chain=forward in-bridge-port=ether5 jump-target=l2in out-bridge-port=wlan1
add action=log chain=forward
add action=drop chain=forward comment="default configuration" connection-state=invalid
add action=drop chain=forward
add chain=l2out src-address=192.168.1.0/24
add chain=l2out
add action=log chain=l2out
add action=drop chain=l2out
add chain=l2in connection-state=established
add chain=l2in connection-state=related
add chain=l2in dst-address=192.168.1.xx dst-port=yy protocol=tcp
add chain=l2in dst-address=192.168.1.0/24 src-address=192.168.1.1
add action=log chain=l2in
add action=drop chain=l2in
[admin@MikroTik] /ip firewall filter>
-------------------#IPv6-------------------------------------
[admin@MikroTik] /ipv6 firewall filter> export
# feb/25/2014 19:29:19 by RouterOS 6.10
# software id = 7KY2-EXIY
#
/ipv6 firewall filter
add chain=input protocol=icmpv6
add chain=input dst-address=ff02::1/128 src-address=fe80::/10
add chain=input connection-state=established
add chain=input connection-state=related
add action=log chain=input
add chain=forward protocol=icmpv6
add action=jump chain=forward in-bridge-port=ether5 jump-target=l2in6 out-bridge-port=ether4
add action=jump chain=forward in-bridge-port=ether4 jump-target=l2out6 out-bridge-port=ether5
add action=jump chain=forward in-bridge-port=ether5 jump-target=l2in6 out-bridge-port=wlan1
add action=jump chain=forward in-bridge-port=wlan1 jump-target=l2out6 out-bridge-port=ether5
add action=drop chain=forward
add chain=l2out6
add action=log chain=l2out6
add action=reject chain=l2out6 connection-state=invalid reject-with=icmp-port-unreachable
add chain=l2in6 protocol=icmpv6
add chain=l2in6 dst-address=fe80::/10 src-address=fe80::/10
add chain=l2in6 dst-address=ff00::/8
add chain=l2in6 connection-state=established
add chain=l2in6 connection-state=related
add chain=l2in6 dst-address=2axx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/128 dst-port=zzz protocol=udp
add chain=l2in6 dst-address=2axx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/128 dst-port=55555 protocol=tcp
add chain=l2in6 connection-state=new dst-address=2axx:xxxx:xxxx:xxxx::/64 dst-port=zzz protocol=tcp
add chain=l2in6 connection-type=ftp dst-address=2axx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/128 dst-port=20,21 protocol=tcp
add action=log chain=l2in6
add action=reject chain=l2in6 reject-with=icmp-address-unreachable
[admin@MikroTik] /ipv6 firewall filter>
----------------------------------------------------
Right before the denies i put the log lines to troubleshoot the possible errors.
Well, it works as i want it to. It filters the NATed ipv4 traffic and allows the open ports. In ipv6 mode, it allows ICMP and NS/NA/RS/RA packets both ways. Everything outbound is allowed.
Almost all the configuration was done using the web-based GUI.
There may be some unnesessary lines, redundant rules, errors, etc. Adapt and use. Propose better solutions.
I hope this ipv6 transparent config will be useful for somebody.