大网数据广告活动
服务器运维问答

Subdomain for specific ports?

· 52CE 我爱测

Summary: In a broader context, I just need a way to connect to multiple servers that are all running the same services on the same network without having multiple external IP addresses or having to forward a different port on eac…

问题原文

原帖链接 · GNULinuxOnboard · CC BY-SA 4.0

Summary: In a broader context, I just need a way to connect to multiple servers that are all running the same services on the same network without having multiple external IP addresses or having to forward a different port on each server for the same service.

More detailed explanation: I have 3 servers on my network, each of which I would like to access remotely via ssh. Here’s what things currently look like with ports and addresses:

Internal IP:    Port:
192.168.1.100   22 (ssh)
192.168.1.101   23 (ssh)
192.168.1.102   24 (ssh)

Let’s say the external IP for my network is 161.86.232.865 and all of the above ports are forwarded and visible to the external network. Is it possible to give each of these ports a subdomain and be able to ssh into them with their subdomain? For example, 192.168.1.100 would be ssh-100.example.com, 192.168.1.101 would be ssh-101.example.com, and so on. I understand that this is not (as far as I know) possible to do with the internal IPs instead of ports, so I figured I’d ask.

If you know anything, please share. Thanks!

已采纳解答

原帖链接 · 84104 · CC BY-SA 4.0

This is not currently possible. SSH does not currently support srv records. There are some proposed patches that do so, but they are not part of mainstream repositories. (You could perhaps alias sshsrv to ssh.).


Presumably you're looking for something more portable than specifying Port in your local ~/.ssh/config, which could work for anything that shared that same config.


There's also ssh -J <jumphost>, which can work if you don't mind making one host your bastion (perhaps not a bad idea anyway).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-01-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。