Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - meyergru

#1
Migrating from UniFi OS Server to a UDM-SE without replacing OPNsense

I recently replaced my self-hosted UniFi OS Server (UOS) with a Dream Machine SE. Not because I wanted another router, but because I wanted to use UniFi Protect, which isn't available as a supported self-hosted application. OPNsense already handles routing, firewalling and DHCP, and I had no intention of changing that. The Dream Machine was supposed to act as a Network/Protect controller and an additional Layer-2 switch. One disadvantage worth mentioning: unlike the self-hosted UOS, the Dream Machine doesn't support Multi-Site Management. If you depend on that, this probably isn't the right solution.

My setup uses OPNsense at 192.168.132.1, with the UDM-SE at 192.168.132.29. The existing VLANs (IoT, Guest and DMZ) are configured as third-party gateway networks. The Dream Machine's Default network is the exception, since UniFi insists on treating it as a routed network. The UDM-SE is connected to a Pro Max 16 PoE via a 10 Gbps SFP+ DAC.

Getting the Dream Machine online

Initially, I connected the Dream Machine through a LAN port, assigned 192.168.132.29/24 to its Default network and disabled DHCP. To provide Internet access without using the WAN interface, I added two static routes through the UniFi GUI:

0.0.0.0/1   via 192.168.132.1
128.0.0.0/1 via 192.168.132.1

These cover the entire IPv4 address space and take precedence over a conventional default route because of longest-prefix matching. They also survive reboots, so no SSH scripts are needed. DNS, ICMP and HTTPS worked, including firmware downloads. Unfortunately, UniFi OS still considered the console offline. Apparently, at least with the newer firmware, working Internet connectivity isn't enough; UniFi also expects an operational WAN interface. Updates were detected but couldn't be installed through the GUI.

My UDM-SE initially came with UniFi OS 4.4.6, and its Network application was too old to restore the configuration from my existing UOS. Since the actual Internet connection worked, I upgraded via SSH:

ubnt-systool fwupdate <firmware-download-URL>

I first upgraded UniFi OS to 5.1.35, then eventually to 6.x. The firmware images are available from Ubiquiti; obviously, use the correct image for the UDM-SE and observe any required intermediate versions. The Network application can also be updated from the CLI:

uos runnable latest-versions unifi-native
uos runnable install --progress --max-release-channel release --version 10.6.109-36013-1 unifi-native

In my case, Network 10.6.109 was required to match the source UOS installation. The Dream Machine now runs UniFi OS 6.x with Network 10.x.

Migrating the Network configuration

This turned out to be the troublesome part. My first attempt was to restore the complete .unifi backup from UOS. The Dream Machine promptly disappeared from the network and disrupted the production LAN badly enough that I had to disable its upstream switch port. Restoring only the Network configuration initially produced the same result. Even switching the upstream connection from trunk to access mode made no difference.

Eventually, I examined the configuration stored on the source UOS. The relevant API endpoint is:

https://<UOS-IP>/proxy/network/api/s/default/rest/networkconf

The Default network contained the following settings:

purpose:         corporate
gateway_type:    default
ip_subnet:       192.168.132.1/24
dhcpd_enabled:   true
ipv6_ra_enabled: true

That explained quite a lot. On the self-hosted UOS, these are stored network definitions; the server doesn't actually become the gateway at 192.168.132.1. On the Dream Machine, however, those settings can become active. In my case, this meant a potential IP conflict with OPNsense and a competing DHCP server. I didn't establish which was primarily responsible for the disruption, but neither was acceptable.

Unfortunately, the UOS GUI wouldn't let me change the Default network settings. The Network API has its own validation restrictions, so I went directly to MongoDB. Before doing this, take a VM snapshot, preferably working on an isolated clone rather than the production controller.

sudo uosserver shell
mongo --port 27117 ace

The relevant collection is networkconf. First find the Default network:

db.networkconf.findOne({name:"Default"})

Then modify the relevant fields. This is the actual change I made:

db.networkconf.updateOne(
  {
    _id: ObjectId("6735f9f333061255845d5b21"),
    name: "Default",
    ip_subnet: "192.168.132.1/24"
  },
  {
    $set: {
      ip_subnet: "192.168.132.29/24",
      dhcpd_enabled: false,
      ipv6_ra_enabled: false,
      auto_scale_enabled: false,
      setting_preference: "manual"
    }
  }
)

Obviously, substitute your own document ID and addresses. I deliberately left purpose=corporate and gateway_type=default unchanged, since the Dream Machine expects its Default network to be a gateway-type network. After restarting UOS, I checked the configuration through the Network API again and confirmed that the changes had survived.

Important: These database commands apply to UniFi Network 10.x. Starting with Network 11, Ubiquiti migrated the application database from MongoDB to PostgreSQL. Direct MongoDB modifications as described here are therefore not applicable to Network 11. See the official Network 11 release notes before attempting anything similar on newer versions.

With the corrected configuration, I exported the individual site directly through the Network UI on the source UOS (Settings / System / Site Management / Export Site). This produces a .unf file, so no external backup utility is needed. I checked the resulting file and confirmed that it contained the corrected address and disabled DHCP/RA settings. I then used this .unf to restore the Network configuration on the Dream Machine, rather than restoring the complete .unifi system backup.

One important detail: disable DHCP again after the restore. The Dream Machine initializes its Default network with certain assumptions of its own, and DHCP may become enabled even though it was disabled in the exported configuration. Don't rely on the contents of the .unf alone.

For a safe restore, the UDM-SE doesn't need to be connected to the production LAN. You can connect a PC directly to one of its LAN ports, give the PC a static address in the management subnet (e.g. 192.168.132.200/24), and access the UDM-SE at https://192.168.132.29. The .unf file is uploaded from that PC through the browser. This way, the production uplink can remain disconnected while you restore the configuration and check the result.

After the restore, use the same direct connection to verify the management IP, disable the DHCP server on the Default network again, and check that IPv6 router advertisements are disabled. Only then reconnect the UDM-SE to the production LAN. If you perform the restore over the production network instead, be aware that the imported settings can take effect immediately and disrupt connectivity before you get a chance to correct them.

Once the configuration is correct, the existing UniFi devices can be moved to the new controller, with their Inform address adjusted where necessary.

A working WAN connection without another cable to OPNsense

The remaining annoyance was UniFi OS reporting that the console was offline despite perfectly functional IPv4 connectivity. Rather than trying to manipulate its internal connectivity detection, I decided to provide a real WAN connection, but without running another cable to OPNsense.

I created an additional VLAN-only network called DREAM_WAN, using VLAN ID 99. OPNsense provides DHCP (192.168.99.0/24) and SLAAC with prefix 0x99 and thus provides Internet access on this VLAN, which is carried over the existing switch infrastructure. The UDM-SE supports WAN port remapping, so I configured port 7 as an access port for VLAN 99 and port 8 as a WAN port using DHCP. A short RJ45 cable now connects port 7 directly to port 8.

OPNsense
   |
   | Existing LAN/VLAN trunk
   |
Pro Max 16 PoE
   |
   | 10 Gbps SFP+ DAC, trunk configuration
   |
UDM-SE
   |
   +-- Port 1-6: cameras
   |
   +-- Port 7: LAN, Access VLAN 99 --+
   |                                 |
   +-- Port 8: WAN, DHCP ------------+
   |
   +-- Port 9: 2.5 Gbps LAN
   |
   +-- SFP+ Ports: configured as LAN, trunk configuration

VLAN 99 arrives over the existing LAN uplink, is presented untagged on port 7 and enters the WAN interface on port 8. This isn't an Ethernet loop because port 8 is configured as WAN and isn't part of the LAN bridge. Needless to say, the WAN port assignment and VLAN isolation must be configured before connecting the cable, and PoE should be disabled on port 7.

With this arrangement, the Dream Machine has a normal WAN connection and recognises its upstream router behind NAT. No additional cable to OPNsense is required. It costs two of the eight Gigabit ports, but leaves the 2.5 Gbps RJ45 port available for LAN use. That's quite useful considering the Pro Max 16 only has four 2.5 Gbps ports, which also happen to be its only PoE++ ports. Besides, the UDM-SE's integrated eight-port switch only has a 1 Gbps uplink to the CPU, whereas the 2.5 Gbps port is connected separately. I use ports 1-6 for the Protect cameras, because they only need Fast Ethernet (100 Mbps) anyway.

"Trunk" on OPNsense

Another neat trick is to set up the uplink port for OPNsense not as a "trunk" in the usual Unifi way, which is that the main LAN is untagged, while other VLANs are tagged, but as no default VLAN with VLAN 1 as being tagged. That way, you do not have to mix tagged and untagged VLANs on the OPNsense LAN interface. I have a separate "OPNsense Trunk" port profile for that on the Network controller. The alternative way of setting this up is to use two separate interfaces, one untagged, with another tagged only, but that takes up one more physical connection.

Final routing configuration

Although WAN is now operational, I deliberately kept the original two /1 IPv4 routes through the LAN interface. The WAN DHCP configuration supplies a conventional default route, but the more specific /1 routes still take precedence. Consequently, ordinary IPv4 traffic from the Dream Machine continues to use OPNsense through the LAN, while its directly connected WAN subnet remains reachable through WAN.

IPv6 is configured differently: it is enabled only on the WAN interface, using SLAAC from OPNsense. The IPv6 default route therefore goes through WAN, while IPv6 router advertisements on the Dream Machine's Default LAN remain disabled.

So the final arrangement is a Dream Machine with a working WAN connection, but with IPv4 Internet traffic routed through the existing LAN. Network and Protect run on the UDM-SE, its LAN ports provide additional Layer-2 connectivity, and OPNsense remains responsible for all production routing, firewalling and DHCP.

Apart from the initial CLI updates and the one-time MongoDB changes required for migration, everything is configured through the normal UniFi interface. There are no persistent SSH scripts or modifications to the running UniFi OS.

It's certainly not what Ubiquiti had in mind for the Dream Machine, but it works, and I get Protect without having to replace OPNsense. The loss of Multi-Site Management is the main compromise.

P.S.: If you want to separate your Protect cameras on a separate VLAN, you will have to open some ports to the UDM:

ProtocolPortPurpose
TCP6666AI detection metadata (reported by users; not officially documented)
TCP7441RTSPS (secure real-time streaming)
TCP7442Device communication (WebSocket)
TCP7443REST API
TCP7444Camera communication (WebSocket)
TCP7445Protect streaming
TCP7447RTSP (real-time streaming)
TCP7550Camera streams
TCP7552Encrypted camera connections
TCP7888TCP bridge
UDP10001Device discovery / adoption

Not all of these ports need to be allowed between the cameras and the Protect console. Some are used for client access or streaming. TCP port 6666 is particularly interesting because users have reported that blocking it prevents AI detection events from appearing in Protect's search filters, even though live video and on-screen object detection continue to work.
#2
You need an adressable IPv6. Since you have dynamic prefixes, you will need a "Dynamic IPv6 Host" type alias. Use the lower 64 bits of any of your local interfaces, e.g. "::aabb:ccff:fedd:eeff" and select its interface in the alias. That way, the alias will always be constructed from the dynamic prefix (say 56 Bits), plus the interface prefix (8 bits) plus your 64-bit interface suffix.
#3
Quote from: sam1970 on November 16, 2026, 11:09:48 PM- Port 2: Switch 1 (homelab)
- Port 3: Switch 2 (WiFi/IoT)

Usually, you wouldn't do that. You'd have to use OpnSense as a bridge to connect Port 2 and Port 3. Even non-routed layer 2 packets would pass through the machine, which puts more load on it. In your case, when all VLANs are strictly confined to a specific switch, you can get away with it, though, since in that case, all traffic between the homelab and WiFi/IoT is layer 3, anyway.

How about this one: https://www.amazon.de/dp/B0F7QYBKTV, it uses DDR-5, though. You will be hard pressed to find current models with DDR-4.
#4
Yes, there are two advantages:

1. When you use cross-VLAN-traffic, you do not share the bandwidth of one port. That might come in handy when you use file transfers from a NAS to a PC when both are connected via 2.5 Gbps. Incidentally, 300 MByte/s seems to be the speed where RAID-volumes with HDDs max out and also, Nxxx CPUs can also do that.

2. FreeBSD (and hence OpnSense) does not like mixing tagged VLANs and untagged traffic on the same interface. While you can fix that by using all tagged VLANs, some vendors prefer their management VLAN untagged (e.g. Unifi). Thus, you need two LAN interfaces: one untagged and the other for all tagged VLAN traffic.

That is obviously impossible with only two ports, unless you use another VLAN for WAN traffic. In that case, you can also use a router-on-a-stick.

Another warning: Cheap china boxes are often worse in cooling performance than, say, brand variants like Protectli (they also offer firmware updates). N305 uses more power than N150, despite having the same max TDP. (almost no vendor actually limits those units at their base TDP) While it is true that the performance is slightly better, it all originates from more threads. Last time I looked, Zenarmor supported only single threading in the CE version.

Supply of these boxes has diminished severely since prices are so high. You could get yourself an N1x0 four port box without RAM and SSD for < 200€ in 2025. The same box now costs >300€ and the RAM and NVME come in at another 200 instead of 100€.
#5
AFAIK, the HUNSN RJ35 was available as DDR-5 model only. The link you gave lead me to a different brand machine with DDR-4, but beware: that one has only 2 Realtek Gbit ports, so no 2.5 Gbit and non-Intel. That, I would avoid.

You will get no "decent" firmware support with any of these chinese machines, if any at all. That mostly does not matter much, because all that matters will be CPU microcode updates, which are included in OpnSense anyway. The only thing that matters id stability and potentially, power draw.

I would go for a 4 port I226V specimen and upgrade both RAM and SSD myself, so you can go for good brand units.
#6
Did you reboot? As mentioned, the order of interface initialisation matters and the results upon initial configuration may be different.

I am with the exact same ISP and do not see your results with http://pmtud.enslaves.us/. My setup is shown above, and I get the same effective MTUs as you with the pings but then:

QuotePath MTU Discovery Test
Results
Direction   Tested Maximum Size Segment   Client Sent MSS   Notes
Server to Client IPv4   1460 (MTU 1500)   1460 (MTU 1500)   OK
Client to Server IPv4   unlimited   (n/a)   OK
Server to Client IPv6   1440 (MTU 1500)   1440 (MTU 1500)   OK
Client to Server IPv6   unlimited   (n/a)   OK
got server to client probe for mss 536 (max seg 1460)
got server to client probe for mss 1460 (max seg 1460)
got server to client probe for mss 1460 (max seg 1460)
finished s2c4 probing, maximum mss 1460 peer mss 1460 initial peer mss 1460
got client to server probe for mss 520
got client to server probe for mss 1461
got client to server probe for mss 9000
finished c2s4 probing, maximum mss 9000
got server to client probe for mss 536 (max seg 1440)
got server to client probe for mss 1440 (max seg 1440)
got server to client probe for mss 1440 (max seg 1440)
finished s2c6 probing, maximum mss 1440 peer mss 1440 initial peer mss 1440
got client to server probe for mss 520
got client to server probe for mss 1441
got client to server probe for mss 9000
finished c2s6 probing, maximum mss 9000


You could also look into "grep -n 'max-mss' /tmp/rules.debug" and see if there is any rule that limits your TCP MSS to 1452.

Contrary to the instructions one difference might be that I set MSS 1500 on pppoe0 explicitely - although it should not be the culprit, you may want to try it.


#8
I see the problem as well, Franco:

root@OPNsense:~ #  cat /usr/local/opnsense/changelog/index.json | jq -e > /dev/null && echo good
jq: parse error: Invalid numeric literal at line 120, column 4

The part that is buggy is this:

Quote{"series":"26.7","version":"26.7.9","date":"November 11, 2026"}
,
{"series":"26.7","version":"26.7.7","date":"October 13, 2026"}
,
{"series":"26.7","version":"26.7.1","date":"July 21, 2026"}
,
{"series":"26.7","version":"26.7.6","date":"October 08, 2026"}
,
{"series":"26.7","version":"26.7.8","date":"October 30, 2026"}
,
Use of uninitialized value $date in concatenation (.) or string at /Users/franco/Documents/opnsense/changelog/Scripts/webify.pl line 128.
{"series":"26.7","version":"26.7.","date":""}
,
{"series":"26.7","version":"26.7.r1","date":"July 07, 2026"}
,
{"series":"26.7","version":"26.7.3","date":"August 27, 2026"}
,
{"series":"26.7","version":"26.7.4","date":"September 15, 2026"}
,
{"series":"26.7","version":"26.7.5","date":"September 30, 2026"}
,
{"series":"26.7","version":"26.7.2","date":"August 12, 2026"}
,
#9
Ich verstehe unter "Klonen" die entsprechende Funktion der Virtualisierungs-Software, beispielsweise PVE.

Die klont typischerweise die gesamte Maschine, inklusive der virtuellen Platten, bei Beibehaltung der Plattengrößen. Und dabei spielt das Dateisystem darauf keine Rolle. Was allerdings aus Sicherheitsgründen meist gemacht wird - damit die neue VM keine Konflikte hervorruft - ist, die MACs der NICs zu randomisieren.
#10
Quote from: abulafia on November 02, 2026, 10:27:55 AMAlternatively (better?) use a reverse proxy on OPnsense. That definitely terminates the TCP connection at OPnsense, which as a BSD system is not affected by this Linux bug.

...creating new security threats in the process.
#11
German - Deutsch / Re: OPNSense Experiment
October 30, 2026, 11:47:16 PM
1. Es gibt bereits eine Community Edition und eine Business Edition.

2. Ungeachtet dessen haben wir 2026. Es gibt inzwischen KI-gestützte Werkzeuge zum Auffinden von Sicherheitslücken, und die Bedrohungslage entwickelt sich ständig weiter.

Ausgerechnet das von Dir kritisierte Update 26.7.8 vom heutigen Tag enthält zahlreiche Sicherheitskorrekturen. Siehe:
https://docs.opnsense.org/releases/CE_26.7.html

Die Verfügbarkeit von Updates ist kein Mangel, sondern ein Feature. Ob Du diese Updates einspielst oder mit den bekannten Schwachstellen und der entsprechenden Angriffsfläche lebst, ist Deine Entscheidung.

Die Business Edition verfolgt bewusst einen konservativeren Aktualisierungspfad mit weniger häufigen funktionalen Änderungen, um den Anforderungen produktiver Unternehmensumgebungen Rechnung zu tragen. Wenn Dir das wichtig ist, gibt es genau dafür ein kostenpflichtiges Angebot.

3. Genauso wenig ist die Verfügbarkeit unterschiedlicher Werkzeuge für DHCP und DNS ein Mangel. Sie erfüllen teilweise unterschiedliche Anforderungen. Dnsmasq eignet sich für kleinere Installationen, Kea bietet unter anderem Vorteile bei Skalierbarkeit und Hochverfügbarkeit. Unbound wiederum ist in erster Linie ein DNS-Resolver.

Entscheide Dich für die Werkzeuge, die zu Deinen Anforderungen passen.

Und es war übrigens nicht Decisos Entscheidung, ISC DHCP einzustellen. ISC hat die Entwicklung und Wartung bereits 2022 beendet.

Things change. Deal with it.

4. Auch die IPsec-Terminologie ist nicht einfach eine Laune der OPNsense-Entwickler. IKE SAs und CHILD SAs sind etablierte technische Begriffe. Die neue Oberfläche orientiert sich stärker an strongSwan und dessen tatsächlichem Konfigurationsmodell. Und die von Dir kritisierten Pools dienen beispielsweise der IP-Adressvergabe an mobile VPN-Clients.

Natürlich kann man darüber diskutieren, ob die Oberfläche intuitiver gestaltet oder besser dokumentiert werden könnte. Aber aus der Tatsache, dass Dir eine Terminologie nicht vertraut ist, folgt nicht, dass sie unlogisch wäre.

5. OPNsense ist ein professionelles Netzwerkwerkzeug. Vielleicht liegt hier ein grundsätzliches Missverständnis vor. Lies einmal:
https://forum.opnsense.org/index.php?topic=42985.0

Insbesondere den Satz gleich am Anfang:

Be warned: OPNsense provides a GUI for professional networking features; it does not turn them into consumer-grade settings that can safely be changed by trial and error. Or it can — but then there is plenty to try, and plenty to break.

Netzwerke sind komplex. Eine grafische Oberfläche kann diese Komplexität zugänglicher machen, aber sie kann sie nicht beseitigen.

O.K., MikroTik treibt das mit seinen nahezu unbegrenzten Konfigurationsmöglichkeiten vielleicht etwas weit. Aber OPNsense? Echt jetzt?
#12
Höchstens die MACs der NICs - je nachdem, ob die VMs gleichzeitig im selben Netz sind. Umgekehrt können bei neuen MACs IPv6- oder MAC-basierte Regeln versagen.
#13
The microcode update was not the root cause of the problems many people had. The old bootloader was.

There are threads which show how to update it.
#14
I fully understand what you are trying to achieve. The problem is that your questions are still based on assumptions that don't quite reflect how DNS and network security work today - 8 years after the initial post has been made.

First, the choice of DHCP server (ISC, Dnsmasq, Kea) is largely independent of the question of enforcing "old-style" DNS resolution through OPNsense. So, in this sense, the guide is still applicable.

But there is a much more fundamental issue:

Redirecting traditional DNS queries on TCP/UDP port 53 is relatively straightforward. Preventing DNS leaks in general is an entirely different matter.

Clients may use DNS over TLS, DNS over HTTPS, DNS over QUIC, application-specific resolvers, VPN tunnels, or other mechanisms to bypass your local DNS infrastructure. Some of these can be blocked relatively easily; others cannot be reliably distinguished from legitimate traffic by ordinary firewall rules. Some of the limitations have been discussed in the course of this thread.

Restricting your network to IPv4 doesn't eliminate these problems, either.

So before trying to apply a supposedly working set of specific firewall rules, you need to define what you actually want to enforce:

- Prevent accidental DNS leaks from normally configured clients?
- Prevent applications from using alternative DNS resolvers?
- Prevent deliberately non-compliant clients from bypassing your DNS policy?

These are very different objectives, requiring different approaches, with different limitations.

There is no universal set of firewall rules that guarantees all DNS resolution will pass through your local resolver while otherwise allowing unrestricted Internet access.

Until those limitations are understood and the actual objective is clearly defined, a step-by-step configuration guide would only create a false sense of security on your part.
#15
Which do you mean? The first post, which now is ~8 years old? Probably not.

There are several posts in here that discussed additions on DoT, DoH and gave directions on what can and what cannot be done. This is largely independend of the DNS service in charge. The guide is essentially about how to use firewall rules to redirect queries to that service, be it Unbound, DNSmasq or any other of your choice. Even to that extent, additions have been made, e.g. the initial post does not cover IPv6.