What I want to achive is to connect through ssh, by key into my raspberry pi board. I am noob at networking so bare with me. I use win 7 x64 on my PC.
I installed a headless Rasbian OS, which is basically a Debian linux server os (whithout gui), which has only ssh public key stored during installation.
And now I have some issues that I don't understand :
- why I don't have internet connection ?
I plugged the LAN cable from PI to my laptop, and leave my laptop on wifi network connection. I need internet for
sudo apt-get update
it show a very slow connection speed with the sharing internet option, but it has to be a better way.
I tried sharing internet through wi-fi doing this settings, which drop the internet speed from both PC and Raspberry, and it took a while to reverse back the changes.
2. I found in here that I should have an IP for eth0 interface, but I have for io interface instead. On Another thread from here I found that this means that ethernet port is disabled (if I get it right)
Searching it on google I found it that eth0 interface is that if you want your Raspberry Pi to act as a router, which in my opinion it don't make any sense why I would want that.
3. if I do
hostname
on Raspberry, I see that I have a hostname assign corectly during the installation, but when I try to use Putty or Kitty to ssh into it, it says that it could not found the host.
Then I found that I have to load the private key in Putty to actually ... don't working either.
I tried also with a weird IP found on io interface, which is something like 127.0.0.1, with no avail.
The maximum reach is that I get Connection Refused, instead Host not found.
PS: my ultimate goal is to establish local connection through ssh between laptop -> router -> raspberry Pi, for installing and management, as raspberry Pi drain internet from the router. ( Don't want to use ssh through internet if it's possible, for security purposes)
I am not sure what you are asking, your post is confusing. If you want to connect from your laptop to your Pi then the instructions are on the RaspberyPi website. Here is the link https://www.raspberrypi.com/documentation/computers/configuration.html#set-up-a-headless-raspberry-pi
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
I have to admit, I agree with @zander about your post is very confusing. Let me offer several things and see if any of them apply and maybe, it'll clear up either your confusion or ours...
- Typically a special ethernet cable (cross-over cable) must be used to connect two computers directly together... UNLESS one of them can internally, logically swap the two wires that a cross-over cable does when connecting two similar devices (computer to computer) or (router to router). I do not know if a RasPi or a Windows NIC card has this ability. Wouldn't surprise me, but I've never tested it. I always automatically pull out the cross-over cable when rarely necessary.
- It appears to me that you're making this far harder than the more common ways of handling Internet connectivity. You apparently have a router since you are WiFi'ng the Win7 laptop to it. Why don't you want to WiFi or Ethernet the Raspberry Pi to the same router and just use Putty to connect to it over your LAN? I do this EVERY time as I always run my RaspPi's headless. There is no reduced security by this method. Your connection from PC to router to RasPi is secure, your downloads from Internet to router to RasPi are secure.
- If you insist on your description, you must enable Internet sharing on your Win7 box and thus allowing transfer of Internet traffic to the RasPi - https://www.dummies.com/article/technology/computers/operating-systems/windows/windows-7/how-to-share-an-internet-connection-in-windows-7-206339/
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide
This might be an understanding problem:
PS: my ultimate goal is to establish local connection through ssh between laptop -> router -> raspberry Pi, for installing and management, as raspberry Pi drain internet from the router. ( Don't want to use ssh through internet if it's possible, for security purposes)
Just because the router is connected to the Internet doesn't mean SSH is going over it. If your RasPi and Win7 box are both connected to the same router (either by WiFi or Ethernet) they will be talking ONLY through your router. So you controlling the RasPi via SSH from the Win7 box is staying on your LAN. BUT... when you issue a...
sudo apt-get update
... over this SSH connection, the RasPi then connects to the repository on the Internet to bring the update down... and both communications will be at maximum speeds that your hardware can do.
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide
Typically a special ethernet cable (cross-over cable) must be used to connect two computers directly together... UNLESS one of them can internally, logically swap the two wires that a cross-over cable does when connecting two similar devices (computer to computer) or (router to router). I do not know if a RasPi or a Windows NIC card has this ability. Wouldn't surprise me, but I've never tested it. I always automatically pull out the cross-over cable when rarely necessary.
interesting. I didn't know of cross-over cable.
It appears to me that you're making this far harder than the more common ways of handling Internet connectivity. You apparently have a router since you are WiFi'ng the Win7 laptop to it. Why don't you want to WiFi or Ethernet the Raspberry Pi to the same router and just use Putty to connect to it over your LAN? I do this EVERY time as I always run my RaspPi's headless. There is no reduced security by this method. Your connection from PC to router to RasPi is secure, your downloads from Internet to router to RasPi are secure.
I thought that making a local connection would be much easier, than including a router in between.
If you insist on your description, you must enable Internet sharing on your Win7 box and thus allowing transfer of Internet traffic to the RasPi - > https://www.dummies.com/article/technology/computers/operating-systems/windows/windows-7/how-to-share-an-internet-connection-in-windows-7-206339/
This I already tried, but I couldn't get more internet speed than a few KBytes. Also I had many failed downloads.
This might be an understanding problem:
PS: my ultimate goal is to establish local connection through ssh between laptop -> router -> raspberry Pi, for installing and management, as raspberry Pi drain internet from the router. ( Don't want to use ssh through internet if it's possible, for security purposes)
Just because the router is connected to the Internet doesn't mean SSH is going over it. If your RasPi and Win7 box are both connected to the same router (either by WiFi or Ethernet) they will be talking ONLY through your router. So you controlling the RasPi via SSH from the Win7 box is staying on your LAN. BUT... when you issue a...
sudo apt-get update
... over this SSH connection, the RasPi then connects to the repository on the Internet to bring the update down... and both communications will be at maximum speeds that your hardware can do.
Thank you and @zander for the documentation. There is said:
To connect your Raspberry Pi to a network, you can either plug your device into a wired connection via Ethernet or configure wireless networking.
Basically I connect to Raspberry Pi through ethernet cable to router, or wi-fi (maybe even direct connection)
Solution:
I setup the Raspberry Pi with both power, and an ethernet cable to my router over night ( it seems it takes more time to aquire an IP from the router for the first time. This may be the reason why it didn't worked the first time I tried)
.......
I connected the Raspberry to my router, and then use my laptop as a monitor (with a micro HDMI adapter -> HDMI adapter -> HDMI Video Converter USB ; and as software I used OBS)
PS: I am planned to make a documentation in the future for noobs like me, on my github. 😊
and I plugged a keyboard into the Raspberry.
I logged in, and use:
ifconfig
At my surprise eth0 interface had an IP
(I use this image as an example only)
Then in KiTTY I used
<user>@<that IP>
First time I got this error:
but then I made sure that I load the correct private key (which I converted with the puttygen), and also add .ppk at the end ( for some reason the loader didn't add the extension at the end)
And it worked !
It displayed a Putty Security Alert, like this one:
it asked me for the passphrase,
and now I am in. 🙂
@cristishor201 I am glad you are happy, but I am still not sure what you are doing.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
Someone on the forum wanted a tutorial a while back to set up a Raspberry Pi headless. I simply provide a set of steps that is pretty strait forward these days using the Raspberry Pi Imager. It doesn't require a ethernet cable, although an ethernet cable to the router makes it even simpler.
https://forum.dronebotworkshop.com/raspberry-pi/headless-raspberry-pi/#post-44797
3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide
@cristishor201 Maybe you missed my post pointing you to the official Raspberry Pi documentation. There is NO need for a key, you just need a userid and password. Here is my post link https://forum.dronebotworkshop.com/raspberry-pi/connect-to-raspberry-pi-4-from-laptop/#post-45280
Note that this procedure works identically with both an SD and a USB SSD.
The end result of this is a Pi with ONLY a power cord. You connect to it with a laptop using any of a number of ssh clients.
another great resource is https://www.tomshardware.com/reviews/raspberry-pi-headless-setup-how-to,6028.html
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@cristishor201 I didn't have my coffee yet when I replied earlier so didn't notice that you now have a wired connection to your Pi. I don't understand why you are discussing SSH, VNC, etc if you have a plugged in keyboard. And all that stuff re keys is complete overkill.
What I thought you wanted was a way to use just your laptop/desktop as the display and keyboard with NO wires. My Pi has ONLY a power cable connected. The configuration is all done with the SD/USB imager for command line, then a few more steps if you want a GUI. I spend most of my time at the command line so often don't even bother with the GUI.
BTW, you do NOT need to know your IP, it can be accessed with HOSTNAME.local where HOSTNAME by default is raspberrypi IIRC. I generally change mine to something else that is more meaningful to me.
If you really want a wired connection, then you might also consider a small HDMI display so your laptop is free for other things, and adding a wireless mouse and keyboard would also work well.
Good luck.
I use a Mac to connect remotely just using SSH and VNC (on Pi4) and the M1 Mac is in the corner because I have my Magic Mouse and Full size keyboard connected to my Mac. I also have the Mac connected to a 5K 24" display. Because I can have multiple logical screens (as can windows now) I often have a Mac in one, a Win10 in another, a Pi in a 3rd and a OMV NAS in the 4th. If I am doing Lightroom work (photo editing) then the 5K display is the main display while the Mac laptop screen is the control interface. This is where the beauty of 'headless' or remote access, I can use my best display with any of 4 systems, and I can get the magic mouse and keyboard without any need of a KVM etc.
For the uninitiated, the Magic Mouse is one of Apple's great inventions. It is a mouse, but the surface area is a touchpad. I switch between mouse actions and touch pad actions without even thinking about it and do that on MacOS, Win10, OMV and Pi although the Pi has a few weird differences that one day I will remember to customize the UI to make it compliant.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@cristishor201 I didn't have my coffee yet when I replied earlier so didn't notice that you now have a wired connection to your Pi. I don't understand why you are discussing SSH, VNC, etc if you have a plugged in keyboard. And all that stuff re keys is complete overkill.
Ok, maybe my english is not so good.. but I wanted to achive a remote connection through ssh. So I conected an external keyboard to the Pi, just to login, and then finding the IP of the Pi, which I couldn't guess it.
BTW, you do NOT need to know your IP, it can be accessed with HOSTNAME.local where HOSTNAME by default is raspberrypi IIRC. I generally change mine to something else that is more meaningful to me.
It still not working ! I think it's have to do something with a mapping process. On one site I saw an article about assigning a static Ip to the hostname somewhere in the /etc/hosts/ ... which I will look into it.
For the uninitiated, the Magic Mouse is one of Apple's great inventions. It is a mouse, but the surface area is a touchpad. I switch between mouse actions and touch pad actions without even thinking about it and do that on MacOS, Win10, OMV and Pi although the Pi has a few weird differences that one day I will remember to customize the UI to make it compliant.
👍 Magic Mouse. Until now I only knew about a software called Mouse whithout borders, which it lacks only the file transfer (it may have a bug)
@cristishor201 The software you use to create your boot media contains the settings for remote access. See the following https://www.makeuseof.com/how-to-use-raspberry-pi-imager-advanced-options/
also here https://www.tomshardware.com/news/raspberry-pi-imager-now-comes-with-advanced-options
See the pics for sample screens. Just use password, don't bother with crypto keys, not needed.
The reason you don;t need an IP is you connect via the hostname. Just take all the defauts for now you can change them later if needed but if you still need help it's best to use the defaults. This is a 5 minute process to get hooked up. All you need is to plug the PI into power, NOTHING else. I do it all the time as do many others.
Good luck
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.