OPNsense Forum

English Forums => General Discussion => Topic started by: seki on November 22, 2021, 06:40:29 PM

Title: Resolve host IPs by domain names (Cloudflare)
Post by: seki on November 22, 2021, 06:40:29 PM
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
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