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

Topics - BusinessTux

#1
Hallo zusammen,

ich richte gerade ein Site2Site SSL VPN mit OpenVPN ein.

nur leider kann über die OPNsense 1, wo der OpenVPN-Client läuft, nicht auf den Tunnel oder das dahinterliegende Netzwerk zugreifen. Weder traceroute noch ping.

Von der OPNsense 1 aus kann sowohl die OPNsense 2, als auch die dahinter liegenden Computer anpingen. Vom Linux PC 10.1.1.10 im Netzwerk der OPNsense 2 kann ich nur bis zum VPN-Endpunkt des OpenVPN-Clients der OPNsense 1 (100.64.21.2) pingen. Nicht aber in das angeschlossene Netzwerk.

Seltsamerweise zeigt mir das latest.log für OpenVPN Fehler beim Routen setzen an:

<29>1 2023-07-21T10:57:49+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="12"] TUN/TAP device ovpnc2 exists previously, keep at program end
<29>1 2023-07-21T10:57:49+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="13"] TUN/TAP device /dev/tun2 opened
<29>1 2023-07-21T10:57:49+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="14"] /sbin/ifconfig ovpnc2 100.64.21.2/24 mtu 1500 up
<29>1 2023-07-21T10:57:49+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="15"] /sbin/ifconfig ovpnc2 inet6 fd00:1:21::1000/64 mtu 1500 up
<29>1 2023-07-21T10:57:49+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="16"] /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkup ovpnc2 1500 0 100.64.21.2 255.255.255.0 init
<28>1 2023-07-21T10:57:50+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="17"] ERROR: FreeBSD route add command failed: external program exited with error status: 1
<28>1 2023-07-21T10:57:50+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="18"] ERROR: FreeBSD route add command failed: external program exited with error status: 1
<28>1 2023-07-21T10:57:50+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="19"] ERROR: FreeBSD route add command failed: external program exited with error status: 1
<29>1 2023-07-21T10:57:50+02:00 OPNsense.opn.mydomain.com openvpn_client2 208 - [meta sequenceId="20"] Initialization Sequence Completed


Die Routen auf der OPNsense 1 sind aber gesetzt:
root@OPNsense:~ # netstat -4 -rn
Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            62.155.241.226     UGS      pppoe0
8.8.8.8            62.155.241.226     UGHS     pppoe0
9.9.9.9            192.168.8.1        UGHS       igb3
10.0.0.0/24        link#21            U       vlan010
10.0.0.1           link#21            UHS         lo0
10.0.1.0/24        link#5             U          igb4
10.0.1.1           link#5             UHS         lo0
10.0.2.0/24        link#20            U        vlan01
10.0.2.1           link#20            UHS         lo0
10.0.3.0/24        link#22            U        vlan02
10.0.3.1           link#22            UHS         lo0
10.0.4.0/24        link#23            U        vlan03
10.0.4.1           link#23            UHS         lo0
10.0.5.0/24        link#24            U        vlan04
10.0.5.1           link#24            UHS         lo0
10.0.5.253         link#24            UHS         lo0
10.0.6.0/24        link#28            U        vlan08
10.0.6.1           link#28            UHS         lo0
10.0.7.0/24        link#26            U        vlan06
10.0.7.1           link#26            UHS         lo0
10.1.1.0/24        100.64.21.1        UGS      ovpnc2
10.1.2.0/24        100.64.21.1        UGS      ovpnc2
10.1.4.0/24        100.64.21.1        UGS      ovpnc2
10.1.21.0/24       link#27            U        vlan07
10.1.21.1          link#27            UHS         lo0
10.1.21.253        link#27            UHS         lo0
62.155.241.226     link#30            UHS      pppoe0
79.211.9.54        link#30            UHS         lo0
100.64.0.0/24      link#33            U           wg0
100.64.0.1         link#33            UHS         lo0
100.64.0.11        link#33            UHS         wg0
100.64.0.12        link#33            UHS         wg0
100.64.0.13        link#33            UHS         wg0
100.64.2.0/24      100.64.2.2         UGS      ovpns1
100.64.2.1         link#31            UHS         lo0
100.64.2.2         link#31            UH       ovpns1
100.64.21.0/24     link#32            U        ovpnc2
100.64.21.2        link#32            UHS         lo0
127.0.0.1          link#15            UH          lo0
192.168.3.0/24     link#25            U        vlan05
192.168.3.1        link#25            UHS         lo0
192.168.3.253      link#25            UHS         lo0
192.168.8.0/24     link#4             U          igb3
192.168.8.113      link#4             UHS         lo0
217.237.150.115    62.155.241.226     UGHS     pppoe0
217.237.151.205    62.155.241.226     UGHS     pppoe0


Im Firewall Live log sind keine Blockierungen zu erkennen.

Was habe ich bei der Einrichtung übersehen, dass das Routing nicht funktioniert?

DAnke
Ulf
#2
Hi there,

I have Scope-7 appliance with two ssd's. One of them is faulty, because my system didn't start after reboot this morning. After I removed the faulty one, OPNsense come online again.

So I swapped the ada1 device with a new one. This new ssd was not empty, but I backuped/restored the layout from ada0, like describe here.

root@OPNsense:~ # zpool attach zroot ada0p4 ada1p4
root@OPNsense:~ # zpool status
  pool: zroot
state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Sat Feb 18 10:37:03 2023
        6.74G scanned at 363M/s, 1.13G issued at 60.9M/s, 6.74G total
        1.20G resilvered, 16.77% done, 00:01:34 to go
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada0p4  ONLINE       0     0     0
            ada1p4  ONLINE       0     0     0  (resilvering)

errors: No known data errors
root@OPNsense:~ # zpool status
  pool: zroot
state: ONLINE
  scan: resilvered 6.98G in 00:01:52 with 0 errors on Sat Feb 18 10:38:55 2023
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada0p4  ONLINE       0     0     0
            ada1p4  ONLINE       0     0     0

errors: No known data errors
root@OPNsense:~ # dd if=/dev/ada0p1 of=/dev/ada1p1
532480+0 records in
532480+0 records out
272629760 bytes transferred in 97.602079 secs (2793278 bytes/sec)
root@OPNsense:~ # dd if=/dev/ada0p2 of=/dev/ada1p2
1024+0 records in
1024+0 records out
524288 bytes transferred in 0.065542 secs (7999318 bytes/sec)
root@OPNsense:~ # zpool status
  pool: zroot
state: ONLINE
  scan: resilvered 6.98G in 00:01:52 with 0 errors on Sat Feb 18 10:38:55 2023
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada0p4  ONLINE       0     0     0
            ada1p4  ONLINE       0     0     0

errors: No known data errors
root@OPNsense:~ # gpart show
=>       40  468862048  ada0  GPT  (224G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528   16777216     3  freebsd-swap  (8.0G)
   17311744  451549184     4  freebsd-zfs  (215G)
  468860928       1160        - free -  (580K)

=>       40  488397088  ada1  GPT  (233G)
         40     532480     1  efi  (260M)
     532520       1024     2  freebsd-boot  (512K)
     533544        984        - free -  (492K)
     534528   16777216     3  freebsd-swap  (8.0G)
   17311744  451549184     4  freebsd-zfs  (215G)
  468860928   19536200        - free -  (9.3G)


I've copied ada0p1 for efi und ada0p2 for freebsd-boot via dd. But if I start the the applicance with only ada1 there is no bootable device.

How can I make ada1 bootable?

Thanks
Ulf



#3
Hallo zusammen,

ich suche momentan nach der Ursache, warum sich der OPNsense Bootloader beim Neustart aufhängt. Zuletzt hatte ich immer wieder diese zwei Ansichten, bei denen die Einsen immer weiter gezählt haben, aber nichts passiert ist (siehe Bilder im Anhang). Nach mehrmaligem Reset ist die Maschine dann hochgefahren (Landitec     scope7-303-Fiber R).

Der Spiegel aus zwei 240 GB SSDs sieht für mich aber in Ordnung aus.
root@OPNsense:~ # zpool status
  pool: zroot
state: ONLINE
config:

        NAME        STATE     READ WRITE CKSUM
        zroot       ONLINE       0     0     0
          mirror-0  ONLINE       0     0     0
            ada0p4  ONLINE       0     0     0
            ada1p4  ONLINE       0     0     0

errors: No known data errors


In welche Richtung kann ich suchen, um den nächsten Neustart etwas entspannter zu erleben?

Danke
Ulf
#4
Hi at all,

I have a problem with a setup on three locations with with two ipsec S2S tunnels to the main office.

I've configured two routed IPSec Tunnels, like described here: https://docs.opnsense.org/manual/how-tos/ipsec-s2s-route.html.

Homeoffice 1          Main Office                Homeoffice 2
100.64.21.2/30      100.64.21.1/30
                              100.64.22.1/30        100.64.22.2/30
                   
                   
The tunnel to Homeoffice 1 works like a charm. The tunnel to Homeoffice2 is active, but routing isn't functionally.

In short:
- WAN-Rules in Firewall (IPSec, ISAKMP, ESP) are active on all three locations
- Gateways for both home office are created and configured as "far gateway"
- Routes for the remote networks of both home offices are created in the main office
- Routes for the networks of the main office are created in both home offices
- Firewall-Rules on ipsec interface in the main office are created
- Firewall-Rules on ipsec interface in the home offices are created


Traceroute main office to Homeoffice 1: works
Traceroute main office to Homeoffice 2: hangs on main office gateway

The route to home office 2 is in the active routing table of then main office gateway.

But the mainofficerouter says network is down:
root@mainofficerouter:~ # ping -t 3 100.64.22.2
PING 100.64.22.2 (100.64.22.2): 56 data bytes
ping: sendto: Network is down


I doublechecked all configurations twice, but I can't figure it out.

The box versions are

mainofficerouter: OPNsense 21.10.2 (amd64/OpenSSL)
homeoffice 1:       OPNsense 21.7.7 (amd64/OpenSSL)
homeoffice 2:       OPNsense 21.10.2 (amd64/OpenSSL)

My ipsec.conf (completely generated)
root@mainofficerouter:~ # cat /usr/local/etc/ipsec.conf
# This file is automatically generated. Do not edit
config setup
  uniqueids = yes

conn con1
  aggressive = no
  fragmentation = yes
  keyexchange = ikev2
  mobike = yes
  reauth = yes
  rekey = yes
  forceencaps = no
  installpolicy = no
  type = tunnel





  left = 80.153.119.52
  right = custwar02.edvnet.biz
  rightallowany = yes
  leftid = userfqdn:site2siteHQBN@cust-bonn.de
  ikelifetime = 28800s
  lifetime = 3600s
  ike = aes256-sha512-modp2048!
  leftauth = pubkey
  rightauth = pubkey
  leftcert = /usr/local/etc/ipsec.d/certs/cert-1.crt
  leftsendcert = always
  rightca = "/C=DE/ST=NRW/L=Bonn/O=cust XXXXXX GmbH/OU=cust XCA/CN=custVpnCA/emailAddress=edv@cust-bonn.de/"
  rightid = userfqdn:site2sitehowa@cust-bonn.de
  reqid = 1
  rightsubnet = 0.0.0.0/0
  leftsubnet = 0.0.0.0/0
  esp = aes256-sha512-modp2048!
  auto = add

conn con2
  aggressive = no
  fragmentation = yes
  keyexchange = ikev2
  mobike = yes
  reauth = yes
  rekey = yes
  forceencaps = no
  installpolicy = no
  type = tunnel





  left = 80.153.119.52
  right = custror02.edvnet.biz
  rightallowany = yes
  leftid = userfqdn:site2siteHQBN@cust-bonn.de
  ikelifetime = 28800s
  lifetime = 3600s
  ike = aes256-sha512-modp2048!
  leftauth = pubkey
  rightauth = pubkey
  leftcert = /usr/local/etc/ipsec.d/certs/cert-2.crt
  leftsendcert = always
  rightca = "/C=DE/ST=NRW/L=Bonn/O=cust XXXXXX GmbH/OU=cust XCA/CN=custVpnCA/emailAddress=edv@cust-bonn.de/"
  rightid = userfqdn:site2sitehoro@cust-bonn.de
  reqid = 2
  rightsubnet = 0.0.0.0/0
  leftsubnet = 0.0.0.0/0
  esp = aes256-sha512-modp2048!
  auto = add

include ipsec.opnsense.d/*.conf


Where is my error?
#5
Hallo zusammen,

ich stehe gerade vor dem Rätsel, warum interne Webseiten über einen SSL VPN auf Android-Geräten nicht erreichbar sind. Mit der gleichen SSL-VPN-Verbindung auf einem Windows-Rechner kann ich die Webseiten aufrufen.

Ziel ist, dass ich die Apps von Synology oder Unifi direkt auf dem Handy/Tablet nutzen kann, wenn ich mich per VPN nach Hause verbunden habe.

Aktuell kann ich die OpenVPN-Verbindung sowohl von Android, als auch von Windows-Geräten erfolgreich verbinden. Aber nur auf Windows kann ich danach im Browser die jeweiligen Webseiten im interenen LAN aufrufen (Unifi, Synology, Netbox).

Auf dem Android-Geräte (hier Tablet) sieht netzwerktechnisch alles ok aus.
* VPN ist verbunden
* In der Routing-Tabelle zeigen die konfigurierten Einträge auf das tun-Device
* Ein Portscan zeigt die offenen Ports

Und trotzdem kommt es zu einem Timeout, wenn ich die interne Webseite im Browser aufrufe. Gleiches gilt dann natürlich für die Android-Apps.


Netzwerk-Aufbau:
#
# Stand: 18.07.2021
#

   WAN / Internet                       WAN / Internet
         :                                    :
         : Mobilfunk (Telekom)                : Telekom/VDSL 100
         :                                    :
    .----+----------.                   .-----+----------.
    |  LTE-Gateway  |                   |  VDSL-Gateway  |  (Zyxel VMG3006-D70A)
    '----+----------'                   '-----+----------'
         | 192.168.8.1/24                     |
         |                                    |
         |   Gatewaygruppe WANGWGroup         |
         \----------  ------------------------/
                    \/
   192.168.8.104/24 || PPPoE
             Tier 2 || Tier 1
  WANLTE (opt2,re3) || WAN (wan,re0)
                    ||
    .---------------::----------------------.
    |  OPNsense.opn.mydomain.com            |
    |  21.1.7_1-amd64                       |- IPsec 100.64.1.0/24
    |  CPU: i3-4130T 4x2,9 GHz              |- ovpn1 100.64.2.0/24
    |  RAM/HDD: 8GB / 2x128 GB SSD Mirror   |
    '--------------:---------:--:-----------'
                   |      re1|  | re2
                   |          \/   
                   |          ++--lagg0
                   |          ||  |
                   |          ||  |    VLAN            IP            Subnet           DHCPv4  OPT
       10.0.1.253  |          ||  +--- 20 Intra        10.0.2.253    10.0.2.0/24        off   opt4
  MGMT (lan,alc0)  |          ||  +--- 30 Gäste        10.0.3.253    10.0.3.0/24        off   
      10.0.1.0/24  |          ||  +--- 40 Test         10.0.4.253    10.0.4.0/24        off   opt3
                   |          ||  +--- 41 WLAN intern  192.168.1.253 192.168.1.0/24     off 
                   |          ||  +--- 70 IoT          10.0.7.253    10.0.7.0/24        on    opt1
                   |          ||
                   |          ||
                   |          ||
                   |          ||
      .------------+------.   ||
      | LAN-Switch        +---'|
      | Unifi USW-48      +----'
      '-----+-+-+-+-+-----'
            | | | | |
            | | | | '----... (Netzwerkdevices/Servers)  VLAN 10  mgmt.mydomain.com
            | | | |
            | | | '------... (Clients/Servers)          VLAN 20 intra.mydomain.com
            | | |
            | | '--------... (Clients)                  VLAN 30
            | |
            | '----------... (Clients/Servers)          VLAN 40  test.mydomain.com
            |
            '------------... (IoT Devices)              VLAN 70   han.mydomain.com
           

Aktivierte Dienste
- C-ICAP
- ClamAV
- DHCPv4
- Dynamisches DNS
- Unbound DNS
- Web-Proxy
  + http
  + https
  + transparent proxy
  + ICAP
  + Remote Access Lists
- VPN-Server
  + IPsec
    * Site2Site
  + OpenVPN
    * SSL VPN   

DHCPv4 auf Schnittstelle VLAN 70
- Subnetz       10.0.7.0
- Subnetzmakse  255.255.255.0
- Bereich       10.0.7.100 - 10.0.7.199
- DNS-Server    10.0.7.253 (OPNsense)
- Gateway       10.0.7.253 (OPNsense)
- Domain Name   han.mydomain.com

DHCPv4 auf Schnittstelle MGMT
- Subnetz       10.0.1.0
- Subnetzmakse  255.255.255.0
- Bereich       10.0.1.100 - 10.0.1.199
- DNS-Server    10.0.1.253 (OPNsense)
- Gateway       10.0.1.253 (OPNsense)
- Domain Name   mgmt.mydomain.com


Hat jemand eine Idee für mich, warum es auf Window funktioniert und auf Android nicht?

Danke
#6
Hallo zusammen,

ich bin aktuell dabei meine Netzwerke zu Hause von einem Lancom-Router auf die OPNsense mit MultiWAN umzubauen. Bisher habe ich lediglich zwei Subnets umgebaut, Hausautomation und Test.

Nach dem letzten Update auf 20.7.4 ist mir aufgefallen, dass mein Hausautomations-Netzwerk nicht mehr richtig läuft. Ursache war, dass die DNS-Auflösung auf der OPNsense nicht mehr funktioniert hat. Da diese DNS- und DHCP-Server für das Hausautomationsnetzwerk ist, ist es nur dort aufgefallen.

Zusätzlich haben dann auch ein Großteil meiner Firewall-Regeln nicht mehr funktioniert, da die Firewall-Aliase nicht aufgelöst werden konnten und damit die entsprechenden pfTables leer waren :-(.

Bedingt durch MultiWAN und den Unbound-DNS-Server sieht meine resolv.conf auf der OPNsense standardmäßig so aus:
root@OPNsense:~ # cat /etc/resolv.conf
domain opn.mydomain.com
nameserver 127.0.0.1
nameserver 192.168.8.1
nameserver 192.168.165.1
nameserver 8.8.8.8
nameserver 9.9.9.9


Wird die OPNsense-Installation neugestartet, sieht sie nur noch so aus:
root@OPNsense:~ # cat /etc/resolv.conf
# Generated by resolvconf
nameserver 10.0.4.2


Beheben kann ich das nur, indem ich in "Dienste: Unbound DNS: Allgemein" einmal speichere und die Änderungen anwende. Danach sieht die resolv.conf wieder so aus, wie im ersten Block.

Für mich stellen sich die folgenden Fragen:

  • Warum wird die resolv.conf mit falschen Werten befüllt?
  • Warum wird gerade diese IP-Adresse eingetragen? Das ist der DC meines Test-Netzwerkes.
  • Gibt es eine Möglichkeit das Speichern/Anwenden von Unbound DNS zu automatisieren (als Workaround)
  • Ist das ein Fehler oder habe ich was falsch konfiguriert?

Hier zum bessern Verständnis noch mein Netzaufbau (ohne Lancom-Router)

   WAN / Internet                       WAN / Internet
         :                                    :
         : Mobilfunk (Telekom)                : /PPPoE/Telekom/VDSL 100
         :                                    :
    .----+----------.                   .-----+----------.
    |  LTE-Gateway  |                   |  VDSL-Gateway  |  (Vigor 165)
    '----+----------'                   '-----+----------'
         | 192.168.8.1/24                     | 192.168.165.1/24
         |                                    |
         |   Gatewaygruppe WANGWGroup         |
         \----------  ------------------------/
                    \/
   192.168.8.104/24 || 192.168.165.11
             Tier 2 || Tier 1
  WANLTE (opt2,re3) || WAN (wan,re0)
                    ||
    .---------------::----------------------.
    |  OPNsense.opn.mydomain.com            |
    |  20.7.4-amd64                         |
    |  CPU: i3-4130T 4x2,9 GHz              |
    |  RAM/HDD: 8GB / 2x128 GB SSD Mirror   |
    '--------------:---------:--:-----------'
                   |      re1|  | re2
                   |          \/   
                   |          ++--lagg0
                   |          ||  |
                   |          ||  |    VLAN            IP            Subnet           DHCPv4  OPT
       10.0.1.253  |          ||  +--- 20 Intra        10.0.2.253    10.0.2.0/24        off   opt4
  MGMT (lan,alc0)  |          ||  +--- 30 Gäste        10.0.3.253    10.0.3.0/24        off   
      10.0.1.0/24  |          ||  +--- 40 Test         10.0.4.253    10.0.4.0/24        off   opt3
                   |          ||  +--- 41 WLAN intern  192.168.1.253 192.168.1.0/24     off 
                   |          ||  +--- 70 IoT          10.0.7.253    10.0.7.0/24        on    opt1
                   |          ||
                   |          ||
                   |          ||
                   |          ||
      .------------+------.   ||
      | LAN-Switch        +---'|
      | Unifi USW-48      +----'
      '-----+-+-+-+-+-----'
            | | | | |
            | | | | '----... (Netzwerkdevices/Servers)  VLAN 10  mgmt.mydomain.com
            | | | |
            | | | '------... (Clients/Servers)          VLAN 20 intra.mydomain.com
            | | |
            | | '--------... (Clients)                  VLAN 30
            | |
            | '----------... (Clients/Servers)          VLAN 40  test.mydomain.com
            |
            '------------... (IoT Devices)              VLAN 70   han.mydomain.com
           

Aktivierte Dienste
- C-ICAP
- ClamAV
- DHCPv4
- Dynamisches DNS
- Unbound DNS
- Web-Proxy
  + http
  + https
  + transparent proxy
  + ICAP
  + Remote Access Lists

DHCPv4 auf Schnittstelle VLAN 70
- Subnetz       10.0.7.0
- Subnetzmakse  255.255.255.0
- Bereich       10.0.7.100 - 10.0.7.199
- DNS-Server    10.0.7.253 (OPNsense)
- Gateway       10.0.7.253 (OPNsense)
- Domain Name   han.mydomain.com


Bisher habe ich nur diesen Fehler gefunden: https://github.com/opnsense/core/issues/2828, der etwas ähnlich aussieht. Der Workaround einen Neustart des Unbound DNS in den Start einzubauen, hat leider nicht geholfen. Nur ein erneutes Anwenden der gespeicherten Konfiguration triggert bei mir ein erneutes Erzeugen der resolv.conf.

Hat jemand Tipps für mich, wie diesen Fehler beheben umgehen kann?

Danke
Ulf
#7
Hallo zusammen,

ich arbeite mich gerade in OPNsense ein, um etwas flexibler in der Konfiguration zu werden. Mein Aufbau sieht aktuell so aus:
        WAN / Internet
              :
              : DialUp-/PPPoE-/Cable-/whatever-Provider
              :
        .-----+-----.
        |  Gateway  |  (Vigor 165)
        '-----+-----'
              | 192.168.165.1/24
    WAN (em1) |
192.168.165.11|
      .-------:-----------------------------.
      |  OPN:sense    20.7.3-amd64          |
      |  (Br:dge)                           |
      '-------:--------------:-:-:-:--------'
    10.0.1.253|               \/         VLAN            IP            Subnet           DHCPv4
   MGMT (em0) |               || LAGG0 - 20 Intra        10.0.2.253    10.0.2.0/24        off
  10.0.1.0/24 |               ||       - 30 Gäste        10.0.3.253    10.0.3.0/24        off
              |               ||       - 40 Test         10.0.4.253    10.0.4.0/24        off
              |               ||       - 41 WLAN intern  192.168.1.253 192.168.1.0/24     off
              |               ||       - 70 IoT          10.0.7.253    10.0.7.0/24        on
              |               ||
              |               ||
              |               ||
      .-----+-------------.   ||
      | LAN-Switch        +---'|
      | Unifi USW-48      +----'
      '-----+-+-+-+-+-----'
            | | | | |
            | | | | '----... (Netzwerkdevices/Servers)  VLAN 10  mgmt.mydomain.com
            | | | |
            | | | '------... (Clients/Servers)          VLAN 20 intra.mydomain.com
            | | |
            | | '--------... (Clients)                  VLAN 30
            | |
            | '----------... (Clients/Servers)          VLAN 40  test.mydomain.com
            |
            '------------... (IoT Devices)              VLAN 70   han.mydomain.com


Ich möchte meine Subnets eins nach dem anderen von meinem bisherigen Router (Lancom) umstellen auf die OPNsense. Dazu soll funktionieren

  • Clients soll eine IPv4-Adresse per DHCP bekommen
  • pro VLAN soll eine eigene DNS-Subdomain verwendet werden
  • OPNsense soll die DNS-Namen der DHCP-Clients ausliefern
  • es sollen statische DHCP-Reservierungen möglich sein

Testweise habe ich schon mal den DHCP-Server auf dem Lancom deaktiviert, so dass die OPNsense die IP-Adressen verteilt. Den Unbound-Server habe ich eingestellt, dass der DHCP-Leases und statische DHCP Reservierungen registriert.

Der DHCP-Server ist wie folgt eingerichtet:
DHCPv4 auf Schnittstelle VLAN 70
- Subnetz       10.0.7.0
- Subnetzmakse  255.255.255.0
- Bereich       10.0.7.100 - 10.0.7.199
- DNS-Server    10.0.7.253 (OPNsense)
- Gateway       10.0.7.253 (OPNsense)
- Domain Name   han.mydomain.com


Beim Testen ist mir dann aufgefallen, dass die dynamische DHCP-Hostnamen mit der Domain der OPNsense verknüpft werden (testhanvm2.mgmt.mydomain.com) und nicht mit der Domain die im DHCP-Servers eingetragen ist (testhanvm.han.mydomain.com):
root@OPNsense:~ # unbound-control -c /var/unbound/unbound.conf list_local_data | grep -i han
10.0.7.101.     3600    IN      PTR     testhanvm2.opn.mydomain.com.
OPNsense.han.mydomain.com.     3600    IN      A       10.0.7.253
testhanvm.han.mydomain.com.    3600    IN      A       10.0.7.201
testhanvm2.mgmt.mydomain.com.   3600    IN      A       10.0.7.101
101.7.0.10.in-addr.arpa.        3600    IN      PTR     testhanvm2.mgmt.mydomain.com.
201.7.0.10.in-addr.arpa.        3600    IN      PTR     testhanvm.han.mydomain.com.
253.7.0.10.in-addr.arpa.        3600    IN      PTR     OPNsense.han.mydomain.com.


Die statischen DHCP-Reservierungen (testhanvm) werden korrekt im Unbound DNS eingetragen.

Mein Workaround war jetzt der OPNsense eine eigene Subdomain (opn.mydomain.com) zu geben und diese Subdomain per DHCP als searchlist zu verteilen. Das klappt auch.

Wie bekomme ich die Subnet-/VLAN-spezifische DNS-Domain in die Einträge der DHCP-Clients?

Danke
Ulf