Community discussions

MikroTik App
 
nabsltd
just joined
Topic Author
Posts: 2
Joined: Wed Jan 10, 2024 12:34 am

Can't connect to web UI via hostname

Sun Mar 10, 2024 3:52 am

I have a CRS326-24S+2Q+ running RouterOS 7.14.

I added an IP in my subnet (10.10.64.7/24) to the default bridge, and disabled the default IP address. All works well, and I can access the web UI via http://10.10.64.7/

But, despite my DNS server having an A record for switch00.mylocaldomain.com with the value of 10.10.64.7, I can't use http://switch00.mylocaldomain.com/ to access the web UI. I get a "connection refused" error.

What do I need to change in the config so the connection is accepted?

Thanks.
 
tangent
Forum Guru
Forum Guru
Posts: 1406
Joined: Thu Jul 01, 2021 3:15 pm
Contact:

Re: Can't connect to web UI via hostname

Sun Mar 10, 2024 5:48 am

It works here, but only once I got DNS properly configured.

You don't say which local DNS server you're using, but since the only on-topic one here would be RouterOS's built-in offering, the configuration needs to look like this:

/ip dns static
add address=10.10.64.7 name=switch00.mylocaldomain.com
add cname=switch00.mylocaldomain.com name=sw.mylocaldomain.com type=CNAME
/ip dhcp-server network
add address=10.10.64.0/24 dns-server=10.10.64.7 domain=mylocaldomain.com …

Points of interest:

  • Use FQDNs, not bare host names
  • If you add a CNAME — "sw" in the example above — use an FQDN for it, too, pointed at the canonical FQDN
  • Add your domain name to the DHCP server config, without which the above two rules will prevent use of hostname-only lookups.
  • Each self-signed cert you mint for TLS/HTTPS needs to list all possible names and IPs in the SAN field, not just the canonical FQDN. Per RFC2818, leave the common-name field blank; browsers don't pay attention to that any more.
 
nabsltd
just joined
Topic Author
Posts: 2
Joined: Wed Jan 10, 2024 12:34 am

Re: Can't connect to web UI via hostname

Tue Mar 26, 2024 9:28 pm

It works here, but only once I got DNS properly configured.

You don't say which local DNS server you're using
I'm using Windows DNS, and the DNS lookup works fine to return the IP address of the switch. The switch is configured to use the same DNS server, and can query it successfully. I know this works because the switch can do things like ping by hostname, and look for (and find) updates to RouterOS.

The problem is that the switch refuses to accept the connection if the browser uses the hostname in the URL.

This sort of error is typically caused by a host header name misconfiguration, but I see nowhere in the switch config to tell its web server what hostname it should accept. HTTPS and certs aren't an issue, as I'm only using the default HTTP.

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], K0NCTANT1N, Oleg554555 and 38 guests