Resolve host IPs by domain names (Cloudflare)

Started by seki, November 22, 2021, 06:40:29 PM

Previous topic - Next topic
November 22, 2021, 06:40:29 PM Last Edit: November 22, 2021, 06:46:01 PM by seki
Hi!

This might be a topic not really for OPNsense but I'm pretty sure that quite a few people has faced the same issue.

So here's my setup:
ISP -> OPNsense -> Cisco Switch

       
  • ISP router has a DMZ IP that points to WAN interface in OPNsense (192.168.5.200)
  • OPNsense LAN1 interface goes to Cisco switch and creates network 10.0.0.1
  • OPNsense LAN2 interface is unused for the time being but has another network configured (10.0.1.1) ready to use
  • OPNsense VLAN 99 is my management VLAN trunked in LAN1 -> Cisco switch (10.0.99.1)
  • OPNsense VLAN 100 is my servers VLAN trunked in LAN1 -> Cisco switch (10.0.100.1)
  • OPNsense VLAN 1000 is my WiFi VLAN not configured yet but it is trunked as well from LAN1 to Cisco switch (10.100.0.1)
I plugged in Raspberry Pi to Cisco switch access port that resides in VLAN 100 (Servers). My laptop is connected to another Cisco switch access port which is in VLAN 99 (Mgmt). The rules are configured on OPNsense so I can access VLAN 100 by SSH/ICMP. Raspberry Pi works like a charm and has rules set up properly so it can access DNS.


My OPNsense has Dynamic DNS set up using Cloudflare and it is working like a charm. When I do some domain/host resolving commands I get following output:



$ host fw.domain.it
fw.domain.it has address 10.0.99.1
fw.domain.it has address 10.0.1.1
fw.domain.it has address 10.0.0.1
fw.domain.it has address 10.100.0.1
fw.domain.it has address 192.168.5.200
fw.domain.it has address 10.0.100.1
fw.domain.it has IPv6 address fe80::abc:efg:xxx:xxx
fw.domain.it has IPv6 address fe80::abc:efg:xxx:xxx
fw.domain.it has IPv6 address fe80::abc:efg:xxx:xxx




$ nslookup fw.domain.it
Server:      127.0.0.53
Address:   127.0.0.53#53


Non-authoritative answer:
Name:   fw.domain.it
Address: 10.0.99.1
Name:   fw.domain.it
Address: 10.0.1.1
Name:   fw.domain.it
Address: 10.0.0.1
Name:   fw.domain.it
Address: 10.100.0.1
Name:   fw.domain.it
Address: 192.168.5.200
Name:   fw.domain.it
Address: 10.0.100.1
Name:   fw.domain.it
Address: fe80::abc:efg:xxx:xxx
Name:   fw.domain.it
Address: fe80::abc:efg:xxx:xxx
Name:   fw.domain.it
Address: fe80::abc:efg:xxx:xxx


Which is awesome cause it shows the interfaces IPs which are resolving to this domain. And at the same time this domain has Cloudflare's proxied IP so I can access remotely when doing nslookup/host from public.

But when I do the same trying to resolve my Raspberry Pi connected to VLAN 100 I get this:

$ nslookup ctl.domain.it
Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: ctl.domain.it
Address: 8x.xx.xxx.71


$ host ctl.domain.it
ctl.bryzek.it has address 8x.xx.xxx.71


Which points at the public IP resolved by Cloudflare.

Can someone please tell me what to do to achieve similar output when I "nslookup/host'" another host as I get from OPNsense