My goals/requirements are following:
- Separate IoT/home automation devices to own VLAN and "regular" devices to other VLAN (iot-vlan, main-vlan)
- Give access to Home Assistant in iot-vlan from main-vlan and remotely by wireguard
- Use Ubiquiti AP to broadcast iot and regular wifi networks (still don't have the AP. Will connect it to the ethernet5 and leave ethernet4 unused.)
- PC and HA Raspberry Pi are connected via ethernet to ports 2 and 3 respectively. PC belongs to main vlan while HA is located into iot-vlan.
Code: Select all
/interface ethernet
set [ find default-name=ether1 ] comment=WAN
set [ find default-name=ether2 ] comment=PC
set [ find default-name=ether3 ] comment=HomeAssistant
set [ find default-name=ether4 ] comment=IoT
set [ find default-name=ether5 ] comment="Home AP"
/interface wireguard
add comment="Wireguard for iPhone" listen-port=13231 mtu=1420 name=wireguard1
/interface vlan
add interface=bridge name=iot-vlan vlan-id=20
add interface=bridge name=main-vlan vlan-id=10
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add name=VLAN
add name=MGMT
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
set [ find default=yes ] html-directory=hotspot
/ip pool
add name=main-pool ranges=10.0.10.2-10.0.10.254
add name=iot-pool ranges=10.0.20.2-10.0.20.254
/ip dhcp-server
add address-pool=main-pool interface=main-vlan name=main-dhcp
add address-pool=iot-pool interface=iot-vlan name=iot-dhcp
/port
set 0 name=serial0
/interface bridge port
add bridge=bridge comment=defconf frame-types=admit-only-untagged-and-priority-tagged interface=ether2 pvid=10
add bridge=bridge comment=defconf frame-types=admit-only-untagged-and-priority-tagged interface=ether3 pvid=20
add bridge=bridge comment=defconf frame-types=admit-only-untagged-and-priority-tagged interface=ether4 pvid=20
add bridge=bridge comment=defconf frame-types=admit-only-untagged-and-priority-tagged interface=ether5 pvid=10
add bridge=bridge comment=defconf frame-types=admit-only-untagged-and-priority-tagged interface=sfp1 pvid=10
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface bridge vlan
add bridge=bridge comment=main-vlan tagged=bridge untagged=ether2,ether5 vlan-ids=10
add bridge=bridge comment=iot-vlan tagged=bridge untagged=ether4,ether3 vlan-ids=20
/interface list member
add comment=defconf interface=bridge list=LAN
add comment=defconf interface=ether1 list=WAN
add interface=main-vlan list=LAN
add interface=iot-vlan list=LAN
add interface=main-vlan list=VLAN
add interface=iot-vlan list=VLAN
add interface=main-vlan list=MGMT
add interface=wireguard1 list=LAN
/interface wireguard peers
add allowed-address=10.0.50.2/32 comment=iPhone interface=wireguard1 public-key="XXX"
/ip address
add address=10.0.10.1/24 interface=main-vlan network=10.0.10.0
add address=10.0.20.1/24 interface=iot-vlan network=10.0.20.0
add address=10.0.50.1/24 interface=wireguard1 network=10.0.50.0
/ip dhcp-client
add comment=defconf interface=ether1
/ip dhcp-server lease
add address=10.0.20.5 mac-address=E8:68:E7:C3:8A:E4 server=iot-dhcp
add address=10.0.20.7 client-id=1:e4:5f:1:32:1b:2b mac-address=E4:5F:01:32:1B:2B server=iot-dhcp
/ip dhcp-server network
add address=10.0.10.0/24 comment=main-dhcp-network gateway=10.0.10.1
add address=10.0.20.0/24 comment=iot-dhcp-network gateway=10.0.20.1
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.88.1 comment=defconf name=router.lan
add address=10.0.20.7 name=homeassistant.home.arpa
add address=10.0.10.1 name=router.home.arpa
/ip firewall filter
add action=accept chain=input comment="allow WireGuard" dst-port=13231 protocol=udp
add action=accept chain=input comment="allow WireGuard traffic" src-address=10.0.50.0/24
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="Allow main-vlan/MGMT access to all router services" in-interface-list=MGMT
add action=accept chain=input comment="Allow VLAN DHCP" dst-port=67 in-interface-list=VLAN protocol=udp
add action=accept chain=input comment="Allow VLAN DNS UDP" dst-port=53 in-interface-list=VLAN protocol=udp
add action=accept chain=input comment="Allow VLAN DNS TCP" dst-port=53 in-interface-list=VLAN protocol=tcp
add action=accept chain=input comment="Allow VLAN ICMP Ping" in-interface-list=VLAN protocol=icmp
add action=drop chain=input comment="Drop all other traffic"
add action=accept chain=forward comment="defconf: accept in ipsec policy" ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related hw-offload=yes
add action=accept chain=forward comment="defconf: accept established, related, untracked" connection-state=established,related,untracked
add action=accept chain=forward comment="VLAN Internet Access Only" connection-state=new in-interface-list=VLAN out-interface-list=WAN
add action=accept chain=forward comment="Allow Port Forwarding - DSTNAT - enable if need server" connection-nat-state=dstnat connection-state=new \
disabled=yes in-interface-list=WAN
add action=accept chain=forward comment="Allow Wireguard VPN to iot-vlan" in-interface=wireguard1 out-interface=iot-vlan
add action=accept chain=forward comment="Access IoT devices from main-vlan" in-interface=main-vlan out-interface=iot-vlan protocol=tcp
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
add action=drop chain=forward comment="Drop all other traffic"
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" ipsec-policy=out,none out-interface-list=WAN
- viewtopic.php?f=13&t=143620&sid=829729b ... 03c9a63e9f
- https://github.com/hallzhallz/hallzhall ... %20hEX%20S
- https://github.com/beeyev/Mikrotik-Duck ... IP-Updater
- https://help.mikrotik.com/docs/display/ROS/WireGuard
Also looks like I connected the router without ipv6 firewall rules to the internet for about a day, yikes! Reason for this blunder was that after upgrade to the RouterOS7 the device lost the default config and while I setup config based on my RouterOS6.x exported config, I missed ipv6 rules. Noticed today that ipv6 was enabled without firewall rules. I added rules AND disabled ipv6 for extra measure. I did not have IPv6 DHCP server configured.
Realistically speaking, in how big of a danger I have put myself and is there specific extra measures I need to do now? My PCs' had their software firewalls on and according to my port scans there wasn't any unintentional ports open on my devices.