LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-09-2017, 12:50 PM   #1
mtdew3q
Member
 
Registered: Mar 2006
Location: the next town over from siberia
Distribution: xubuntu
Posts: 481

Rep: Reputation: 18
ssh trouble connecting ip is different than ifconfig in log


Hi-

I am trying to connect to an ip in virtualbox.
I used host only adapter.

I got the ip to use off of ifconfig. My message in the error log run using this command:

journalctl -u sshd |tail -100 read as follows:

Apr 09 13:38:24 localhost.localdomain sshd[2477]: refused connect from 192.168.42.1 (192.168.42.1)

the ifconfig reads like:

192.168.42.101

it is truncating the 01 at then end of the ip address.

my /etc/hosts.allow says:

sshd: 192.168.0.0/255.255.255.0

any idea why the log gives a different ip in the refused connect msg?

I didn't really make any changes to sshd_config yet. i start server with systemctl start sshd.service

thx. - mtdew3q

Last edited by mtdew3q; 04-09-2017 at 12:52 PM.
 
Old 04-09-2017, 01:05 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Incorrect netmask. You are allowing from 192.168.0.XXX.
 
1 members found this post helpful.
Old 04-09-2017, 01:09 PM   #3
mtdew3q
Member
 
Registered: Mar 2006
Location: the next town over from siberia
Distribution: xubuntu
Posts: 481

Original Poster
Rep: Reputation: 18
hi-

i got a different message now:

$ ssh -p 22 smasher@192.168.32.1
ssh: connect to host 192.168.32.1 port 22: Connection refused

in hosts.allow file

sshd: 192.168.0.0/255.255.255.0

Ethernet adapter VirtualBox Host-Only Network:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80...
IPv4 Address. . . . . . . . . . . : 192.168.32.1
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :

thx. - mtdew3q
 
Old 04-09-2017, 01:11 PM   #4
mtdew3q
Member
 
Registered: Mar 2006
Location: the next town over from siberia
Distribution: xubuntu
Posts: 481

Original Poster
Rep: Reputation: 18
hi okay emerson.

sorry. didn't know you posted.

i will check the mask.

thx.
 
Old 04-09-2017, 01:39 PM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
Which distro, including version, are you using and which version of openssh-server are you running?

hosts.allow is tcpd which is from before even ipchains existed. From OpenSSH 6.7 onwards, tcpd (tcpwrappers) support in sshd has been disabled and you'll have to progress to using iptables for filtering.
 
1 members found this post helpful.
Old 04-09-2017, 04:46 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,678

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
In addition please explain what you are trying to accomplish.

Are you trying to connect to the host or other virtual machine?

The default settings for host only adapter network is 192.168.56.0/24 and the DHCP is enabled by default. How are you configuring your the network for each machine?
 
1 members found this post helpful.
Old 04-09-2017, 05:11 PM   #7
mtdew3q
Member
 
Registered: Mar 2006
Location: the next town over from siberia
Distribution: xubuntu
Posts: 481

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by Turbocapitalist View Post
Which distro, including version, are you using and which version of openssh-server are you running?

hosts.allow is tcpd which is from before even ipchains existed. From OpenSSH 6.7 onwards, tcpd (tcpwrappers) support in sshd has been disabled and you'll have to progress to using iptables for filtering.
fedora 25 xfce and openssh 7.4.

many of the tutorials on the web still reference hosts.allow and hosts.deny.

I will have to read up on your tech tip.

I managed to get leafpad to appear on my windows desktop with ssh/x11-forwarding.

thx.- mtdew3q
 
Old 04-09-2017, 05:13 PM   #8
mtdew3q
Member
 
Registered: Mar 2006
Location: the next town over from siberia
Distribution: xubuntu
Posts: 481

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by michaelk View Post
In addition please explain what you are trying to accomplish.

Are you trying to connect to the host or other virtual machine?

The default settings for host only adapter network is 192.168.56.0/24 and the DHCP is enabled by default. How are you configuring your the network for each machine?
I ended up using a bridge adapter which is the easiest way. I connected to the virtual machine. I'd like to know if it is possible to do with a host-only or NAT setup for the adapter.

I will have to keep reading.

thx - mtdew3q
 
Old 04-09-2017, 05:17 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,678

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
Between host and guest?
 
1 members found this post helpful.
Old 04-09-2017, 06:16 PM   #10
mtdew3q
Member
 
Registered: Mar 2006
Location: the next town over from siberia
Distribution: xubuntu
Posts: 481

Original Poster
Rep: Reputation: 18
Hi Michaelk-

I just read about turbocapitalist's statement that the hosts.allow and hosts.deny are deprecated. I saw the same statements elsewhere.

I was able to get a host-only adapter working too. That is maybe what you meant when you said, "between host and guest?".

I will stick with the host-only adapter way of connecting to an ssh-server on the guest for now.

Thx-
mtdew3q
 
Old 04-10-2017, 12:20 AM   #11
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
Quote:
Originally Posted by mtdew3q View Post
I saw the same statements elsewhere.
Check with an authoritative source at least:

So many guides and tutorials are either out of date or cargo-cult incorrect or out of date material that good ones are hard to find that it's very important to chase down authoritative sources while they are available. Using them puts a stop to guessing.

Were you able to figure out the corresponding iptables rules?
 
1 members found this post helpful.
Old 04-10-2017, 07:22 AM   #12
mtdew3q
Member
 
Registered: Mar 2006
Location: the next town over from siberia
Distribution: xubuntu
Posts: 481

Original Poster
Rep: Reputation: 18
Hi Turbocapitalist-

I have a second network adapter set up as NAT for internet surfing. I thought when I read this article and one or two others with this setup I may not need iptable rules. I don't know very much about networking though.

http://christophermaier.name/2010/09...th-virtualbox/

thx. - mtdew3q
 
Old 04-10-2017, 07:53 AM   #13
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
I meant iptables in the context of replacing what you were trying to do with tcpwrappers earlier. If you do not need that, then don't worry about iptables at the moment.

How many network adapters does the VirtualBox guest containing the SSH server (sshd) have?
 
1 members found this post helpful.
Old 04-10-2017, 12:42 PM   #14
mtdew3q
Member
 
Registered: Mar 2006
Location: the next town over from siberia
Distribution: xubuntu
Posts: 481

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by Turbocapitalist View Post
I meant iptables in the context of replacing what you were trying to do with tcpwrappers earlier. If you do not need that, then don't worry about iptables at the moment.

How many network adapters does the VirtualBox guest containing the SSH server (sshd) have?
It has 2. One is an adapter that uses NAT and the other is the host-only network adapter.

Thx. for writing -

mtdew3q
 
Old 04-10-2017, 01:02 PM   #15
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
Quote:
Originally Posted by mtdew3q View Post
It has 2. One is an adapter that uses NAT and the other is the host-only network adapter.
Your iptables rules will mostly have to be done double, once for each interface. It may be worth a new thread over in Networking when you get that far. But that's for later.

Right now a small but useful step would be to make the SSH server listen only to the guest's host-only network adapter, if that is what you want. For that, lookup the ip address for that adapter and then apply that address to the ListenAddress directive in the guest's sshd_config file. For details, see your version's manual page:

Code:
man sshd_config
If you stop being able to log in, then you have either the wrong address or something wrong with the host-guest routing.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble connecting to my network on liberte, linux noob, ifconfig/netstat provided nubbin99 Linux - Distributions 3 05-15-2012 03:51 AM
how to log ssh activity in /var/log/ssh/ssh*.log MrUmunhum Linux - Server 3 11-02-2011 02:25 AM
connecting /sbin/ifconfig to bash command ifconfig flammable2 Fedora 4 11-12-2005 07:58 AM
connecting to different access points using ifconfig etc. true_atlantis Linux - Wireless Networking 4 08-28-2004 05:47 PM
Red Hat ifconfig trouble OrganicX Linux - Networking 4 10-26-2002 10:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration