desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

raspberry pi cant SSH

Sat Feb 01, 2014 11:50 am

Hi, i recently got my raspberry pi to connect to the universities interntet which is a WPA2-enterprise encryption. When i type in ifconfig, it gives me my IP address. but when i try and SSH to it, it doesn't work. So i tried a network scan to see if the Pi is connected to the router, and strangely i can't find the IP. Its strange because on the pi, when i open up a browser, i can use google. i can also ping google.....anyone knows what is going on?

just an additional note. i use a dhcp setting , but every time i reboot the pi, it still gives me the same IP...i dunno whether i should be suspicious about this

Cheers!

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: raspberry pi cant SSH

Sat Feb 01, 2014 11:57 am

As a security measure it's possible the SSH port TCP 22 is being blocked by your network.
If changing the port number (or adding a new one) doesn't work then you may need to speak with your network administrator.

Richard S.

User avatar
DougieLawson
Posts: 39581
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: raspberry pi cant SSH

Sat Feb 01, 2014 12:00 pm

DHCP is designed to always give the same IP address unless your lease has expired.

Check the firewall settings in your router and on your Windows machine.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 12:25 pm

hi, so i went to /etc/ssh/ssh_config and edited the port to 2122...but i still couldnt connect...i was just wondering how is it that my network scanner can detect all the devices except the raspberry pi?

cheers!

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 12:31 pm

correction....its sshd_config

ethanol100
Posts: 648
Joined: Wed Oct 02, 2013 12:28 pm

Re: raspberry pi cant SSH

Sat Feb 01, 2014 12:34 pm

Are you connected to the same wireless access point? Sometimes there is an user separation in accesspoints to disallow communications between clients. So you have same ip ranges on your raspberrypi and your computer, or have you two separate ranges with a gateway in between? Have you tries to ping each other to see if there exist a route between them?

Yes, sshd_config is right, and don't forget restarting the ssh daemon.
Last edited by ethanol100 on Sat Feb 01, 2014 12:38 pm, edited 1 time in total.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: raspberry pi cant SSH

Sat Feb 01, 2014 12:36 pm

"but when i try and SSH to it, it doesn't work." - are you trying to ssh from the university's internet or external??

If your University provide mutliple Wifi channels / Wifi routers, it's possible the Pi and computer are connected to different local networks.

Richard S.

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 12:38 pm

hi, yes i have tried to ping...unfortunately no response...i was suspecting there could be two access points actually, even though my raspberry pi is right next to my laptop. is there a way i can fix this?

thanks!

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: raspberry pi cant SSH

Sat Feb 01, 2014 12:50 pm

Some Wifi routers can prevent network communications between devices on a local network, so while Pi and computer are using the same router accessing each other may not be possible.
If you're using a laptop or computer then you could use a network bridge with an Ethernet cable and carry on using the Wifi access.

Richard S.

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 1:04 pm

hmmm this can be very complicated ....im living in a university accommodation and access to router is highly impossible ... would it be a good idea to connect to pi via dynamic IP?

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 1:05 pm

i have another question..if i change the port to something else, would i still be able to ssh? because i did a port scan and it says port 22 is for ssh..

cheers

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: raspberry pi cant SSH

Sat Feb 01, 2014 1:17 pm

For conformity network services are allocated a certain port number to avoid any clashing, however that doesn't mean you couldn't run an SSL web server on TCP 80 (normally TCP 443) or ftp on port 2121 but it can confuse the hell out of some software.
With the SSH service you can open up many different port numbers, I did this when I accessed my Pi abroad just in case some ports were blocked by the hotel's free Wifi.

Just out of curiosity is there a specific reason why you wish to login to your Pi from your computer??

Richard S.

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 1:22 pm

hi, well yes, I'm building a robot that needs to be controlled wirelessly. previously i used 3G to control the robot, but its range is too short. i thought that if i connected to eduroam( the wifi I'm trying to connect to) it could extend the range. However i came across this problem of not being able to connect to ssh....any suggestions of modifications would be accepted haha

cheers

ethanol100
Posts: 648
Joined: Wed Oct 02, 2013 12:28 pm

Re: raspberry pi cant SSH

Sat Feb 01, 2014 1:37 pm

do you have access to another linux computer, which you can ssh to from both your pc and the raspberrypi? Then you could use a reverse port forward to use this computer as a gateway.

Do you really mean 3g not bluetooth or something else? Why does it have short range?

Does your wlan adapter supports managed mode, and can be used to configure an access point? Then you could create your own small raspberrypi hotspot and could connect to it? Or else use ad-hoc wifi network?

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: raspberry pi cant SSH

Sat Feb 01, 2014 2:26 pm

Get a cheap router (unless you already own one) with this you can create your own local intranet (not to be confused with "internet") this should link your computer and Pi with Wifi access without involving the University's own internet access.
Turning your computer into a Wifi Ad-hoc network is another option although that would depend on the operating system you're using.

Richard S.

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 2:47 pm

do you have access to another linux computer, which you can ssh to from both your pc and the raspberrypi? Then you could use a reverse port forward to use this computer as a gateway.
hi yes i do, but how do i reverse port forward?
Get a cheap router (unless you already own one) with this you can create your own local intranet (not to be confused with "internet") this should link your computer and Pi with Wifi access without involving the University's own internet access.
i actually have that i initially used that to connect to raspberry pi..but i wanted to extend its capabilities and range

ethanol100
Posts: 648
Joined: Wed Oct 02, 2013 12:28 pm

Re: raspberry pi cant SSH

Sat Feb 01, 2014 2:57 pm

To test if a reverse proxy would work try:
1.) run ssh from the pi and create a reverse port forward:
ssh -R 12345:localhost:22 gatewayuser@gateway
keep this connection running
2.) connect from your pc to the gateway
ssh gatewayuser@gateway
and now on the gateway use
ssh -p 12345 piuser@localhost

This assumes you have reset the port of ssh to the standard port 22.
The -R creates a reverse tunnel pointing from gateway on port 12345 to the pi on port 22.

Later on you can automate it using ssh-keyfile for passwordless login to the gateway and autossh to automaticaly create the reverse proxy. In linux you could create on your computer a config file for ssh to create a shortcut for the second connection. But I do not know which ssh client you are using.

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 3:04 pm

hi, i will try that now! btw i just found out that the router has an IP like 172.21.(188-191).234

my computer is on 191
and my RPI is on 189..i can't ping to my computer

however , when i do a network scan , i can ping to all those who have a 189 in their IP. can i force my RPI to have similar IP?

cheers

desmondttm123
Posts: 103
Joined: Tue May 07, 2013 6:13 am

Re: raspberry pi cant SSH

Sat Feb 01, 2014 3:08 pm

To test if a reverse proxy would work try:
1.) run ssh from the pi and create a reverse port forward:
ssh -R 12345:localhost:22 gatewayuser@gateway
keep this connection running
2.) connect from your pc to the gateway
ssh gatewayuser@gateway
and now on the gateway use
ssh -p 12345 piuser@localhost

This assumes you have reset the port of ssh to the standard port 22.
The -R creates a reverse tunnel pointing from gateway on port 12345 to the pi on port 22.

Later on you can automate it using ssh-keyfile for passwordless login to the gateway and autossh to automaticaly create the reverse proxy. In linux you could create on your computer a config file for ssh to create a shortcut for the second connection. But I do not know which ssh client you are using.

hi,, the results on both pi and computer return
"could not resolve hostname gateway: name of service unknown"

ethanol100
Posts: 648
Joined: Wed Oct 02, 2013 12:28 pm

Re: raspberry pi cant SSH

Sat Feb 01, 2014 3:11 pm

you need to replace the "gateway" with the name of the linux server which both the pi and your computer can connect to. And you need to replace the user names too.

I don't think you can influence which ip you will receive from the ap.

Return to “General discussion”