cancel
Showing results for 
Search instead for 
Did you mean: 

ssh: connect to host xx.xx.xx.xx port 22: Connection timed out error on Ubuntu Terminal

Eavci
Associate II

On the host computer, i try to connect the terminal to the STM32MP157F-EV1 board using ssh with Ethernet cable but I can't access 

I use STM32MP157F-EV1 board. I set manually the IP adress of board with

Board $> ifconfig eth0 uuu.***.yyy.zzz

then I try connect ssh root of board with this command on my Terminal:

ssh root@xx.xx.xx.xx

and then I get

ssh: connect to host xx.xx.xx.xx port 22: Connection timed out error.

 How i can fix this issue. Can anyone help me?

Kind regards

8 REPLIES 8
Kevin HUBER
ST Employee

Hello @Emre Avcı​ ,

You have this two pages on the wiki:

But I think that you already seen them.

Normally you have this kind of error:

$ ssh root@192.168.7.1

ssh: connect to host 192.168.7.1 port 22: Connection refused

If you are trying to connect to an non existing ip.

To help you, please can I have the complete traces of the command "ifconfig" on your board

and the command "ifconfig" or "ip address" of your Ubuntu PC.

Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello

I have already reviewed two pages the two pages you have sent.

If I explain step by step what I did:

Firstly command "ifconfig" on my board:

0693W00000NpnPJQAZ.png 

Ifconfig responds eth0 that has not IP adress. Therefore I set manually IP adress this command and type ifconfig again:

0693W00000NpnPsQAJ.png 

Finally on my host computer, I want to connect the terminal to the board using ssh:

0693W00000NpnQHQAZ.png 

I take ssh: connect to host 192.168.72.1 port 22: Connection timed out error

The command ifconfig on my Ubuntu PC

0693W00000NpnQrQAJ.png 

Thanks

Regards

Hi @Emre Avcı​ 

do you have an IP route between your Ubuntu station and your STM32MP board?

Run the command from your Ubuntu station:

ping 192.168.172.1

or to get defined IP routes

ip route

If you can't reach your STM32MP board, that means you have no defined IP route and you need to create one with the command

ip route add

Best regards,

--JM

Kevin HUBER
ST Employee

Hello @Emre Avcı​ ,

From what I see with your screenshot, you don't have a subnet shared between your board and your PC so you can't communicate between them.

For example, on my PC with my DK2 plugged via usb0 (ethernet):

0693W00000NppfYQAR.pngThe IP of the board is 192.168.7.1

and on my PC Ubuntu:

0693W00000NppfnQAB.pngMy IP is 192.168.7.162

The subnet of my PC and my board is : 192.168.7

So they are able to communicate together:

$ ping 192.168.7.1
PING 192.168.7.1 (192.168.7.1) 56(84) bytes of data.
64 bytes from 192.168.7.1: icmp_seq=1 ttl=64 time=977 ms
64 bytes from 192.168.7.1: icmp_seq=2 ttl=64 time=0.888 ms
64 bytes from 192.168.7.1: icmp_seq=3 ttl=64 time=2.07 ms
^C
--- 192.168.7.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.888/326.706/977.157/459.938 ms

Please read some pages on internet about how the subnet works, it will help you to understand this behavior.

-----------

On your first screenshot, you have an interface usb0 with an ip 192.168.7.1, but on the PC, you do not have this new interface. Is it normal?

And do you really need to access by SSH with the port ethernet? Or can you use the usb0 interface?

Regards,

Kevin

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi,

I don't understand what do you mean " but on the PC, you do not have this new interface. 

Is it normal?"

With usb0, PC and board communicate each other. When I do ping test:

$ ping 192.168.7.1
PING 192.168.7.1 (192.168.7.1) 56(84) bytes of data.
64 bytes from 192.168.7.1: icmp_seq=1 ttl=63 time=1.09 ms
64 bytes from 192.168.7.1: icmp_seq=2 ttl=63 time=1.42 ms
64 bytes from 192.168.7.1: icmp_seq=3 ttl=63 time=1.82 ms
64 bytes from 192.168.7.1: icmp_seq=4 ttl=63 time=1.56 ms
^C
--- 192.168.7.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3068ms
rtt min/avg/max/mdev = 1.089/1.471/1.819/0.263 ms

But I want to that board and PC communicate each other by SSH with ethernet cable.

And what is usb0? Which interface does usb0 use such as ST-Link or UART? There are two connections between my baord and PC: ST-Link and USB-OTG as USB and Etheret cable.

Regards

Hi

I tried this command as

$ sudo ip route add 192.168.72.0 via 192.168.72.1

but still there is no connection between Pc and Board.

I configure eth0 as Static IP Adress:

$root@stm32mp1:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:80:E1:01:67:2D  
          inet addr:192.168.72.2  Bcast:192.168.72.255  Mask:255.255.255.0
          inet6 addr: fe80::280:e1ff:fe01:672d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1620 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2610 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:193382 (188.8 KiB)  TX bytes:203224 (198.4 KiB)
          Interrupt:60 
 
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:1648 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1648 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:142408 (139.0 KiB)  TX bytes:142408 (139.0 KiB)
 
usb0      Link encap:Ethernet  HWaddr 2A:61:B8:CB:7D:AC  
          inet addr:192.168.7.1  Bcast:192.168.7.255  Mask:255.255.255.0
          inet6 addr: fe80::2861:b8ff:fecb:7dac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7226 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1631 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1004585 (981.0 KiB)  TX bytes:415025 (405.2 KiB)

And I configure my Host PC IP Adress as Static IP Adress:

0693W00000NpsRtQAJ.png 

When I do ping test

$ ping 192.168.72.2
PING 192.168.72.2 (192.168.72.2) 56(84) bytes of data.
From 192.168.72.0 icmp_seq=1 Destination Host Unreachable
From 192.168.72.0 icmp_seq=2 Destination Host Unreachable
From 192.168.72.0 icmp_seq=3 Destination Host Unreachable
From 192.168.72.0 icmp_seq=4 Destination Host Unreachable
From 192.168.72.0 icmp_seq=5 Destination Host Unreachable
From 192.168.72.0 icmp_seq=6 Destination Host Unreachable
From 192.168.72.0 icmp_seq=7 Destination Host Unreachable
From 192.168.72.0 icmp_seq=8 Destination Host Unreachable
From 192.168.72.0 icmp_seq=9 Destination Host Unreachable
^C
--- 192.168.72.2 ping statistics ---
12 packets transmitted, 0 received, +9 errors, 100% packet loss, time 11273ms
pipe 3

I get the Destination Host Unreachable error.

And when I try to connect the terminal to the board using ssh:

0693W00000NpsOaQAJ.png I get the error: No route to host

command IP route on my host Ubuntu PC:

$ ip route
default via 192.168.72.1 dev enp0s3 proto static metric 20100 
169.254.0.0/16 dev enp0s3 scope link metric 1000 
192.168.72.0 via 192.168.72.1 dev enp0s3 
192.168.72.0/24 dev enp0s3 proto kernel scope link src 192.168.72.0 metric 100

Regards

Hello @Emre Avcı​ 

I am not an expert in IP route management but it seems to me your problem is related to this topic.

When adding your IP route, could you add all your network i.e.

$ sudo ip route add 192.168.72.0/24 via 192.168.72.1

Best regards

--JM

Eavci
Associate II

Hi

I solved this problem.

First I set Board IP as statice ip:

root@stm32mp1:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:80:E1:01:67:2D  
          inet addr:192.168.72.2  Bcast:192.168.72.255  Mask:255.255.255.0
          inet6 addr: fe80::280:e1ff:fe01:672d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3954 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1479 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:389397 (380.2 KiB)  TX bytes:110373 (107.7 KiB)
          Interrupt:60 
 
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:970 errors:0 dropped:0 overruns:0 frame:0
          TX packets:970 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:81460 (79.5 KiB)  TX bytes:81460 (79.5 KiB)
 
usb0      Link encap:Ethernet  HWaddr B2:7C:6A:40:F8:35  
          inet addr:192.168.7.1  Bcast:192.168.7.255  Mask:255.255.255.0
          inet6 addr: fe80::b07c:6aff:fe40:f835/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2927 errors:0 dropped:0 overruns:0 frame:0
          TX packets:356 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:319747 (312.2 KiB)  TX bytes:77331 (75.5 KiB)
 

And second plug USB-OTG cable to my computer and board and I enabled it in the devices tab in VirtualBox and disable and enable the connect network adapter tab in VirtualBox.

But I don't understand this issue:

First I give power my STM32MP157F-EV1 Board and ping test with ethernet cable:

ping 192.168.72.2
PING 192.168.72.2 (192.168.72.2) 56(84) bytes of data.
^C
--- 192.168.72.2 ping statistics ---
42 packets transmitted, 0 received, 100% packet loss, time 42019ms

I don't receive any package in ping test. In this situation, when I connect USB-OTG cable and ping test again while ethernet cable is connected:

~$ ping 192.168.72.2
PING 192.168.72.2 (192.168.72.2) 56(84) bytes of data.
64 bytes from 192.168.72.2: icmp_seq=1 ttl=64 time=3.33 ms
64 bytes from 192.168.72.2: icmp_seq=2 ttl=64 time=10.4 ms
64 bytes from 192.168.72.2: icmp_seq=3 ttl=64 time=18.1 ms
64 bytes from 192.168.72.2: icmp_seq=4 ttl=64 time=21.8 ms
64 bytes from 192.168.72.2: icmp_seq=5 ttl=64 time=16.5 ms
^C
--- 192.168.72.2 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4039ms
rtt min/avg/max/mdev = 3.327/14.015/21.812/6.487 ms

Ping test is doing successfully. And take out ethernet cable and ping test again while USB-OTG cable is connected:

~$ ping 192.168.72.2
PING 192.168.72.2 (192.168.72.2) 56(84) bytes of data.
^C
--- 192.168.72.2 ping statistics ---
33 packets transmitted, 0 received, 100% packet loss, time 32789ms

The ping test is not performing successfully. Plug ethernet cable again and ping test:

$ ping 192.168.72.2
PING 192.168.72.2 (192.168.72.2) 56(84) bytes of data.
64 bytes from 192.168.72.2: icmp_seq=1 ttl=64 time=12.1 ms
64 bytes from 192.168.72.2: icmp_seq=2 ttl=64 time=20.6 ms
64 bytes from 192.168.72.2: icmp_seq=3 ttl=64 time=10.8 ms
64 bytes from 192.168.72.2: icmp_seq=4 ttl=64 time=3.94 ms
64 bytes from 192.168.72.2: icmp_seq=5 ttl=64 time=6.42 ms
64 bytes from 192.168.72.2: icmp_seq=6 ttl=64 time=7.98 ms
^C
--- 192.168.72.2 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5017ms
rtt min/avg/max/mdev = 3.936/10.294/20.600/5.328 ms

Take out USB-OTG and ping test with ethernet cable:

~$ ping 192.168.72.2
PING 192.168.72.2 (192.168.72.2) 56(84) bytes of data.
^C
--- 192.168.72.2 ping statistics ---
58 packets transmitted, 0 received, 100% packet loss, time 58660ms

The ping test is not performing successfully. I take out ethernet cable and plug again

when USB-OTG cable disconnect:

~$ ping 192.168.72.2
PING 192.168.72.2 (192.168.72.2) 56(84) bytes of data.
^C
--- 192.168.72.2 ping statistics ---
22 packets transmitted, 0 received, 100% packet loss, time 21621ms

The ping test is not performing successfully.

The thing I'm wondering about is:

Is necessary USB-OTG connection to between Board and PC for ethernet connection with ethernet cable (eth0) and why it is necessary?

Regards