0

So I have a raspberry on which I freshly booted ubuntu 20.04 on and I wanted to ssh connect to it. However I'm having trouble finding out what its ip address is.

Current connection:

  1. Raspberry pi to power supply
  2. Raspberry pi to ethernet, ethernet to laptop both ethernet lights light up on raspberry
  3. Laptop has a wifi connection

Im aware that my raspberry needs to be connected to the same network so I went under the Wired Settings IPv4 and ticked the Shared to other computers option. Is that it? Atleast thats what I saw online.

Then I ran commands like arp -a which only shows one gateway ip address (whatever that means). Then I ran an nmap scan I saw online

sudo nmap -sP 192.168.1.0/24

Nothing said raspberry pi in that list of ports checked.

So please help me identify whether my raspberry is even detected or help me make it detectable.

1 Answers1

0

Open the app nm-connection-editor from your terminal.

Select the Wired Connection under Ethernet and then click on the Edit button. This button may look like a gear ⚙ at the bottom of the window.

Go to ipv4 Settings tab and change method to Shared to other computer.

See the picture below:

enter image description here

Save the changes.

This will assign an IP address to your Pi in the 10.0.0.0/8 range.

To find the IP address range assigned by the laptop to the Ethernet cable connected, open a terminal and enter:

ip address

This will show you the IP addresses for each of the interfaces (loopback, WiFi, Ethernet, etc.) of your laptop.

As you found out the laptop's IP address was 10.42.0.1 for the Ethernet cable.

To find the IP address of the Pi enter the following in the terminal:

sudo nmap -sP 10.42.0.0/16

This should provide you the IP address of the Pi. Once you have that, you should be able to use the ssh command on the laptop as:

ssh pi@10.42.0.X

Assuming your username in the Pi is pi. Replace 10.42.0.X with the actual IP address of your Pi you found from the previous command.

Hope this helps

user68186
  • 33,360
  • I mentioned doing this step in my post. Theres still something missing. You said this assigns an ip address to my pi, how do I then find what that address is? – Saif eldeen Adel Mar 31 '23 at 08:09
  • Ok I think I see it now, its apparently on 10.42.0.1 however when I try to ssh on my raspberry its not allowing me (port 22 connection refused). Keep in mind I have ssh enabled on my raspberry already. Is there something I need to do for ssh to work on the laptop side? – Saif eldeen Adel Mar 31 '23 at 09:07