Connection problem to Rasperrypi with ETHERNET ET WIFI

At first, I used a laptop to connect rasperrypi with a Ethernet cable. I used IPscanner to search the IP address of raspberrypi as 192.168.137.61 and successfully connected to Raspberrypi using MOBAXTERM SSH.

Then I configured wifi Raspberry, successfully found rasperrypi ip 192.168.1.76, and can take away the network cable, connect to raspberrypi in wifi via MOBAXTERM, and run the MATRIX CREATOR program.

However, after one night, when I want to connect again with MOBAXTERM, it show “error, time out” , and neither the Ethernet cable nor the WIFI IP can be connected.

I then scan with IPSCANNER, there are two raspberrypi IP address 192.168.137.67, 192.168.137.166, but they can not connect with MOBAXTERM, display “error, time out” error.

Then I deleted these two IPs directly at IPSCANNER software, re-recorded the SD card, and then loaded it into raspberrypi. Then I connected raspberrypi with the ETHERNET cable, but I could not scan the IP address of raspberrypi at 192.168.137.1 to 192.168.137.255

Only an Ip show 192.168.1.76, but it can’t connect to raspberrypi with MOBAXTERM.Always showed “error,time out”.

Why this problem? How to solve it?

Did you try

sudo raspi-config

at the prompt to configure your Wi-Fi.

I’ve done sudo raspi-config to configure WIFI with name and password. At the begin it can be connect . But after that I couldn’t connect raspberry with Mobaxterm neither ETHERNET NOR WIFI.

A nice trick I use is to change the hostname on the Pi and just ssh using the hostname instead of the actuall IP. Not sure if that would help. Here is how :

  1. Connect the SD Card to you computer and mount the partitions (preferably from a linux pc)
  2. Modify the hostname by changing this files in the SD Card
$ cat /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       raspberrypi # change the hostname here ex: test-pi

Then:

$ cat /etc/hostname
raspberrypi # change the hostname here too. ex : test-pi
  1. After that, insert the SD Card into the Raspberry Pi and wait for it to boot and connect to the Wifi/Ethernet
  2. Try to ssh into it by using ssh pi@<your-hostname>.local . Ex :

$ ssh pi@test-pi.local

-Yoel

When I type root@DESKTOP-8HATSCT:~# cat /etc/hosts in ubuntu under windows 10. It show me bellow:

**# This file is automatically generated by WSL based on the Windows hosts file:**
**# %WINDIR%\System32\drivers\etc\hosts. Modifications to this file will be overwritten.**
127.0.0.1       localhost
127.0.1.1       DESKTOP-8HATSCT.localdomain     DESKTOP-8HATSCT

**# The following lines are desirable for IPv6 capable hosts**
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

But there is no 127.0.1.1 raspberrypi showed.
That’s mean the respberry doesn’t connect with computer? But I’ve formated SD cart and wrote Raspbian to SD card. And the light of interface connection is green and yellow.
Why this problem?

In addition to the actual discussion:
as far as i know you can also change the hostname with raspi-config

1 Like

You can try to connect a HDMI display and keyboard to the Raspberry Pi to check if its actually connecting, and from there you can use raspi-config to change wifi settings.
-Yoel

Sorry, I was not clear before. I meant to change the hostname in the file located inside the SDcard, not your PC hostname. In my case would be something like this (after connecting sdcard to my ubuntu pc):

sudo nano /media/yoelrc88/rootfs/etc/hosts
sudo nano /media/yoelrc88/rootfs/etc/hostname

Easier than this is just using a display and a keyboard connected to the Pi and configure Wifi from there.

-Yoel