Ping static IP C2 but can't SSH

Post Reply
itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Ping static IP C2 but can't SSH

Unread post by itcoil » Wed Aug 07, 2019 11:39 am

With a direct ethernet connection to my C2 from a Pi I can successfully ping my C2 at its static IP address of 192.168.5.2, but if I try to SSH I get:

ssh: connect to host 192.168.5.2 port 22: Connection refused

I do not have the Pi connected to a wi-fi network, just a direct connection to the C2. As a note, the Pi has a static IP of 192.168.5.1

On the C2 I've got /etc/network/interfaces.d/eth0 as:

auto eth0
iface eth0 inet static
address 192.168.5.2
netmask 255.255.255.0
network 192.168.5.0

and on the Pi I've got /etc/network/interfaces.d/eth0 as:

auto eth0
iface eth0 inet static
address 192.168.5.1
netmask 255.255.255.0
network 192.168.5.0

I was not having a problem doing this previously with the exact same C2 and I haven't changed anything, but obviously something I am not aware of has changed on its own.

User avatar
odroid
Site Admin
Posts: 32130
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 119 times
Been thanked: 292 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by odroid » Wed Aug 07, 2019 11:51 am

Which OS image do you run on the C2?

User avatar
tobetter
Posts: 3903
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 38 times
Been thanked: 154 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by tobetter » Wed Aug 07, 2019 11:52 am

itcoil wrote:
Wed Aug 07, 2019 11:39 am
With a direct ethernet connection to my C2 from a Pi I can successfully ping my C2 at its static IP address of 192.168.5.2, but if I try to SSH I get:

ssh: connect to host 192.168.5.2 port 22: Connection refused

I do not have the Pi connected to a wi-fi network, just a direct connection to the C2. As a note, the Pi has a static IP of 192.168.5.1

On the C2 I've got /etc/network/interfaces.d/eth0 as:

auto eth0
iface eth0 inet static
address 192.168.5.2
netmask 255.255.255.0
network 192.168.5.0

and on the Pi I've got /etc/network/interfaces.d/eth0 as:

auto eth0
iface eth0 inet static
address 192.168.5.1
netmask 255.255.255.0
network 192.168.5.0

I was not having a problem doing this previously with the exact same C2 and I haven't changed anything, but obviously something I am not aware of has changed on its own.
I guess it's not the network issue if ping works between C2 and Pi. Can you check if port 22 on C2 is available and /etc/ssh_config if ssh service allows to external access? You also could try out sshing C2 itself.

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Wed Aug 07, 2019 1:16 pm

Ubuntu 16.04.2 LTS (GNU/Linux 3.14.65-rt68+ aarch64)

What would be the best way to check if port 22 is available in my case with ping successful but SSH being 'Connection refused'?

Thank you

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Wed Aug 07, 2019 4:57 pm

Ideally with netstat -tpan | grep LISTEN on the C2 itself. Also check that ssh is running and see if iptables has any rules iptables -L -n -v

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Thu Aug 08, 2019 12:17 am

Here are some more details:

The only way I can get into my C2 is when I connect the C2 directly to my router and ssh from another computer connected to that router like this:

homesys$ ssh odroid@underdog.local

Then I did the following:

odroid:[~]$ netstat -tpan | grep LISTEN
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -

As a note, on the C2 etc/hosts is:

127.0.0.1 localhost
127.0.0.1 underdog
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

and etc/hostname is:

underdog

Once I am in I get the following, which makes sense since I've got a static ip of 192.168.5.2 set for the C2 as detailed above:

odroid:[~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1e:06:35:85:fe
inet addr:192.168.5.2 Bcast:192.168.5.255 Mask:255.255.255.0
inet6 addr: fe80::21e:6ff:fe35:85fe/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:105 errors:0 dropped:0 overruns:0 frame:0
TX packets:101 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15250 (15.2 KB) TX bytes:18791 (18.7 KB)
Interrupt:40

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:4096 Metric:1
RX packets:162 errors:0 dropped:0 overruns:0 frame:0
TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11938 (11.9 KB) TX bytes:11938 (11.9 KB)

However, if I then terminate the session and ping 192.168.5.2 it is unsuccessful. Also, I can't ssh using ssh odroid@192.168.5.2. My only way in is ssh odroid@underdog.local.

What I'm really looking for is how to set this up so that I do not have to connect the C2 to the router in order to ssh into it and also so I can use its static ip address. In other words, I want to connect an ethernet cable directly to the C2 from a Pi and get into the C2 with ssh odroid@192.168.5.2 like I had been successfully doing previously before something changed that I am not aware of. All settings above are just as they were before but now unfortunately my only way in is through the router.

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Thu Aug 08, 2019 1:27 am

What ip is returned when you ping underdog.local?
It should work with a direct cable connection too, provided that the PC you're connecting from doesn't have a second network interface connected to abdifferent network using the same address space.
Can you also check on the PC and maybe C2 (with monitor and keyboard) the link status of the eth port? ethtool eth0

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Thu Aug 08, 2019 11:27 pm

When I connect the C2 to my router and ssh odroid@underdog.local from another computer connected to the router it is successful. Then an ifconfig shows eth0 as 192.168.5.2 as it should because that is the static ip of the C2. If I then terminate the session and ping underdog.local it returns 192.168.5.2 but the ping is unsuccessful. It just returns Request timeout for icmp_seq. Also, I can never ssh odroid@192.168.5.2. That always returns port 22:connection refused.

Another detail is that if I then disconnect from the router and connect directly to the Pi (which has wi-fi turned off) I am able to successfully ssh odroid@underdog.local but not ssh odroid@192.168.5.2, just like when the C2 is connected to the router. However, if I then reboot the Pi and the C2 with their direct connection intact I can no longer successfully ssh odroid@undderdog.local. It results in port 22:connection refused.

So the bottom line is that my only option for direct connection ssh is to connect and disconnect the C2 to a router first and then connect it to the Pi and then ssh odroid@underdog.local. Something must be getting properly resolved in the C2 by connecting to a router first, but I don't know what steps would solve that.

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Fri Aug 09, 2019 2:09 am

Very strange. You should be able to reconnect to ssh both by name and ip multiple times. I suspect something happens to ssh/network once you exit the first time.
Connect to the c2 via keyboard & hdmi and issue these commands before and after the problem happens:

Code: Select all

ifconfig eth0
ethtool eth0 | grep -i link
netstat -tpan | grep 22
service sshd status

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Sun Aug 25, 2019 2:22 am

USB and HDMI are disabled on my C2 because that processing is needed for its main purpose, so in order to connect to it to issue those commands I need to get the USB/UART module kit from Hardkernel and connect via serial connection. I will do that but I am hoping there is another way to try to solve this in the meantime. I am unfamiliar with the SSH and SSHD files on the C2 but is there something I can look for in there when I am successfully connected to the C2 by SSH when it is connected to the router? Is it possible that there is an indicator in there of what is going wrong when I try to connect directly to the C2 instead of through the router?

Or since I can ping 192.168.5.2 but not SSH are there any other commands I can send in that situation to detect why port 22 is refusing the connection?

One additional note is that I had previously done the following so I could SSH into the C2 from my MacBook without having to enter a password when the C2 was connected to the router: https://www.shellhacks.com/ssh-login-without-password/
Could something in that process have lead to this problem? I can still SSH into the C2 without a password from that Macbook when the C2 is connected to the router.

And I have discovered that after initially being able to successfully ping 192.168.5.2 I eventually can't even do that anymore. I eventually get 'Destination Host Unreachable'. At that point 'arp' returns nothing for HWtype and '(incomplete)' for HWaddress whereas it was previously returning 'ether' for HWtype and 00:1e:06:36:b9:64 for HWaddress. Seems that something is changing on its own after a few minutes of booting the Pi and C2 and initially pinging the C2 at 192.168.5.2.

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Sun Aug 25, 2019 1:46 pm

Ok, since it works when you connect the first time, try this. Create a script in your home dir with the following contents (run all commands as root):

Code: Select all

#!/bin/bash
date
ifconfig eth0
arp -an
ethtool eth0 | grep -i link
netstat -tpan | grep 22
service sshd status
dmesg
ping -c 4 8.8.8.8
ping -c 4 www.google.com
iptables -L -n -v
timeut 5 ssh -vvv localhost
timeout 30 tcpdump -nn -i eth0 -c 200
echo Done
sync
Give it the name debug.sh. Install screen (apt-get install screen) and do the following.
1. Connect the first time when it works via ssh and run these commands:

Code: Select all

chmod a+x debug.sh
screen -R -D
sleep 120; bash -x debug.sh 2>&1 | tee -a debug.log; poweroff

2. Disconnect from ssh and try to reproduce the problem for 3 minutes. It should collect relevant data in /root/debug.log

You can try to run it without disconnecting too so that you can check the commands work.

Having keys for ssh shouldn't matter

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Mon Aug 26, 2019 4:45 am

Thank you for that info. Something to note is that the only thing that works when I first power up the Pi and C2 and they are connected by ethernet is the ping but not the ssh. I can ping the C2 at 192.168.5.2 but I can't ssh odroid@192.168.5.2. Then after a short time I can't even ping anymore.

I can however successfully ssh odroid@underdog.local from my MacBook if I boot the C2 when it's connected to my router. Then ifconfig shows 192.168.5.2 as the inet addr. I can then disconnect the C2 from the router and connect to the Pi and successfully ssh odroid@192.168.5.2. Then from there I can disconnect and connect as often as I'd like.

Seems like something about connecting to the router resolves the C2 to 192.168.5.2 and there's no other way. Other than that it is unreachable except by pinging.

Could the C2 somehow be resolving only to an inet6 addr and not to its static ip of 192.168.5.2 if it isn't connected to the router first? Would that keep the Pi from getting into it?

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Mon Aug 26, 2019 8:10 pm

Let's see some output. You can run the script via cron @reboot and connect it to reproduce the issue. Add a sleep 30 before the commands to wait for network to stabilize.

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Sat Aug 31, 2019 9:35 am

Sorry I don't understand in what order I should try the above steps. In order to issue the @reboot command I will need to be successfully logged into the C2 while it's connected to the router, but unfortunately the problem occurs only when the C2 boots connected directly to the Pi, not the router. Should I pull the ethernet cable and connect it to the Pi immediately after issuing the @reboot command? Where does the sleep 30 come into play?

And how will I issue:

chmod a+x debug.sh
screen -R -D
sleep 120; bash -x debug.sh 2>&1 | tee -a debug.log; poweroff

if I am not logged into the C2?

The only way to reproduce the problem is to boot the C2 while connected to the Pi, or to boot the C2 not connected to anything and then connect it to the Pi.

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Sat Aug 31, 2019 1:10 pm

I was referring to this: https://www.a2hosting.com/kb/developer- ... ver-reboot
It should run the script automatically after boot without user intervention.
Just add a sleep 30 in the script beginning so that the system has time to fully start.

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Sun Sep 01, 2019 11:10 pm

I got your PM. You can remove private information from the output - what you were seeing were not private ssh keys (too small for that), but some hashes of some sort - anyway, irrelevant for the problem.

I did find strange things based on your output.

1. ethtool: command not found - you can fix this with sudo apt-get install ethtool

2. ifconfig shows the correct ip, however:

Code: Select all

+ arp -an

? (10.0.1.103) at 20:c9:d0:c3:aa:19 [ether] on eth0

? (10.0.1.1) at 0c:51:01:e2:fb:9a [ether] on eth0
arp has entries only for hosts in the 10.x.y.z network. There should have been entries for hosts in 192.168.x.y as well.
3. tcpdump shows traffic happening on 10.x.y.z. Your odroid probably still has ip .133:

Code: Select all

18:27:53.601327 IP 10.0.1.133.22 > 10.0.1.103.50160: Flags [P.], seq 1778298679:1778298799, ack 2650122820, win 385, options [nop,nop,TS val 46570 ecr 684054073], length 120

18:27:53.603493 IP 10.0.1.103.50160 > 10.0.1.133.22: Flags [.], ack 120, win 4092, options [nop,nop,TS val 684054136 ecr 46570], length 0

Please edit the script and add:
1. ping -c 4 192.168.5.1 before the arp -an line
2. ip addr show after ifconfig
3. if possible keep pinging your odroid on 192.168.5.2 from the other side

and recapture the output as before.

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Mon Sep 02, 2019 3:15 am

Thank you.
I attached a new (abbreviated) debug.log for you to examine. During this I was pinging 192.168.5.2 the whole time from another open session, after issuing:

sleep 120; bash -x debug.sh 2>&1 | tee -a debug.log; poweroff

As a note, my interfaces/interface.d/eth0 file is:

auto eth0
iface eth0 inet static
address 192.168.5.2
netmask 255.255.255.0
network 192.168.5.0
Attachments
debug3.txt
(12.38 KiB) Downloaded 6 times

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Mon Sep 02, 2019 3:28 am

Ok, as I suspected, eth0 has two ipv4 addresses:

Code: Select all

inet 192.168.5.2/24 brd 192.168.5.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.0.1.133/24 brd 10.0.1.255 scope global eth0
       valid_lft forever preferred_lft forever
But this time ssh seems to work over (public) ipv6 instead:

Code: Select all

17:28:16.126752 IP6 2605:e000:141d:5e8:22c9:d0ff:fec3:aa19.50448 > 2605:e000:141d:5e8:21e:6ff:fe35:85fe.22: Flags [.], ack 120, win 4092, options [nop,nop,TS val 766826924 ecr 4294952102], length 0
There is no reply for 192.168.5.1 and no arp... This would indicate that at that time the two hosts are not on the same layer two network, is this correct?

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Mon Sep 02, 2019 3:52 am

Probably not on the same layer two network. I could issue:
sudo ifconfig en0 192.168.5.10/24 up
on the MacBook for this in order to have them on the same subnet though if that would make a difference.

The goal of all of this would be to get the C2 to be seen by the Pi when it's connected directly to it. The Pi has a static ip of 192.168.5.1. I can only run our debug experiment with the C2 connected to the router though, not connected directly to the Pi.

Another interesting note is that I can turn on Wi-Fi on the Pi and then SSH to the C2 at 10.0.1.133 when the C2 is connected to the router. I'm hoping to get the C2 to resolve to 192.168.5.2 when it is booted and connected directly to any other machine. RIght now the C2 always needs the router and all that seems to do is get it to resolve to 10.0.1.133 and also maybe 192.168.5.2 but something still isn't right.

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Mon Sep 02, 2019 4:46 am

You probably have networkmanager still active. Try sudo nmcli conn show

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Mon Sep 02, 2019 4:56 am

I had to install network manager and reboot just now in order to issue that command.

Here's the result:

odroid:[~]$ sudo nmcli conn show
[sudo] password for odroid:
NAME UUID TYPE DEVICE
eth0 11f8a72a-6ce1-46f6-9818-03c61f6d2247 802-3-ethernet eth0
Wired connection 1 b69738a2-6b6f-3f6c-9cf7-696ab214bfad 802-3-ethernet --

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Mon Sep 02, 2019 5:38 am

Ok, let's try to gather the info by connecting the c2 directly to the pi. Add this to the crontab

Code: Select all

# crontab -e
@reboot /path/to/debug.sh
Put the correct path/name for the script.
Save, poweroff the c2, plug network into the pi, start a ping from the pi, apply power to the c2, wait ~5min, unplug it and collect its log to see what happened.

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Mon Sep 02, 2019 6:15 am

I already had @reboot ~/debug.sh in sudo crontab -e on the C2.

Does the script write to debug.log or is that done by these commands:

chmod a+x debug.sh
screen -R -D
sleep 120; bash -x debug.sh 2>&1 | tee -a debug.log; poweroff

Because I can only issue those commands on the C2 when I am successfully connected to it and that isn't possible from the Pi.

Should I put the script on the Pi and add @reboot /path/to/debug.sh to crontab on the Pi and then collect the log on the Pi?

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Mon Sep 02, 2019 1:52 pm

Oh, I forgot it had external logging.
One thing to remember is that cron doesn't know your environment, so ~ will not be what you expect. It's always best to use full paths with cron.
Assuming that the script is stored in /root, try:
@reboot /root/debug.sh > /root/debug.log 2>&1

You can do it on the pi as well...

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Mon Sep 02, 2019 5:41 pm

I started a ping from the Pi and powered up the C2, and attached is the (abbreviated) debug.log.
Attachments
debug_to_Pi.4.log
(2.3 KiB) Downloaded 6 times

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Mon Sep 02, 2019 6:08 pm

Ok, try this modified script - it seems the commands can't be found because of missing paths in cron. Try this modified script:

Code: Select all

#!/bin/bash -x
date
/sbin/ifconfig eth0
/usr/sbin/arp -an
/sbin/ethtool eth0 | grep -i link
/bin/netstat -tpan | grep 22
/usr/sbin/service sshd status
/bin/dmesg
ping -c 4 8.8.8.8
ping -c 4 www.google.com
/sbin/iptables -L -n -v
/usr/bin/timeout 5 /usr/bin/ssh -vvv localhost
/usr/bin/timeout 30 /usr/sbin/tcpdump -nn -i eth0 -c 200
echo Done
sync

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Mon Sep 02, 2019 6:28 pm

Okay it looks like that script produced better results. Maybe from this you can tell why I can ping but I cannot SSH:
Attachments
debug_to_Pi.5.log
(11.16 KiB) Downloaded 9 times

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Tue Sep 03, 2019 1:29 am

Ok, this time I can see that sshd is dead when the script runs. It may be that the dcript runs too early and sshd hasn't had a chance to start yet... Mind adding a sleep 30 at script start (before the date command)?

Code: Select all

+ /usr/sbin/service sshd status
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
It may be that the network target hasn't been reached and sshd needs it before starting...

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Tue Sep 03, 2019 1:46 am

Here's the new output with the Sleep 30 added. Looks like same result however:
Attachments
debug_to_Pi6.log
(8.23 KiB) Downloaded 4 times

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Tue Sep 03, 2019 1:51 am

I have noticed that pings from the Pi to the C2 become successful about 25-30 seconds after I power up the C2. Does that info help?

I will try now with sleep 40

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Tue Sep 03, 2019 2:28 am

And here it is with sleep 40. Maybe sshd is always dead?? (unless I connect to router)
Attachments
debug_to_PI.7.log
(9.06 KiB) Downloaded 6 times

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Tue Sep 03, 2019 3:29 am

Ok, the problem is eth0 still tries to get an address via dhcp (and probably can't):

Code: Select all

17:17:24.773393 IP 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:1e:06:35:85:fe, length 300
And this keeps network target out of reach...
Let's see who wants dhcp.

Code: Select all

ls -lR /etc/network/interfaces*
ls -lR /etc/netplan/
cat /etc/network/interfaces*
cat /etc/netplan/*
sudo service systemd-networkd status        
You can run those when connected to the router, the answers should be relevant.

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Tue Sep 03, 2019 3:39 am

Here are those results:

Code: Select all

odroid:[~]$ ls -lR /etc/network/interfaces*
-rw-r--r-- 1 root root  252 Sep 10  2018 /etc/network/interfaces
-rw-r--r-- 1 root root  246 Sep  3  2018 /etc/network/interfaces~
-rw-r--r-- 1 root root  142 Jun 30  2018 /etc/network/interfacesOG

/etc/network/interfaces.d:
total 8.0K
-rw-r--r-- 1 root root 116 Sep 10  2018 eth0
-rw-r--r-- 1 root root  31 Aug  3  2016 eth0net

Code: Select all

odroid:[~]$ ls -lR /etc/netplan/
ls: cannot access '/etc/netplan/': No such file or directory

Code: Select all

odroid:[~]$ cat /etc/network/interfaces*
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

#auto lo
#iface lo inet loopback

#auto eth0
#iface eth0 inet static
#address 10.0.1.8
#netmask 255.255.255.0# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.0.1.8
netmask 255.255.255.0cat: /etc/network/interfaces.d: Is a directory
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

Code: Select all

odroid:[~]$ cat /etc/netplan/*
cat: '/etc/netplan/*': No such file or directory

Code: Select all

odroid:[~]$ sudo service systemd-networkd status
[sudo] password for odroid: 
● systemd-networkd.service - Network Service
   Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; vendo
   Active: inactive (dead)
     Docs: man:systemd-networkd.service(8)

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Tue Sep 03, 2019 3:43 am

And as a note here is my eth0 file which I just cut and pasted from /etc/network/interfaces.d/:

auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.5.2
netmask 255.255.255.0
network 192.168.5.0

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Tue Sep 03, 2019 5:20 am

And my interfaces file in /etc/network/ is:

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

#auto lo
#iface lo inet loopback

#auto eth0
#iface eth0 inet static
#address 10.0.1.8
#netmask 255.255.255.0

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Tue Sep 03, 2019 3:22 pm

Yet from a previous paste I can see this too:

Code: Select all

auto eth0
iface eth0 inet static
address 10.0.1.8
netmask 255.255.255.0
Can you find where it's set and comment it out?

What about the output to

Code: Select all

sudo service NetworkManager status
?

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Tue Sep 03, 2019 3:42 pm

I think you saw that in a previous paste because:

cat /etc/network/interfaces*

shows the contents of all files in /etc/network/ that have the word interfaces in their title, and I've got a file called interfaces~ in that directory which is a different version of interfaces. I would expect that file not to execute however because of the ~ at the end of it's name. Please let me know if that is not the case and I will remove the interfaces~ file.

Here is the result of:

sudo service NetworkManager status

Code: Select all

● NetworkManager.service - Network Manager
   Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-09-02 20:50:46 UTC; 9h ago
     Docs: man:NetworkManager(8)
 Main PID: 467 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─467 /usr/sbin/NetworkManager --no-daemon

Sep 02 20:50:46 underdog NetworkManager[467]: <info>  [1567457446.4957] device (eth0): state change: ip-check -> secondaries (reason 'none') [80 90 0]
Sep 02 20:50:46 underdog NetworkManager[467]: <info>  [1567457446.4978] ofono is now available
Sep 02 20:50:46 underdog NetworkManager[467]: <info>  [1567457446.4985] device (eth0): state change: secondaries -> activated (reason 'none') [90 100 0]
Sep 02 20:50:46 underdog NetworkManager[467]: <info>  [1567457446.5071] device (eth0): Activation: successful, device activated.
Sep 02 20:50:46 underdog NetworkManager[467]: <warn>  [1567457446.5098] failed to enumerate oFono devices: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.ofono was not provided by any .service files
Sep 02 20:50:48 underdog NetworkManager[467]: <info>  [1567457448.0508] device (eth0): link connected
Sep 02 20:50:48 underdog NetworkManager[467]: <info>  [1567457448.3229] policy: set 'eth0' (eth0) as default for IPv4 routing and DNS
Sep 02 20:50:49 underdog NetworkManager[467]: <info>  [1567457449.4689] policy: set 'eth0' (eth0) as default for IPv6 routing and DNS
Sep 02 20:50:55 underdog NetworkManager[467]: <info>  [1567457455.3835] manager: WiFi hardware radio set enabled
Sep 02 20:50:55 underdog NetworkManager[467]: <info>  [1567457455.3836] manager: WWAN hardware radio set enabled

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Tue Sep 03, 2019 4:10 pm

Yes, you're right.
Ok, looks like Network Manager tries to set DHCP for eth0. You can mark eth as unmanaged in NetworkManager like so: https://askubuntu.com/questions/21914/h ... eless-card

Give it a try, and reboot in the pi-odroid configuration and see how it goes.

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Tue Sep 03, 2019 6:32 pm

Perhaps that has made a difference. Now I can SSH from Pi into C2, but not until about a full 4 minutes have passed after they are both booted. I can still ping the C2 during that time but SSH gives me a 'port 22:connection refused'.

Maybe this has been the case all along, but I doubt it.

Here is a -vvv of the SSH when it is unsuccessful and then when it becomes successful, from one attempt to the next.

Code: Select all

pi@raspberrypi:~ $ ssh -vvv odroid@192.168.5.2
OpenSSH_7.9p1 Raspbian-10, OpenSSL 1.1.1c  28 May 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.5.2 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.5.2 [192.168.5.2] port 22.
debug1: connect to address 192.168.5.2 port 22: Connection refused
ssh: connect to host 192.168.5.2 port 22: Connection refused

pi@raspberrypi:~ $ ssh -vvv odroid@192.168.5.2
OpenSSH_7.9p1 Raspbian-10, OpenSSL 1.1.1c  28 May 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.5.2 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.5.2 [192.168.5.2] port 22.
debug1: Connection established.
debug1: identity file /home/pi/.ssh/id_rsa type 0
debug1: identity file /home/pi/.ssh/id_rsa-cert type -1
debug1: identity file /home/pi/.ssh/id_dsa type -1
debug1: identity file /home/pi/.ssh/id_dsa-cert type -1
debug1: identity file /home/pi/.ssh/id_ecdsa type -1
debug1: identity file /home/pi/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/pi/.ssh/id_ed25519 type -1
debug1: identity file /home/pi/.ssh/id_ed25519-cert type -1
debug1: identity file /home/pi/.ssh/id_xmss type -1
debug1: identity file /home/pi/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Raspbian-10
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.8 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.5.2:22 as 'odroid'
debug3: hostkeys_foreach: reading file "/home/pi/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/pi/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 192.168.5.2
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos: 
debug2: languages stoc: 
debug2: first_kex_follows 0 
debug2: reserved 0 
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:t+rDPxRKhY3f6FL0N3ij4F66+MbXeqqAXlwXfYluv6k
debug3: hostkeys_foreach: reading file "/home/pi/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/pi/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 192.168.5.2
debug1: Host '192.168.5.2' is known and matches the ECDSA host key.
debug1: Found key in /home/pi/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /home/pi/.ssh/id_rsa RSA SHA256:vHqdxysRGRrLWO4e020YyquGwAd1e2mVrD3lf+4oCmw
debug1: Will attempt key: /home/pi/.ssh/id_dsa 
debug1: Will attempt key: /home/pi/.ssh/id_ecdsa 
debug1: Will attempt key: /home/pi/.ssh/id_ed25519 
debug1: Will attempt key: /home/pi/.ssh/id_xmss 
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/pi/.ssh/id_rsa RSA SHA256:vHqdxysRGRrLWO4e020YyquGwAd1e2mVrD3lf+4oCmw
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/pi/.ssh/id_dsa
debug3: no such identity: /home/pi/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/pi/.ssh/id_ecdsa
debug3: no such identity: /home/pi/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/pi/.ssh/id_ed25519
debug3: no such identity: /home/pi/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/pi/.ssh/id_xmss
debug3: no such identity: /home/pi/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
odroid@192.168.5.2's password: 
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).
Authenticated to 192.168.5.2 ([192.168.5.2]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env SHELL
debug3: Ignored env COLORTERM
debug3: Ignored env XDG_CONFIG_DIRS
debug3: Ignored env XDG_SESSION_PATH
debug3: Ignored env XDG_MENU_PREFIX
debug3: Ignored env LANGUAGE
debug3: Ignored env _LXSESSION_PID
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env XDG_CONFIG_HOME
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env NO_AT_BRIDGE
debug3: Ignored env XDG_SEAT
debug3: Ignored env PWD
debug3: Ignored env XDG_SESSION_DESKTOP
debug3: Ignored env LOGNAME
debug3: Ignored env QT_QPA_PLATFORMTHEME
debug3: Ignored env XDG_SESSION_TYPE
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env XAUTHORITY
debug3: Ignored env XDG_GREETER_DATA_DIR
debug3: Ignored env HOME
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env LS_COLORS
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env VTE_VERSION
debug3: Ignored env XDG_SEAT_PATH
debug3: Ignored env NVM_DIR
debug3: Ignored env XDG_SESSION_CLASS
debug3: Ignored env TERM
debug3: Ignored env USER
debug3: Ignored env DISPLAY
debug3: Ignored env SHLVL
debug3: Ignored env NVM_CD_FLAGS
debug3: Ignored env XDG_VTNR
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env XDG_RUNTIME_DIR
debug1: Sending env LC_ALL = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env PATH
debug3: Ignored env GDMSESSION
debug3: Ignored env SAL_USE_VCLPLUGIN
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env NVM_BIN
debug3: Ignored env TEXTDOMAIN
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Welcome to Ubuntu 16.04.2

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
Last login: Tue Sep  3 07:44:02 2019 from 192.168.5.1

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Tue Sep 03, 2019 7:05 pm

It may be that (for whatever reason) networkmanager keeps waiting for the connection to get up. You should see a message over hdmi/serial.
This should help reduce that timeout: https://unix.stackexchange.com/question ... -systemctl

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Wed Sep 04, 2019 11:58 am

TimeoutStartSec=15 didn't have any effect.

Here is something I've noticed. When I connect USB-UART from C2 to PC and boot the C2 connected to the router the information that streams by in a PuTTY serial window gets to the login prompt in a normal amount of time, but when not connected to anything or connected directly to the Pi that information halts halfway through and sits there for about 5 minutes and then finishes up and gets to the login prompt. In any of those cases, I can only SSH into the C2 after that whole process is finished, whether it's 20 seconds or 5 minutes.

When it's the router case (20 seconds) I have to SSH to 10.0.1.20 and when it's directly to the Pi (5 minutes) I have to SSH to 192.168.5.2. Also, in the case with the Pi the SSH session drops after about 5-10 seconds and I am cutoff.

The lines showing in PuTTY when things get held up are sometimes like the following:
NOHZ: local_softirq_pending_pending 100
and sometimes like this:
EXT4-fs error (device mmcblk0p2): ext 4_mb_generate_buddy:756...block bitmap and bg descriptor inconsistent: 4686 vs 4685 free clusters....

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Wed Sep 04, 2019 2:41 pm

Are you still getting disconnected after disabling eth0 from NM? Are you unable to reconnect? Seems it's not disabled since you get an ip when connected to the router (and shouldn't have)...

Since you have a serial cable you can run the script manually, via serial. Please add also

Code: Select all

ip addr show
ps -ef | grep dhclient

The ext4 errors are unrelated, but it's best to run a fsck on it offline.

itcoil
Posts: 26
Joined: Tue Oct 18, 2016 3:04 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by itcoil » Sat Sep 07, 2019 8:14 am

The latest information on this issue is that I reflashed the img that I made of the C2 way back from when I started this thread and realized that with static IP's set on the Pi (192.168.5.1) and the C2 (192.168.5.2) that I can boot both SBC's while they are connected by ethernet and then SSH directly from the Pi to the C2 but only after about 5 minutes of waiting. If I watch the C2 via serial during that boot it hangs for about 5 minutes in the middle of it, like I described in the post above. As soon as the hang is over and the serial session gets to a login prompt I can SSH successfully from the Pi.

I can successfully ping the C2 from the Pi the whole time. I don't have to wait 5 minutes for that. I can't login to the C2 across serial. I just get strange characters no matter what I enter at the login prompt, and then after a few seconds the login prompt returns. Doesn't seem like I'd be able to run any scripts from there.

If I boot the C2 connected to the router it boots in 20 seconds and gets it's proper static IP. So, it seems to me that when the C2 is not connected to the router DHCP is trying to setup eth0 for 5 minutes and then gives up, at which time it becomes what it needs to be for me.

My question is, if that is the case, how can I get DHCP to ignore eth0 and thereby eliminate the 5 minute wait at boot? Or, what is causing the 5 minute wait and how can it be shortened? The previous suggestion using TimeoutStartSec didn't help. Since I'm back to the original img now Network Manager is not installed and I'd like to do this without it. I'd also like to not remove DHCP because I'd still like to be able to connect to the router sometimes by changing my eth0 file from static to DHCP when necessary.

User avatar
mad_ady
Posts: 6530
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 163 times
Been thanked: 125 times
Contact:

Re: Ping static IP C2 but can't SSH

Unread post by mad_ady » Sat Sep 07, 2019 1:58 pm

Try the suggestions from here: https://askubuntu.com/questions/837932/ ... untu-16-10

I know it worked for me a while ago.

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 1 guest