1

I have been struggling to enable bidirectional SSH connection from my laptop to desktop, and vice versa. There is one home network router, and both computers are connected to it with a LAN cable. I can connect from laptop to desktop, but not the opposite.

These are the configurations:

Mint 17.3 Rosa (GNU/Linux 3.19.0-32-generic x86_64), Desktop

branislava@mint:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:24:21:db:51:4d  
          inet addr:192.168.0.11  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::224:21ff:fedb:514d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:32733 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16138 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:18404580 (18.4 MB)  TX bytes:1881439 (1.8 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6362 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6362 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:561391 (561.3 KB)  TX bytes:561391 (561.3 KB)

vmnet1    Link encap:Ethernet  HWaddr 00:50:56:c0:00:01  
          inet addr:172.16.46.1  Bcast:172.16.46.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:118 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vmnet8    Link encap:Ethernet  HWaddr 00:50:56:c0:00:08  
          inet addr:192.168.89.1  Bcast:192.168.89.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:119 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Ubuntu 16.04 LTS (GNU/Linux 4.4.0-21-generic x86_64), Laptop

branislava@ubuntu:~$ ifconfig
ens33     Link encap:Ethernet  HWaddr 00:0c:29:3c:bc:3b  
          inet addr:192.168.17.129  Bcast:192.168.17.255  Mask:255.255.255.0
          inet6 addr: fe80::4d02:b72:2730:3807/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15856 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7172 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9538356 (9.5 MB)  TX bytes:990463 (990.4 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6109 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6109 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:616225 (616.2 KB)  TX bytes:616225 (616.2 KB)

The /etc/network/interfaces is the same on both computers:

$ cat /etc/network/interfaces
auto lo
iface lo inet loopback

SSH connection from desktop to laptop:

branislava@mint ~ $ ssh 192.168.17.129
ssh: connect to host 192.168.17.129 port 22: Connection timed out

SSH connection from laptop to desktop:

branislava@ubuntu:~$ ssh 192.168.0.11
[email protected]'s password: 
Welcome to Linux Mint 17.3 Rosa (GNU/Linux 3.19.0-32-generic x86_64)   
Welcome to Linux Mint.  
Last login: Fri Jul 22 15:39:44 2016 from 192.168.0.13

Pinging results:

branislava@mint ~ $ping 192.168.17.129
PING 192.168.17.129 (192.168.17.129) 56(84) bytes of data.
^C
--- 192.168.17.129 ping statistics ---
210 packets transmitted, 0 received, 100% packet loss, time 210671ms

And:

branislava@ubuntu:~$ ping 192.168.0.11
PING 192.168.0.11 (192.168.0.11) 56(84) bytes of data.
64 bytes from 192.168.0.11: icmp_seq=1 ttl=128 time=1.20 ms
64 bytes from 192.168.0.11: icmp_seq=2 ttl=128 time=3.75 ms
64 bytes from 192.168.0.11: icmp_seq=3 ttl=128 time=2.06 ms
64 bytes from 192.168.0.11: icmp_seq=4 ttl=128 time=2.12 ms
64 bytes from 192.168.0.11: icmp_seq=5 ttl=128 time=2.13 ms
64 bytes from 192.168.0.11: icmp_seq=6 ttl=128 time=1.58 ms
64 bytes from 192.168.0.11: icmp_seq=7 ttl=128 time=1.77 ms
64 bytes from 192.168.0.11: icmp_seq=8 ttl=128 time=2.45 ms
...
--- 192.168.0.11 ping statistics ---
115 packets transmitted, 114 received, +1 errors, 0% packet loss, time 114232ms
rtt min/avg/max/mdev = 0.723/9.986/762.520/71.106 ms, pipe 3

They are both connected to the internet. Does anyone have an idea would could be the issue?

1

3 Answers 3

1

As user367880 mentioned, your laptop and desktop are in two different subnets, I am surprised that your laptop could actually ping the desktop. Perhaps your router is helping to route the traffic to the other host.

I have the following suggestions:

  1. Check the routing by using the route command. Usually home routers should by default only have one subnet and thus one IP. Computers connected to the router should point to the router as default gateway. Using the route command could help check where the packets are actually going.

  2. Try using static IP so you have more control on the subnets. I assume you don't have a specific requirement for the computers to be in different subnets, so you could actually use static IP to force the computers to be in the same subnet instead. For example, if your router IP is something like 192.168.1.1 with a subnet mask of 255.255.255.0, you can have your two computer as 192.168.1.10 and 192.168.1.11. Both of the default gateways should point to 192.168.1.1.

  3. For testing purpose, you could try turning the firewall off first. Use sudo ufw disable to turn off your firewall. If this works, then it means you need to add some rules to allow traffic to pass through the firewall.

5
  • Thank you a lot. I am trying to set up things since you wrote the answer, but unsuccessfully. Manually setting ip address is not working. My router is on 192.168.0.1. Desktop is 192.168.0.11 and laptop is 192.168.0.12. When I set up manually that laptop's ip is 192.168.0.12 (and not the default, 192.168.17.129) laptop cannot connect to the internet and is still not visible to the Desktop. Turning off firewall also does not help. :/ Aug 1, 2016 at 9:25
  • do you mean after you setup static IP the laptop even lost the connection to Internet which it had before? I just thought of something... Are you using WiFi connection for your laptop? This would explain why it might have a different subnet. If that is true, then the problem might be on the router side blocking traffic in between. Still it is very strange since your the traffic is one-sided when I expect it to not work at all... If you are using wireless, you can try telling the router to also assign 192.168.0.x IP to wireless devices.
    – Lok.K.
    Aug 1, 2016 at 9:40
  • I have tried both. At the moment, Laptop is connected with cable and I've turned wifi off. But I have also tried to do the opposite (laptop wifi, desktop cable). But it is the same. The laptop gets the same ip from router, no matter which way it is connected to the internet. And yes, when I give static ip to laptop, it can no longer connect to the internet. EDIT: BTW, I have changed lots of settings so far and it is not unidirectional any more :D Now they cannot even ping each other. Aug 1, 2016 at 9:44
  • I have also tried to connect laptop and desktop directly, with one cable, and laptop is the device that is connected to the internet. I do not even need an internet connection. It is just important that two devices can communicate via ssh. Do I perhaps have the wrong approach? Aug 1, 2016 at 9:47
  • If you are connecting the two machines together, then all you need is two static IP within the same subnet without the need of a gateway. This should be the least configuration needed. I am not sure how old are your machines though, older models need to use a cross cable to connect to each other, otherwise you need a switch. Newer machines should be able to use straight cable to do the direct connection. If you still want to try troubleshooting using the old method perhaps you could show the output of route as well.
    – Lok.K.
    Aug 1, 2016 at 10:02
0

Your laptop and desktop are on two different subnets 192.168.0.x and 192.168.17.x.

Does your router create the two different subnets? If so maybe you need to add some firewall rules in there to allow the traffic between the two.

What router are they connected to?

2
  • I am sorry if my answer is not adequate, but I do not know much about networking. I have CISCO router, EPC3925 and there are plenty of other numbers... Also, in IPV4 is DHCP method selected. I am not sure what else would be relevant :/ Default route: 192.168.0.1 (Desktop) Aug 1, 2016 at 6:30
  • Default route: 192.168.0.1 (Desktop) Default route:192.168.17.2 (Laptop) Aug 1, 2016 at 6:37
0

Firstly, I would like to thank you all for your help.

You were all right, but I forgot to mention one important thing. Ubuntu was installed under virtual machine. The laptop had the correct ip address, but VM had its own dhcp. Simple click under settings of virtual machine, and everything works like a charm. Thank you again!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .