You are not logged in.

#1 2008-05-14 05:38:50

Isomorphism
Member
Registered: 2008-04-29
Posts: 41

Connecting two computers via ssh

Hello all big_smile

I have two computers at home, connected using a LAN cable. One of them has only arch and the other has Ubuntu+XP. I want to connect them using ssh..that is, I want to share files using ssh or samba and I dont know anything about networks sad

I followed the ssh guide, added sshd to daemons list, added "eth0 <ip address> netmask 255.255.255.0" to the rc.conf NETWORK area.In Ubuntu, when I type "ssh -p 22 <username>@<ipaddress>", it says ip is unreachable.

Now that I think about it, I think I had to do some modifications on the Ubuntu side too. So a few questions:
1) Should I open port 22 in Ubuntu? And how do I do it?
2)Should I configure ssh in some other way? My friend was saying I only have a "client" software and not a "server" software, so I cant configure. I dont know what any of it means.

P.S:I should probably post outputs my network configuration. But I dont know anything about networks. So please specify, if you need to see some config files etc.

Thanks,
Spai

Offline

#2 2008-05-14 05:51:33

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,384
Website

Re: Connecting two computers via ssh

Just to clarify a few thing.

1) Can you connect to the net using the computer you want to ssh into?  You write something about setting up your network in /etc/rc.conf so I an just checking it is all working.

2) Can you ping the computer you want to ssh into?

3) Did you allow access by ssh in the /etc/hosts.allow file?   I'd initially go with "sshd: ALL" and then restrict the permissions if you want later

Offline

#3 2008-05-14 06:09:38

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Connecting two computers via ssh

More generally - first this:
http://wiki.archlinux.org/index.php/Configuring_network
and then this:
http://wiki.archlinux.org/index.php/SSH

Ubuntu questions would probably be better placed in the Ubuntu forum.

Offline

#4 2008-05-14 16:10:47

Isomorphism
Member
Registered: 2008-04-29
Posts: 41

Re: Connecting two computers via ssh

My Arch ip settings:
inet addr:192.168.1.2  Bcast:192.168.255.255  Mask:255.255.0.0
My Ubuntu ip settings:
inet addr:192.168.1.6  Bcast:192.168.255.255  Mask:255.255.0.0

Are these settings enough? Should I change some other setting files to connect two computers for file sharing?


To Allan,

Allan wrote:

1) Can you connect to the net using the computer you want to ssh into?

By net, if you mean internet, then I dont want to connect to internet using the Ubuntu computer. I just want to share files between Arch and Ubuntu computers.

Allan wrote:

You write something about setting up your network in /etc/rc.conf so I an just checking it is all working.

I did this following the guide. In the wiki, it is mentioned that to connect two computers locally we need a static ip address.So I set the following to my(Arch) rc.conf file in the interface.My rc.conf file looks like this:

HOSTNAME="L"
#
# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available
# interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
#
# Note: to use DHCP, set your interface to be "dhcp" (eth0="dhcp")
#
#lo="lo 127.0.0.1"
#eth0="dhcp"
eth0="eth0 192.168.1.2 netmask 255.255.0.0 broadcast 192.168.255.255"
INTERFACES=(eth0)
#
# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.1.1"
ROUTES=(gateway)
Allan wrote:

2) Can you ping the computer you want to ssh into?

No, I unfortunately cant. I do not know what is wrong mad
I have set my Ubuntu ip as 192.168.1.6 with the broadcast and netmask same as Arch.
When I ping from either of my computer to the other, it says host unreachable:

[spai@L ~]$ ping 192.168.1.6
PING 192.168.1.6 (192.168.1.6) 56(84) bytes of data.
From 192.168.1.3 icmp_seq=1 Destination Host Unreachable
Allan wrote:

3) Did you allow access by ssh in the /etc/hosts.allow file?   I'd initially go with "sshd: ALL" and then restrict the permissions if you want later

Yes, I have done that. But if I cant ping at all, then is there any hope with this?

@tomk:I have followed that guide to maximum of my understanding. That is I dont know what to do with resolv.conf. Apart from that I have followed everything.

Last edited by Isomorphism (2008-05-14 16:29:32)

Offline

#5 2008-05-14 16:23:04

Aaron
Member
From: PA, USA
Registered: 2007-12-19
Posts: 108
Website

Re: Connecting two computers via ssh

Okay, how are the devices physically connected?

Do you plug each computer into a router/switch/hub, or does the ethernet cable go directly from one computer into the other?

You may simply be using the wrong cable, if you connect two devices with only an ethernet cable, you need to use a "Crossover" cable.

And according to your rc.conf, you're still using DHCP, not static IP's.  # means comment.

Offline

#6 2008-05-14 16:34:40

Isomorphism
Member
Registered: 2008-04-29
Posts: 41

Re: Connecting two computers via ssh

Aaron wrote:

Okay, how are the devices physically connected?

Do you plug each computer into a router/switch/hub, or does the ethernet cable go directly from one computer into the other?

You may simply be using the wrong cable, if you connect two devices with only an ethernet cable, you need to use a "Crossover" cable.

Ethernet cable goes directly from one computer into the other. And I am using a crossover cable.
What other cables are available yikes

Aaron wrote:

And according to your rc.conf, you're still using DHCP, not static IP's.  # means comment.

Oh that was just a small mistake on my part.To use internet(like now) I comment the other connection line. While connecting computers for sharing, I comment the dhcp part.I do this since I have only one port for such a cable.

Offline

#7 2008-05-14 16:54:46

Aaron
Member
From: PA, USA
Registered: 2007-12-19
Posts: 108
Website

Re: Connecting two computers via ssh

Isomorphism wrote:
Aaron wrote:

Okay, how are the devices physically connected?

Do you plug each computer into a router/switch/hub, or does the ethernet cable go directly from one computer into the other?

You may simply be using the wrong cable, if you connect two devices with only an ethernet cable, you need to use a "Crossover" cable.

Ethernet cable goes directly from one computer into the other. And I am using a crossover cable.
What other cables are available yikes

Aaron wrote:

And according to your rc.conf, you're still using DHCP, not static IP's.  # means comment.

Oh that was just a small mistake on my part.To use internet(like now) I comment the other connection line. While connecting computers for sharing, I comment the dhcp part.I do this since I have only one port for such a cable.

There's only one other kind of cable I have experience with besides straight through and crossover is rollover, but that's used for completely different purposes.

So you only have one NIC in each computer, and you manually disconnect the XP+Ubuntu computer and plug it into your internet source?  If you were actually using a crossover cable, you would be unable to connect to the internet using that cable.  So I assume you switch to a straight through cable for your internet connection?

Can you ssh into your machine while being physically on the machine?  For instance, can you SSH into your arch box from within arch?

Last edited by Aaron (2008-05-14 16:56:24)

Offline

#8 2008-05-14 17:00:16

Isomorphism
Member
Registered: 2008-04-29
Posts: 41

Re: Connecting two computers via ssh

Aaron wrote:

There's only one other kind of cable I have experience with besides straight through and crossover is rollover, but that's used for completely different purposes.

So you only have one NIC in each computer, and you manually disconnect the XP+Ubuntu computer and plug it into your internet source?

Yes, Its quite tiresome sad

Aaron wrote:

If you were actually using a crossover cable, you would be unable to connect to the internet using that cable.  So I assume you switch to a straight through cable for your internet connection?

Yes

Aaron wrote:

Can you ssh into your machine while being physically on the machine?  For instance, can you SSH into your arch box from within arch?

Yes I can. I am curious, how will successfully 'ssh'ing to my arch box helps in configuring the network?

Thanks big_smile
Spai

Offline

#9 2008-05-14 17:10:52

Aaron
Member
From: PA, USA
Registered: 2007-12-19
Posts: 108
Website

Re: Connecting two computers via ssh

Aaron wrote:

Can you ssh into your machine while being physically on the machine?  For instance, can you SSH into your arch box from within arch?
Yes I can. I am curious, how will successfully 'ssh'ing to my arch box helps in configuring the network?

Thanks big_smile
Spai

Well, it's not so much to help you "set up" the network as it is to make sure that SSHD is properly configured.

Try and SSH into your Ubuntu box from within Ubuntu as well, just to be sure.

What do your iptables look like?  Are you running any form of firewall?
Try # iptables -l

It's looking to me as if your problem is how you configured the static ip's.  You're using an awfully large netmask.  Try
192.168.1.255 broadcast
255.255.255.0 netmask

Sorry if this seems like a lot of little things, but I'm trying to narrow down the problem.

The first priority here should be to establish a connection between the two systems that can be verified by PING.  Then we'll work our way up to SSH.

Last edited by Aaron (2008-05-14 17:12:14)

Offline

#10 2008-05-14 17:26:06

Isomorphism
Member
Registered: 2008-04-29
Posts: 41

Re: Connecting two computers via ssh

Aaron wrote:

Well, it's not so much to help you "set up" the network as it is to make sure that SSHD is properly configured.

Try and SSH into your Ubuntu box from within Ubuntu as well, just to be sure.

Ubuntu says:
ssh: connect to host 192.168.1.6 port 22: Connection refused

What do your iptables look like?  Are you running any form of firewall?
Try # iptables -l

[spai@L ~]$iptables -l
iptables v1.4.0: Unknown arg `-l'
Try `iptables -h' or 'iptables --help' for more information.

It's looking to me as if your problem is how you configured the static ip's.  You're using an awfully large netmask.  Try
192.168.1.255 broadcast
255.255.255.0 netmask

Ok I will change that, now.

Sorry if this seems like a lot of little things, but I'm trying to narrow down the problem.

The first priority here should be to establish a connection between the two systems that can be verified by PING.  Then we'll work our way up to SSH.

Thanks. I think that is sensible course of action. i didnt want to go to the ubuntu forum just for this network setting since I wont use Ubuntu anyway. But now it looks like I have no pther choice sad

Thanks Aaron big_smile
Spai

Offline

#11 2008-05-14 17:36:04

Aaron
Member
From: PA, USA
Registered: 2007-12-19
Posts: 108
Website

Re: Connecting two computers via ssh

Well, to solve your ubuntu SSH issue, you should configure your SSHD the same way you configured your arch box.

I'm curious what iptable rules you have, my mistake on the command however, try
# iptables -L

Remember, whenever you check something on one box, check it on the other!  I believe your main issue has to do with your ubuntu box, since your arch box is able to connect to the internet.  Have you tried connecting your ubuntu box to the internet at all? (I know you don't want to, but try it, just to test)

Offline

#12 2008-05-14 17:44:29

Isomorphism
Member
Registered: 2008-04-29
Posts: 41

Re: Connecting two computers via ssh

Aaron wrote:

Well, to solve your ubuntu SSH issue, you should configure your SSHD the same way you configured your arch box.

I'm curious what iptable rules you have, my mistake on the command however, try
# iptables -L

Actually shouldnt I be trying all these commands, when I have commented the dhcp line and uncommented the other, that is when I am in connect-my-Ubuntu-Arch mode?

Anyway with DHCP on, here it is:

[spai@L samba]$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Remember, whenever you check something on one box, check it on the other!  I believe your main issue has to do with your ubuntu box, since your arch box is able to connect to the internet.  Have you tried connecting your ubuntu box to the internet at all? (I know you don't want to, but try it, just to test)

Actually I used the Ubuntu computer for everything(browsing, playing, music etc) until last month when I installed Arch on the other computer. So I dont think there is any problem Ubuntu connecting to internet. If I connect my modem to the Ubuntu box, it will work fine.

P.S: Would you kindly tell me in which mode(that is connect-my-Ubuntu-Arch mode or normal internet mode) to run the commands you say... I am pretty clueless sad

Thanks Aaron ,
Spai

Last edited by Isomorphism (2008-05-14 17:47:10)

Offline

#13 2008-05-14 18:00:48

Aaron
Member
From: PA, USA
Registered: 2007-12-19
Posts: 108
Website

Re: Connecting two computers via ssh

When you're doing your testing, you should be using your Arch-connect-to-Ubuntu-with-Crossovercable configuration for all testing.  Certain commands such as iptables won't matter which configuration you test on, but to test connectivity between the two you need them connected.

Of course you won't be able to ping Ubuntu when there's no cable plugged into the box. smile

The ubuntu forums are a good source of information, though I'm not a fan of the distribution myself, the community surrounding it is quite knowledgeable.  If you do try to make a post over there, be sure to link to this post, so they can refer to what we have already tried here.

If you come up with any other ideas or questions, I'll do my best to answer them, but I'm out of ideas for the most part off the top of my head.

I'm sure there's something very simple the two of us are missing here.

Last edited by Aaron (2008-05-14 18:02:00)

Offline

#14 2008-05-15 05:47:57

Isomorphism
Member
Registered: 2008-04-29
Posts: 41

Re: Connecting two computers via ssh

Well with help from a nice guy on Ubuntu forum, I can now ssh from Ubuntu into Ubuntu too. Actually Ubuntu did not have openssh server software, only ssh sad Thats why I had problems.

However the pinging problem is still there. I still cant ping from my Arch box to Another. It says Host unreachable. On Ubuntu, it says connection to port 22 is refused!

So... what do I do?

Thanks big_smile
Spai

Offline

#15 2008-05-15 09:33:46

tntcoda
Member
Registered: 2007-07-24
Posts: 115

Re: Connecting two computers via ssh

If iptables is empty and something is still blocking ICMP, then maybe check whats in /etc/hosts.allow and /etc/hosts.deny (on both PCs)

Offline

Board footer

Powered by FluxBB