Use hostname instead of IP address

Started by rama3124, July 12, 2023, 11:16:50 AM

Previous topic - Next topic
Hi
I run several services on my server through docker containers and currently access these services using the IP address of the server followed by the port number. Is there a way to arrange it so that I can access the services locally using container names? For example if I want to access my Plex container, typing plex.local instead of the IP address? Fairly new to opnsense so sorry if the question is silly or basic, TIA

Services --> Unbound DNS --> Overrides.
2x 23.7 VMs & CARP, 4x 2.1GHz, 8GB
Cisco L3 switch, ESXi, VDS, vmxnet3
DoT, Chrony, HAProxy + NAXSI, Suricata
VPN: IPSec, OpenVPN, Wireguard
MultiWAN: Fiber 500/500Mbit dual stack + 4G failover

--
Available for private support.
Did my answer help you? Feel free to click [applaud] to the left

Thanks for the reply
There's two options, host overrides or domain overrides. I'm assuming it is domain override that i need and i tried adding a domain (test.local) and then put in the IP address and port for an example service and then clicked save + apply however visiting test.local in my browser didn't bring up the service. Am i doing something wrong?

Quote from: rama3124 on July 12, 2023, 02:56:51 PM
Am i doing something wrong?

Yes.

You should use Host override.
2x 23.7 VMs & CARP, 4x 2.1GHz, 8GB
Cisco L3 switch, ESXi, VDS, vmxnet3
DoT, Chrony, HAProxy + NAXSI, Suricata
VPN: IPSec, OpenVPN, Wireguard
MultiWAN: Fiber 500/500Mbit dual stack + 4G failover

--
Available for private support.
Did my answer help you? Feel free to click [applaud] to the left

July 12, 2023, 05:01:01 PM #4 Last Edit: July 12, 2023, 05:10:21 PM by chemlud
A little more specific:

Services -> Unbound DNS -> Overrides

add the hostname of your Plex container as "Domain", Type normally "A" if using IPv4 and the IP address. Should work then (...after pressing APPLY)... :-)
kind regards
chemlud
____
"The price of reliability is the pursuit of the utmost simplicity."
C.A.R. Hoare

felix eichhorns premium katzenfutter mit der extraportion energie

A router is not a switch - A router is not a switch - A router is not a switch - A rou....

Still not working so i'm definitely missing something here. I am running plex container on my Unraid server and usually access the service with IPADDRESSOFUNRAID:PORT but can't add port numbers to host override so filled out the fields like this but it doesn't seem to function:
Host: plex.local
Domain (name of my container): plex
Type: A
IP: IPRADDRESSOFUNRAID

What am i doing wrong now? Also regarding using the plex container name, docker containers are on a custom docker network on my unraid server so not sure if this affects things

Thanks again for all the help

Quote from: rama3124 on July 12, 2023, 11:16:50 AM
Is there a way to arrange it so that I can access the services locally using container names? For example if I want to access my Plex container, typing plex.local instead of the IP address?
Maybe with a reverse proxy like ha-proxy but it is not that easy to configure.

July 13, 2023, 11:45:57 AM #7 Last Edit: July 13, 2023, 11:47:58 AM by chemlud
Quote from: rama3124 on July 13, 2023, 10:26:35 AM
Still not working so i'm definitely missing something here. I am running plex container on my Unraid server and usually access the service with IPADDRESSOFUNRAID:PORT but can't add port numbers to host override so filled out the fields like this but it doesn't seem to function:
Host: plex.local
Domain (name of my container): plex
Type: A
IP: IPRADDRESSOFUNRAID

What am i doing wrong now? Also regarding using the plex container name, docker containers are on a custom docker network on my unraid server so not sure if this affects things


Thanks again for all the help

Host: empty
Domain: plex.local

maybe?

Start with something like

ssh plex.local

...if ssh is enabled on the container, for sure.
kind regards
chemlud
____
"The price of reliability is the pursuit of the utmost simplicity."
C.A.R. Hoare

felix eichhorns premium katzenfutter mit der extraportion energie

A router is not a switch - A router is not a switch - A router is not a switch - A rou....