Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 12-04-2009, 06:09 PM   #1
LQ Newbie
Registered: Nov 2004
Distribution: Fedora 12
Posts: 16

Rep: Reputation: 0
How to ssh between two machines on a "home network"


This is probably a straightforward problem, but I can't seem to find a solution which addresses my problem exactly.

I have a normal home broadband connection, with a wireless router and a dynamic IP address. Nothing fancy at all. I have two machines, a Linux box (Fedora 12) and a Windows (Vista) machine; the Linux box is connected to the router via ethernet cable, and the Windows machine wirelessly.

My question is, how can I easily (and permanently) ssh and scp between the two machines since I don't know their IP addresses from one day to the next? Both machines have hostnames... can I somehow set up an alias so that each computer knows how to talk to the other?

Thanks for your advice.
Old 12-04-2009, 06:51 PM   #2
LQ Guru
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,121

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
The easy way is to assign static IP address to each machine. They can be any IP address in the range of your sub-net not used by the DHCP server in the router.

You need to know how to connect to your router and how to configure it. Usually form a web browser type 192.168.x.1 where x is the number of your sub-net. Once connected, look for the range of addresses the DHCP server can give out. Usually you can control this number. On my router, I set it for 4 addresses only. I have 3 systems using DHCP, so that leaves one spare address.

The other way is to determine the MAC addresses of the cards in each system. That is easy in linux, from the command line issue as root the command 'ifconfig eth0' ( without the quotes, assuming it is eth0 ). That will dump some information on the screen, the MAC address is in there. Here is what it will look like.

/sbin/ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:1D:7D:20:F4:67
inet addr: Bcast: Mask:
RX packets:628129 errors:0 dropped:0 overruns:0 frame:0
TX packets:589113 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:301913696 (287.9 MiB) TX bytes:94797228 (90.4 MiB)
Interrupt:24 Base address:0x6000
The field HWaddr is the MAC address. Most routers allow you to specify a MAC address, and what IP address to issue to that card. Then you know what IP it will always get.

I think if you look in the networking section in windbloze you can find the MAC address also.

If you need more help with connecting to the router, post the make and model. Most of them have documentation online we can search to find out the details....
Old 12-04-2009, 06:56 PM   #3
Registered: Aug 2007
Location: Bogotá, Colombia. South America
Distribution: ArchLinux / Source Mage GNU Linux (test branch) / openSUSE
Posts: 130

Rep: Reputation: Disabled
If you can ping them by their names i.e., Your router has a decent and configured name-server, then you can. For most of us, static IPs is not an option but calling machines by their names surely is.

Last edited by code933k; 12-04-2009 at 06:57 PM.
Old 12-05-2009, 04:56 AM   #4
LQ Newbie
Registered: Nov 2004
Distribution: Fedora 12
Posts: 16

Original Poster
Rep: Reputation: 0
Thanks to both of you. I hadn't thought about configuring the router itself, so I did that, and am now at the stage where each machine has a static IP, and I can ping the Linux machine from the Windows machine.

However, my pings from the Linux machine to the Windows machine get lost, and I can't ssh between the two machines either way. Do you have any more advice? Is it something to do with firewalls on either machine and/or the router?


Last edited by pmw; 12-05-2009 at 05:28 AM. Reason: Improved English
Old 12-05-2009, 05:42 AM   #5
LQ Guru
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 14.1, 14.2
Posts: 5,121

Rep: Reputation: 494Reputation: 494Reputation: 494Reputation: 494Reputation: 494
I do not think the router is the problem now. Firewall(s) are probably the best bet. They can filter both transmitted and received packets.

SSH runs on port 22 by default. You can look at /etc/ssh/ssh_config file to see if the default port is in use, or has been changed. If the is a firewall, then open port 22 and give it a try. You could just disable the firewall for a test to see if that is the problem.

Another possibility on the linux side is the /etc/hosts.deny and /etc/hosts.allow files. Have a look to see if they are there. If not, then that isn't the problem. If they are, and you have a line in hosts.deny file, with
in it, then you need a line in hosts.allow like this,

sshd sshd1 sshd2 : ,
This is a list of allowed IP's allowed to ssh into the server.


home, linux, network, windows

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
SSH issue ""Server unexpectedly closed network connection" Errsta_Fonzarelli Linux - Software 12 05-24-2010 02:35 PM
[SOLVED] how to simulate "mkdir -p /home/blah1/blah2/blah3" in "c" where only /home exist platinumedge Linux - Newbie 4 10-04-2009 06:28 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
"network is unreachable" but I can ping local machines MrGaiters Linux - Newbie 3 03-24-2006 02:38 AM

All times are GMT -5. The time now is 12:00 AM.

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