Skip to content

Commit ac6d3d4

Browse files
committed
firewall changes
1 parent 93410a4 commit ac6d3d4

3 files changed

Lines changed: 34 additions & 21 deletions

File tree

terraform/mikrotik/firewall.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ locals {
66
{ address = "192.168.0.0/16", comment = "rfc1918", list = "private_addr" },
77
{ address = "10.0.30.2", comment = "jellyfin access", list = "media_clients" },
88
{ address = "10.0.30.3", comment = "jellyfin access", list = "media_clients" },
9-
{ address = "10.0.30.5", comment = "jellyfin access", list = "media_clients" },
10-
{ address = "10.0.30.17", comment = "jellyfin access", list = "media_clients" },
119
]
1210

1311
# - Uses stable map keys (not array indices) so adding/removing rules doesn't cascade changes
@@ -46,7 +44,7 @@ locals {
4644
forward_iot_wan = { order = 220, chain = "forward", action = "accept", comment = "allow iot -> WAN", in_interface = "iot", out_interface_list = "WAN" }
4745
forward_iot_drop_local = { order = 230, chain = "forward", action = "drop", comment = "drop local access on iot net", dst_address_list = "private_addr", in_interface = "iot" }
4846
forward_iot_drop_all = { order = 240, chain = "forward", action = "drop", comment = "drop all other forward from iot", in_interface = "iot" }
49-
forward_guest_ha_tcp = { order = 310, chain = "forward", action = "accept", comment = "allow home assistant from guest", protocol = "tcp", dst_address = "10.0.10.8", dst_port = "8123", in_interface = "guest" }
47+
forward_guest_ha_tcp = { order = 310, chain = "forward", action = "accept", comment = "allow home assistant from guest", protocol = "tcp", dst_address = "10.0.20.4", dst_port = "8123", in_interface = "guest" }
5048
forward_jellyfin_guest = { order = 315, chain = "forward", action = "accept", comment = "allow jellyfin from media_clients", protocol = "tcp", dst_address = "10.0.45.37", dst_port = "8096", src_address_list = "media_clients", in_interface = "guest" }
5149
forward_immich_guest = { order = 320, chain = "forward", action = "accept", comment = "allow immich from media_clients", protocol = "tcp", dst_address = "10.0.45.38", dst_port = "2283", src_address_list = "media_clients", in_interface = "guest" }
5250
forward_guest_dns_udp = { order = 400, chain = "forward", action = "accept", comment = "allow guest DNS (UDP)", protocol = "udp", dst_address = var.dns_ip, dst_port = "53", in_interface = "guest" }

terraform/mikrotik/interfaces.tf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ resource "routeros_interface_bridge" "bridge" {
1111

1212
resource "routeros_interface_bridge_port" "bridge_ports" {
1313
for_each = {
14-
ether2 = { pvid = 1, frame_types = "admit-all" }
15-
ether3 = { pvid = 1, frame_types = "admit-all" }
16-
ether4 = { pvid = 20, frame_types = "admit-only-untagged-and-priority-tagged" }
17-
ether5 = { pvid = 1, frame_types = "admit-all" }
18-
ether6 = { pvid = 1, frame_types = "admit-all" }
19-
ether7 = { pvid = 1, frame_types = "admit-all" }
20-
ether8 = { pvid = 1, frame_types = "admit-all" }
21-
sfp-sfpplus1 = { pvid = 1, frame_types = "admit-all" }
14+
ether1 = { pvid = 1, frame_types = "admit-all" }
15+
ether2 = { pvid = 1, frame_types = "admit-all" }
16+
ether3 = { pvid = 1, frame_types = "admit-all" }
17+
ether4 = { pvid = 20, frame_types = "admit-only-untagged-and-priority-tagged" }
18+
ether5 = { pvid = 1, frame_types = "admit-all" }
19+
ether6 = { pvid = 1, frame_types = "admit-all" }
20+
ether7 = { pvid = 1, frame_types = "admit-all" }
21+
ether8 = { pvid = 1, frame_types = "admit-all" }
2222
}
2323

2424
bridge = routeros_interface_bridge.bridge.name
@@ -47,7 +47,7 @@ resource "routeros_interface_bridge_vlan" "tagged" {
4747
comment = each.key
4848
bridge = routeros_interface_bridge.bridge.name
4949
vlan_ids = [each.value.vlan_id]
50-
tagged = ["bridge", "ether2"]
50+
tagged = ["bridge", "ether1"]
5151
untagged = each.value.untagged_ports
5252
}
5353

@@ -56,7 +56,7 @@ resource "routeros_interface_list" "wan" { name = "WAN" }
5656
resource "routeros_interface_list" "lan" { name = "LAN" }
5757

5858
resource "routeros_interface_list_member" "wan" {
59-
interface = "ether1"
59+
interface = "sfp-sfpplus1"
6060
list = routeros_interface_list.wan.name
6161
}
6262

@@ -94,5 +94,5 @@ resource "routeros_ip_address" "wireguard" {
9494
}
9595

9696
resource "routeros_ip_dhcp_client" "wan" {
97-
interface = "ether1"
97+
interface = "sfp-sfpplus1"
9898
}

terraform/mikrotik/leases.json

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
"iot": [
6565
{
6666
"name": "print-srv-01",
67-
"address": "10.0.20.3",
68-
"mac": "e4:5f:01:62:47:f2"
67+
"address": "10.0.20.7",
68+
"mac": "e4:5f:01:62:47:f3"
6969
},
7070
{
7171
"name": "3d-printer-esp",
@@ -76,6 +76,26 @@
7676
"name": "ratgdo32-disco-esp",
7777
"address": "10.0.20.11",
7878
"mac": "14:33:5c:09:58:a8"
79+
},
80+
{
81+
"name": "haos",
82+
"address": "10.0.20.4",
83+
"mac": "18:66:DA:14:E7:9F"
84+
},
85+
{
86+
"name": "rlnk-doorbell",
87+
"address": "10.0.20.5",
88+
"mac": "50:37:CD:F5:EF:9B"
89+
},
90+
{
91+
"name": "slzb-ultima",
92+
"address": "10.0.20.6",
93+
"mac": "9E:13:9E:33:D2:7C"
94+
},
95+
{
96+
"name": "tesla-charger",
97+
"address": "10.0.20.8",
98+
"mac": "98:ED:5C:93:F5:85"
7999
}
80100
],
81101
"lan": [
@@ -89,11 +109,6 @@
89109
"address": "10.0.10.15",
90110
"mac": "bc:24:11:ea:6b:79"
91111
},
92-
{
93-
"name": "haos-srv-01",
94-
"address": "10.0.10.8",
95-
"mac": "00:50:56:a7:ca:ff"
96-
},
97112
{
98113
"name": "pve-srv-01",
99114
"address": "10.0.10.3",

0 commit comments

Comments
 (0)