How to ssh to another computer using ngrok or similar tools? Basically, using a domain instead of local ip
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to ssh to another computer using ngrok or similar tools? Basically, using a domain instead of local ip
I'm trying to ssh to my guest machine running Slackware 14.2. I'm able to do it using the local ip but how do I do it with a domain? My host os is Debian 10
uname -a of Slackware
Code:
Linux sandalphon 4.4.14 #2 SMP Fri Jun 24 13:38:27 CDT 2016 x86_64 Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz GenuineIntel GNU/Linux
uname -a of Debian
Code:
Linux sandalphon 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux
I'm trying to ssh to my guest machine running Slackware 14.2. I'm able to do it using the local ip but how do I do it with a domain? My host os is Debian 10
uname -a of Slackware
Code:
Linux sandalphon 4.4.14 #2 SMP Fri Jun 24 13:38:27 CDT 2016 x86_64 Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz GenuineIntel GNU/Linux
uname -a of Debian
Code:
Linux sandalphon 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux
In the above, do you mean access by Microsoft Domain (running a Windows Active Directory based network
), or FQDN (Fully Qualified Domain Name) involving a host or node name and IP domain?
My first assumption is that you mean the second, since BOTH of the machines you mention are running Linux.
For this case, you have options:
#1 run a nameserver on your network. This does require a hardware platform and some configuration, but has interesting advantages. It is, however, overkill for a network with five machines or less.
#2 populate your HOSTS files (/etc/hosts) with the IP address and names of your machines.
Either of these solutions will allow you to assign names to your machine interfaces so that the names resolve to addresses.
Without knowing the real IP addresses of your hosts I can only provide a rather generic example. If the hosts file contains lines like
Code:
10.0.31.11 debian
10.0.31.12 slack
on BOTH machines then you can go onslack and do
Code:
ssh debian
and expect ssh to attempt connection to 10.0.31.11 automagicly.
Note: do NOT empty the hosts file and replace it with just the two lines. There should be a pair of lines that autopopulate on the networking install that are required for proper operation and should not be deleted. I suggest you make a backup of the file so that you can restore to original conditions at need.
You also seem to have both hostnames set to the same thing, so even if you had a nameserver, it wouldn't do you any good as there would be conflicts. You need to have unique names in order to connect with hostname/fqdn, unless you do the hosts file as wpeckham suggests.
Ok now consider it like this. Even if slackware is a virtual machine, it acts like a real machine and so let Slackware be installed on another computer. Now there are two computers Debian and Slackware which are not connected in any way. Now I want to ssh to Slackware from Debian but I cannot do it with the 192.168.x.x ip of Slackware. So, how do I do it? The ip address of Slackware is the same as Debian because it is bridged.
As wpeckham pointed out the two options, neither of them are possible in my case. Even if I set names in the hosts file, how could I connect from debian?
If it's using a bridged NIC, the slackware install would get an IP from your DHCP server exactly like it was a physical machine on your network (this is the purpose of bridged network). Sounds more like you're in a NAT'd environment, where your host is providing DHCP services to the guests. This can still work, just requires more setup. You can make it work with a single NAT (I've seen it work like this, never successfully accomplished it myself), but the easier way is to have 2 NAT networks. 1 for the machine to access out, and another to provide only local access to the NAT'd server from the host.
Yeah doing it with two NAT'S is easy. Looks like it's not gonna be easy for now. I wonder how people connect to their systems when they are miles away from it? Could that be ssh or a complicated server setup?
Getting to it from external systems is easy in a bridge setup. It gets it's own IP on the same subnet as the host, and from an external system, it looks and acts like a separate server, so just ssh to it as normal (this is assuming the firewall on the host has been properly set up to allow inbound connectivity to guests).
Exactly: everything is easier if (as I did assume in my first answer) each node has a unique IP address. If you have a NATd environment, things are no longer simple.
(Correction: getting from the machine BEHIND the nat out to the rest of the network is simple, getting from outside INTO that node is what is no longer simple.)
There are ways, but I must ask: is there any good reason NOT to change the networking from NAT to bridged?
In your environment, possibly not. At my job, we require everyone use NAT'd environements so we don't get a thousand dev VM's showing up on DNS.
In mine the GATEWAY is NATd, but virtual machines are all bridged networking. The Internet sees about 8 total external IP addresses , but internally we see EVERYTHING. That makes connecting internal nodes, virtual and native iron, trivial using FQDNs.
In mine the GATEWAY is NATd, but virtual machines are all bridged networking. The Internet sees about 8 total external IP addresses , but internally we see EVERYTHING. That makes connecting internal nodes, virtual and native iron, trivial using FQDNs.
Yeah, the exact opposite of what we want at my job.
I wonder how people connect to their systems when they are miles away from it?
Personally I use afraid.org FreeDNS on the SSH server machine, and have a cron job to push any potential IP address changes now and then to afraid.org (there are also some decent tips here on how to secure an SSH server that is exposed to the Internet).
Regarding the ssh connection details, I would just create a profile for the connection in ~/.ssh/config, and do:
Code:
ssh profile_name
HostName (can be an IP, should be static on LAN, if it's remote need DNS anyway), user, port, IdentityFile (key), all of that can be set there.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.