This quick post is on two important things in pi.
Enable wifi and connect to internet
Open the file for network interfaces, and look for a section called wlan0, or add this section-
iface wlan0 inet dhcp
wpa–proto RSN WPA
wpa–pairwise CCMP TKIP
wpa–group CCMP TKIP
wpa–ssid “My Secret SSID”
wpa–psk “My SSID PSK”
The most important entries are wpa–ssid and wpa–psk. Update your network name and password here. The values are case sensitive.
Thats all. You can restart your pi and you should be able to connect to the wifi network.
$> sudo restart $> ping google.com
SSH into the raspberry pi from another box
Get your hostname/ip address from pi –
Use these commands on your raspberry pi console :
$> hostname $> ifconfig
Use this ip address to ssh into the raspberry pi from a different computer. Us the username pi to connect to pi. The default password is raspberry.
$> ssh email@example.com
That should be all to ssh into your raspberry pi.
Sometimes you might see this error while ssh’ing into the pi.
ssh: connect to host 192.168.1.8 port 22: Connection refused
This should be due to –
- wrong userid/password
- wrong ip address
- ssh is not enabled on the pi
While the first 2 are straight forward, you might have to make quick changes on your pi for the 3rd cause.
$> sudo raspi-config
This should open a blue config screen and you could go to the advanced settings section, to find SSH connections enable/disable. Enable ssh on pi and exit. That should be all.
Yash Sharma is a Big Data & Machine Learning Engineer, A newbie OpenSource contributor, Plays guitar and enjoys teaching as part time hobby.
Talk to Yash about Distributed Systems and Data platform designs.