ssh Banana pi with mac [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
So I want to control my banana pi with my macbook pro using SSH. It is the first I am using ssh. So I followed a lot of different tutorials and it still does not work.
If I run :
pi#172.25.54.12
or
bananapi#172.25.54.12
or whatever name I try it answers me that
ssh: connect to host 172.25.*.*2 port 22: Operation timed out
and when I try
bananapi#localhost
or
pi#localhost
it answers me:
ssh: connect to host localhost port 22: Connection refused
I found my IP address doing ifconfig on my bananapi.
My bananapi is using bananian (debian for banana pi), and my mac is 10.10.3.
When I run sshd -T, I have:
port 22
protocol 2
addressfamily any
listenaddress 0.0.0.0:22
listenaddress [::]:22
usepam 1
serverkeybits 768
logingracetime 120
keyregenerationinterval 3600
x11displayoffset 10
maxauthtries 6
maxsessions 10
clientaliveinterval 0
clientalivecountmax 3
permitrootlogin yes
ignorerhosts yes
ignoreuserknownhosts no
rhostsrsaauthentication no
hostbasedauthentication no
hostbasedusesnamefrompacketonly no
rsaauthentication yes
pubkeyauthentication yes
kerberosauthentication no
kerberosorlocalpasswd yes
kerberosticketcleanup yes
gssapiauthentication no
gssapikeyexchange no
gssapicleanupcredentials yes
gssapistrictacceptorcheck yes
gssapistorecredentialsonrekey no
passwordauthentication yes
kbdinteractiveauthentication no
challengeresponseauthentication no
printmotd no
printlastlog yes
x11forwarding yes
x11uselocalhost yes
strictmodes yes
tcpkeepalive yes
permitblacklistedkeys no
permitemptypasswords no
permituserenvironment no
uselogin no
compression delayed
gatewayports no
usedns no
allowtcpforwarding yes
useprivilegeseparation yes
pidfile /var/run/sshd.pid
xauthlocation /usr/bin/xauth
ciphers aes256-ctr,aes128-ctr
macs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
loglevel INFO
syslogfacility AUTH
authorizedkeysfile .ssh/authorized_keys .ssh/authorized_keys2
hostkey /etc/ssh/ssh_host_rsa_key
acceptenv LANG
acceptenv LC_*
subsystem sftp /usr/lib/openssh/sftp-server
maxstartups 10:30:100
permittunnel no
ipqos lowdelay throughput
permitopen any
Any idea?
edit:
so as suggested in the comments, I did a :
$ ls -al ~/.ssh
total 24 drwx------ 5 ***************** staff 170 12 mai 13:27 .
drwxr-xr-x 53 **************** staff 1802 12 mai 11:16 ..
-rw------- 1 ***************** staff 1766 12 mai 11:16 authorized_keys
-rw------- 1 ***************** staff 1679 12 mai 13:27 id_rsa
-rw-r--r-- 1 ***************** staff 429 12 mai 13:27 id_rsa.pub –
This is what I get as an answer. So I have a key in the authorized_keys file.
Do I have to send it (the public key) to my banana pi?
edit#2:
here is my adress less hidden 172.25.54.12 All I want for now is just connect my mac to my banana pi and control it as a server. So my Mac would be the client, and my banana pi my "host".
When I run
netstat -an | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
udp 0 0 0.0.0.0:32622 0.0.0.0:*
unix 3 [ ] STREAM CONNECTED 4122
unix 3 [ ] STREAM CONNECTED 2922 #/tmp/.X11-unix/X0
Basically what I did is, I followed some tutorial on the internet (like this one https://www.youtube.com/watch?v=0wn44MbxtZw) but it does not work.
edit#3:
I tried with a PC and puTTY, and I have got an error:
Network error: Network is unreachable.
Maybe it can help.
Edit#4
Ok I understood a part of my problem: I thought it was possible to connect directly my two devices without using the local network. I mean directly connect my banana pi to my mac just with one ethernet cable. But my goal is to be able to connect to my banana pi even when it is not connected to any network (is thath possible?), so I want to use an static IP address, is that a good idea?

Ok, so I found a way to do what I wanted to do. That means to connect directly my mac with my banana pi just with an ethernet cable (cross over ethernet cable).
I edited the network interface doing:
gedit /etc/network/interfaces
and then I modified the file this way
#interfaces (5) file used by ifup(8° and ifdown(8)
auto lo
iface lo inet loopback
#dhcp configuration
allow-hotplug eth0
#iface eth0 inet dhcp
#static ip configuration
auto eth0
iface eth0 inet static
adress 169.x.y.z
netmask 255.255.255.0
gateway 169.X.Y.*
So for address I put an IP really similar to my Mac IP adress (to get the mac IP address run ipconfig getifaddr en0)
And for gateway I put my mac IP address.
Then I connected my two devices with a cross over ethernet cable. And in my mac terminal I ran:
bananapi#169.x.y.*
and it worked!
Thank you

Related

Tunnel Gre problem between two hosts (vps and dedicated server)

Hello guys i need to resolve this problem (all server have installed centos 7): i'm trying to create a gre tunnel through vps (in Italy - OpenVZ) and a dedicated server (in Germany), but they do not communicate internally (ping and ssh command tests). Next i create a gre tunnel trought vps (in Italy - OpenVZ) and vps (in France - KVM OpenStack) and their communicate, i next i had create a tunnel trought vps (in France - KVM OpenStack) and a dedicated server (in Germany) their communicate. I can not understand why the vps (in Italy - OpenVZ) and the dedicated server (in Germany) do not communicate, ideas on how I can fix (
I also tried with iptables disabled, firewalld is not enable)? Thanks
In other words:
In other attempts (by this i mean that i managed to successfully create the GRE Tunnel between these machines):
The VPS (in France) and VPS (in Italy) communicate internally (ping and ssh command tests)
The VPS (in France) and Dedicated Server (in Germany) communicate internally (ping and ssh command tests)
Problem (by this i mean that i could not successfully create the GRE Tunnel between these machines):
The VPS (in Italy) and Dedicated Server (in Germany) do not communicate internally (ping and ssh command tests). I also asked hosting services if they had any restrinzione but nothing.
My configuration:
VPS command for tunnel:
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
iptunnel add gre1 mode gre local VPS_IP remote DEDICATED_SERVER_IP ttl 255
ip addr add 192.168.168.1/30 dev gre1 ip link set gre1 up
Dedicated server command for tunnel:
iptunnel add gre1 mode gre local DEDICATED_SERVER_IP remote VPS_IP ttl 255
ip addr add 192.168.168.2/30 dev gre1
ip link set gre1 up
[root#VPS ~]# ping 192.168.168.2
PING 192.168.168.2 (192.168.168.2) 56(84) bytes of data.
^C
--- 192.168.168.2 ping statistics ---
89 packets transmitted, 0 received, 100% packet loss, time 87999ms
[root#DE ~]# ping 192.168.168.1
PING 192.168.168.1 (192.168.168.1) 56(84) bytes of data.
^C
--- 192.168.168.1 ping statistics ---
92 packets transmitted, 0 received, 100% packet loss, time 91001ms
[root#VPS ~]# tcpdump -i venet0 "proto gre" tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on venet0, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes ^C 0 packets captured 1 packet received by filter 0 packets dropped by kernel
[root#DE ~]# tcpdump -i enp2s0 "proto gre" tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on enp2s0, link-type EN10MB (Ethernet), capture size 262144 bytes ^C 0 packets captured 0 packets received by filter 0 packets dropped by kernel
[root#VPS ~]# lsmod | grep gre
ip_gre 4242 -2
ip_tunnel 4242 -2 sit,ip_gre
gre 4242 -2 ip_gre
[root#DE ~]# lsmod | grep gre
ip_gre 22707 0
ip_tunnel 25163 1 ip_gre
gre 13144 1 ip_gre
Console image with full command output
If ip_forwarding is required for the tunnel to work, you need to do /sbin/sysctl -p
And what does the output of ip tunnel show and ip route show on both the ends

No DHCP response when connecting to WEP wifi

I am unable to connect to WEP wifi on Linux (Mint): I get no DHCP offer.
My bash script (that I launch as root) does the following:
pkill dhclient
pkill wpa_supplicant #just in case
ip link set dev wlan0 down
ip addr flush dev wlan0
iwconfig wlan0 essid "MyWifi"
iwconfig wlan0 enc off
ip link set dev wlan0 up
dhclient -v wlan0
When I launch it, I get no DHCP offer:
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlan0/e8:4e:06:24:b2:9e
Sending on LPF/wlan0/e8:4e:06:24:b2:9e
Sending on Socket/fallback
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPREQUEST of 192.168.100.101 on wlan0 to 255.255.255.255 port 67 (xid=0x19efd6f2)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5 (xid=0x17d23b2f)
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11 (xid=0x17d23b2f)
...
Important:
I do not have NetworkManager (not running and removed - I saw that was a common issue) and I prefer to use command line.
When I scan for my wifi, I see it no problem:
sudo iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 20:C9
[..]
Cell 02 - Address: 02:26:C6:2F:46:7E
Channel:9
Frequency:2.452 GHz (Channel 9)
Quality=54/70 Signal level=-56 dBm
Encryption key:off
ESSID:"MyWifi"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 48 Mb/s
54 Mb/s; 6 Mb/s; 9 Mb/s
Bit Rates:12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
Mode:Ad-Hoc
Extra:tsf=0000000001ed4e21
Extra: Last beacon: 32ms ago
IE: Unknown: 000B6950686F6E65204D795769
IE: Unknown: 010882848B96606C0C12
IE: Unknown: 030109
IE: Unknown: 06020000
IE: Unknown: 2A0100
IE: Unknown: 320418243048
I know that wifi works as I have other equipments connect to it
I know my wifi dongle works too as I manage to connect to other wifi (WPA).
Ok I found the solution. I was using mode 'managed' by default. But in the iwlist scan, it says 'ad-hoc':
Mode:Ad-Hoc
So, the correct script to connect to my Wifi is:
#!/bin/bash
pkill dhclient
pkill wpa_supplicant #just in case
ip link set dev wlan0 down
ip addr flush dev wlan0
iwconfig wlan0 essid "MyWifi"
iwconfig wlan0 enc off
iwconfig wlan0 key off
iwconfig wlan0 mode Ad-Hoc
ip link set dev wlan0 up
dhclient -v wlan0
and that works :)

Multipath TCP : Multiple connections Not Showing

I installed the mptcp kernel on my machine. I tried to test MPTCP by running iperf -c multipath-tcp.org (both end-ponts are MPTCP CAPABLE).
I tried to test if iperf lists the subflows created. I have an active wifi interface + active wired interface. But still iperf showed only the one with the wired interface:
Client connecting to multipath-tcp.org, TCP port 5001
TCP window size: 45.0 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.42.123 port 52983 connected with 130.104.230.45 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-22.7 sec 384 KBytes 139 Kbits/sec
THis shouldn't be the case. My wired link was too slow so, even if the flow would have started here, surely subflow would be there in the wifi interface as well.
How could I actually see that MPTCP is in fact creating subflows ?
I saw the question here but my cat proc... file is showing
sl loc_tok rem_tok v6 local_address remote_address st ns tx_queue rx_queue inode
0: B491F32C CDF952DC 0 0B2BA8C0:8E9C 2DE66882:1389 01 02 00000000:00000000 203077
which doesn't relate to any subflows I guess.
Maybe you can check the mptcp setting with sysctl net.mptcp,the path manager should be setted to fullmesh rather than default to establish multiple flows.
sysctl -w net.mptcp.mptcp_path_manager=fullmesh
sysctl -w net.mptcp.mptcp_enabled=1
Further explanation of mptcp setting can be viewed at http://multipath-tcp.org/pmwiki.php/Users/ConfigureMPTCP

ssh: connection refused on port 22

I have installed Openssh-sever. Started the ssh-server using the following command :
:~$ sudo service ssh start
ssh start/running, process 20013
With the following command I can see port 22 is open :
:~$ sudo nmap localhost -p 1-65535
Starting Nmap 6.40 ( http://nmap.org ) at 2015-04-22 23:46 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000013s latency).
Not shown: 65533 closed ports
PORT STATE SERVICE
22/tcp open ssh
631/tcp open ipp
Nmap done: 1 IP address (1 host up) scanned in 7.24 seconds
Furthermore, to check if the port is listening I used the following command with the results :
:~$ sudo netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 1061/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 20013/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2009/cupsd
tcp6 0 0 :::22 :::* LISTEN 20013/sshd
tcp6 0 0 ::1:631 :::* LISTEN 2009/cupsd
udp 0 0 0.0.0.0:42198 0.0.0.0:*
But when I try to connect to the port from the same machine I get the following message :
:~$ ssh -vvv -p 22 address
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to address [198.105.xxx.xxx] port 22.
debug1: connect to address 198.105.xxx.xxx port 22: Connection timed out
When I try to ssh from a different computer on a different network I get following message(xx.xxx.xxx.xxx is the external/public IP of the router) :
:~ssh bhuwan#xx.xxx.xxx.xxx
ssh: connect to host xx.xxx.xxx.xxx port 22: Connection refused
Whereas, when I try to ssh from a different computer on a same network I am able to connect. I do have port forwarding enabled on the router on port 22 to my local IP of the computer. I literally started using ubuntu 2 days ago and started working on ssh the same day. I'm not an expert on this as of now and any simplified explanation or guidance would be much appreciated. :)
below is my sshd_config file:
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes
# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024
# Logging
SyslogFacility AUTH
LogLevel INFO
# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.ssh/authorized_keys
# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes
# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no
# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no
# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes
# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
# GSSAPI options
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no
#MaxStartups 10:30:60
#Banner /etc/issue.net
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
And my ssh_config file as follows:
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.
# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
Host *
ServerAliveInterval 300
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64#openssh.com,hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
After a long haul found out that problem was the Modem that ISP provided. Above configuration should work fine if the modem/router has port forwarding not blocked by the ISP. With the modem/router ISP provided, even after I tried port forwarding, port 22 was not open which can be checked here: http://www.canyouseeme.org/.

NTPD on arm box version 4.2.6p5

i have managed to cross compile ntpd 4.2.6p5 for my arm box. I have a custom toolchain provided by the manufacturer.
Box is running busybox + some variant of debian linux.
So I have no installation of ntp and did a manual copy, created a conf file for the ntpd and tried to run it.
ntpd always returns this when in debug mode:
~/ntp # ./ntpd -c ntp.conf -d
ntpd 4.2.6p5#1.2349 Mon Apr 7 19:58:25 UTC 2014 (1)
9 Apr 07:39:44 ntpd[3592]: signal_no_reset: signal 13 had flags 4000000
9 Apr 07:39:44 ntpd[3592]: proto: precision = 91.000 usec event at 0 0.0.0.0 c01d 0d
kern kernel time sync enabled
Finished Parsing!!
9 Apr 07:39:44 ntpd[3592]: ntp_io: estimated max descriptors: 1024, initial socket
boundary: 16
9 Apr 07:39:44 ntpd[3592]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
9 Apr 07:39:44 ntpd[3592]: unable to bind to wildcard address :: - another process
may be running - EXITING
before that I had to add into /etc/services also
ntp 123/udp
my ntp.conf looks like:
~/ntp # cat ntp.conf
server 193.2.4.6
server 193.2.4.2
driftfile ntp.drift
So I have checked netstat and nothing is running on port 123, no ntpdate etc...
~/ntp # netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.3.1 0.0.0.0 UG 0 0 0 eth0
192.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
~ # netstat -a | grep 123
~ #
Therefore it must be something with the config, or this arm box does not have something configured...
Oh and running manually ntpdate works:
~/ntp # ./ntpdate 193.2.4.6
9 Apr 07:49:16 ntpdate[3614]: step time server 193.2.4.6 offset -0.755704 sec
~/ntp #
So yes i could use ntpdate in cron, but this is not my intent!
Any idea?
Thank you and best regards!
The following error indicates that ntp had trouble binding to the ipv6 wildcard:
9 Apr 07:39:44 ntpd[3592]: unable to bind to wildcard address :: - another process
may be running - EXITING
I think your problem is ipv6 but it is hard to tell because your diagnosticinformation was not very good. Your netstat -a |grep 123 command is useless because netstat would substitute ntp for port 123. Try it again with:
netstat -a -n | grep 123
Along those lines netstat -rn only works with ipv4, try it again with -6:
netstat -r -n -6
Your test ntpdate used an ipv4 host. Does your server support ipv6? What happens when you run:
$ sntp -d -6 time.nist.gov
I used sntp because I do not know if ntpdate has a -6option and sntp does.

Resources