About Sub Domain Refer to Another IP with Port

jimmy_Speedminer

Registered
Nov 21, 2022
4
0
1
Malaysia
cPanel Access Level
Root Administrator
I am trying to create a subdomain (e.g. sub1.domain.com) pointing to IP with port (e.g. 192.168.0.1:58888).

I have tried the following method in cPanel 106.0.10. Do not seems to be working.. waited for 24hours.. Wondering what is the proper way to do it. The idea to use the subdomain instead of port no. Thank you.

Just to add more info. The sub.domain.com and sub.doman.com:58888 is working. Is just sub1.domain.com is not working

Zone Editor

sub.domain.com.14400A192.168.0.1

sub1.domain.com.14400SRVPriority: 100
Weight: 1
Port: 58888
Target: sub.domain.com.
 
Last edited by a moderator:

jimmy_Speedminer

Registered
Nov 21, 2022
4
0
1
Malaysia
cPanel Access Level
Root Administrator
I tried to ping sub1.domain.com , getting "Ping request could not find host sub1.domain.com. Please check the name and try again."

If I use the Track DNS, I am getting

Track DNS
Enter a domain to look up:
sub1.domain.com
Error: Unable to run the command “host”
domain.com. 3600 IN SOA ns101.xxxhosting.com. abusexxxhosting.com. 2022112203 86400 7200 3600000 86400


Enter a domain to look up: sub.domain.com
sub.domain.com. 14400 IN A 192.168.0.1
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
12,499
1,971
363
cPanel Access Level
Root Administrator
I would confirm the DNS for that domain is being managed on the cPanel server before trying anything else, since if the nameservers aren't at that location nothing else will work.

If that is configured properly, you can check the record directly by running this command:

Code:
dig sub.domain.com @x.x.x.x
where x.x.x.x is the IP address of your server. If THAT works...then you can try with the nameserver as well:

Code:
dig sub.domain.com @ns1.yournameserver.com
to see if that is working. I would expect one of those tests to fail with the output you have provided.
 

jimmy_Speedminer

Registered
Nov 21, 2022
4
0
1
Malaysia
cPanel Access Level
Root Administrator
I am getting connection timed out.

Code:
administrator:~$ dig sub.domain.com @192.168.0.1
; <<>> DiG 9.18.1-1ubuntu1.2-Ubuntu <<>> sub.domain.com @192.168.0.1
;; global options: +cmd
;; connection timed out; no servers could be reached
administrator:~$

The following is command without IP

Code:
administrator:~$ dig sub.domain.com                            
; <<>> DiG 9.18.1-1ubuntu1.2-Ubuntu <<>> sub.domain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29679
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;sub.domain.com.           IN      A

;; ANSWER SECTION:
sub.domain.com.    0       IN      A       192.168.0.1

;; Query time: 4 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Thu Nov 24 01:50:03 UTC 2022
;; MSG SIZE  rcvd: 64

administrator:~$
I have tried


Code:
administrator:~$ dig sub1.domain.com

; <<>> DiG 9.18.1-1ubuntu1.2-Ubuntu <<>> sub1.domain.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44859
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;sub1.domain.com.          IN      A

;; AUTHORITY SECTION:
domain.com.         888     IN      SOA     ns101.xxxhosting.com. abuse.xxxhosting.com. 2022112302 86400 7200 3600000 86400

;; Query time: 11 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Thu Nov 24 01:56:09 UTC 2022
;; MSG SIZE  rcvd: 108

administrator:~$
 
Last edited:

rbairwell

Well-Known Member
May 28, 2022
96
40
18
Mansfield, Nottingham, UK
cPanel Access Level
Root Administrator
I think the problem could be the usage of the SRV record - not every application works with or recognises them ( see SRV record - Wikipedia ) - "host" part of the name (the left hand side bit) needs to be in a very specific format - _service._proto. followed by the domain name. For example, _sip._udp.voiceless.aa.net.uk.

If it was a "standard" A or CNAME record, it would most likely work (as you've demonstrated with sub), but you can't specify a port number for those (as they are just "name to ip address" mapping).

Basically, what you think you are trying to do can't be done that way. You'll need to setup the DNS record pointing at your server (using a standard A or CNAME) and then do some proxying on the inbound request based on the name (or point towards a secondary IP address and then have port forwarding from there).

What, exactly, are you trying to actually achieve?
 

jimmy_Speedminer

Registered
Nov 21, 2022
4
0
1
Malaysia
cPanel Access Level
Root Administrator
I have existing configurations using ports to direct / land to a specific hosting server. e.g . sub.domain.com: 58888. I was thinking instead of using ports maybe I could create new domain to handle the port which is more meaningful and easier to remember. e.g sub1.domain.com will translate to sub.domain.com:58888 (not direct.).