LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to ssh between two machines on a "home network" (https://www.linuxquestions.org/questions/linux-networking-3/how-to-ssh-between-two-machines-on-a-home-network-773556/)

pmw 12-04-2009 06:09 PM

How to ssh between two machines on a "home network"
 
Hello,

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.

camorri 12-04-2009 06:51 PM

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.

Quote:

/sbin/ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:1D:7D:20:F4:67
inet addr:192.168.1.26 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
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....

code933k 12-04-2009 06:56 PM

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.

pmw 12-05-2009 04:56 AM

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?

Thanks.

camorri 12-05-2009 05:42 AM

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
Quote:

ALL:ALL
in it, then you need a line in hosts.allow like this,

Quote:

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


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