Link to home
Create AccountLog in
Linux

Linux

--

Questions

--

Followers

Top Experts

Avatar of hke72
hke72🇳🇴

Linux SSH with 2 NIC
I am trying to make my server have 2 legs. One in an internal network and one in our domain-network. What I want is to have access to the server from our domain network and at the same time be able to use ssh to "talk" with the computers in the small local network.

There are 2 problems
1: I can not manage to setup ssh without password
2: When using ssh user@192.168.10.47 it takes 10-20 seconds before I am asked for the password.

I am a bit confused with the client and server typology of ssh (is my server ssh server or client??) , but I have tried to use descriptions like this one: ssh . In this explanation I see the A computer as being my server and the B computer as being one in the small network.

Technical info (also see attachments!):
- Nic 1: in our domain; has fixed IP 192.168.3.105; gateway 192.168.3.1
- Nic 2: in small local network; has fixed IP 192.168.10.98; gateway 192.168.10.1

I manage to ping into both networks.

I think it has something to do with routing or config settings. Here is my routing table:
192.168.3.0     *                      255.255.255.0   U      1      0        0 nkgs
192.168.10.0   *                      255.255.255.0   U      1      0        0 kursnett
default             192.168.3.1     0.0.0.0               UG   0     0        0 nkgs

I also did an NSLOOKUP:
[root@kursserver kurs]# nslookup 192.168.10.47
Server:            192.168.0.21
Address:      192.168.0.21#53

** server can't find 47.10.168.192.in-addr.arpa.: NXDOMAIN

..which gives server 0.21 which is the DNS of the other domain-network!!??

I have also attached pictures of the login-info of the two NIC's. User generated image User generated image

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of gelonidagelonida🇫🇷

yould you run yiur ssh command with the option -v to get a little more info about the delays.

Ideally tell us also at what line the output 'freezes'

Potential problems could be in your ssh server or client configuration
 

On one of my hosts was hanging due to some GSSAPI issues.
setting
GSSAPIAuthentication no

helped in my case.

Avatar of gelonidagelonida🇫🇷

you could also try to add the line

UseDNS no

to your ssh server config  in the intranet
/etc/ssh/sshd_config





Avatar of gelonidagelonida🇫🇷

concerning login without password:


I would create a public/private key pair for ssh on user@192.168.3.0 and copy
the publick key over to user@192.168.10.47

I personally would password protect the key and use ssh-agent to enter the password only once.

if you insist on never entering the password, then you can create a pair of keys without password.

Please tell me what you would like to do?


example to create a password protected pair of keys:
-------------------------------------------------------------------
enter a password of your choice in order to protect your pair of keys

user1@myhost:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user1/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in dsas.
Your public key has been saved in dsas.pub.
The key fingerprint is:
xx:xx:.....:xx  user1@myhost
The key's randomart image is:
+--[ RSA 2048]----+
....
+-----------------+


now copy it over to your destination host
cat /home/klausf/.ssh/id_rsa.pub | ssh user@192.168.10.47 "cat >> .ssh/authorized_keys"
you will be prompted for a password.



now try
ssh user@192.168.10.47

instead of being asked for the bassword of user1 you should be asked for the password of
your ssh-keyfile.

if this is the case, then you can use

the command
ssh-add to enter the password of you ssh-keyfile once.

If this doesn't work, then your system doesn't autostart an ssh-agent

so start it pior to calling ssh-add

with the command

eval `ssh-agent`


Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of hke72hke72🇳🇴

ASKER

The command 'ssh user@192.168.10.47 resulted in:
bash-4.1$ ssh -v kurs@192.168.10.47
OpenSSH_5.4p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.10.47 [192.168.10.47] port 22.
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug1: could not open key file '/etc/ssh/ssh_host_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_dsa_key': Permission denied
debug1: could not open key file '/etc/ssh/ssh_host_rsa_key': Permission denied
debug1: identity file /home/kurs/.ssh/id_rsa type 1
debug1: identity file /home/kurs/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.2
debug1: match: OpenSSH_5.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.10.47' is known and matches the RSA host key.
debug1: Found key in /home/kurs/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/kurs/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: password
kurs@192.168.10.47's password:



ASKER CERTIFIED SOLUTION
Avatar of gelonidagelonida🇫🇷

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of hke72hke72🇳🇴

ASKER

It was the 'UseDNS no' that did the trick!

Thanks a lot :)
Linux

Linux

--

Questions

--

Followers

Top Experts

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.