0

I have a network setup where a Raspberry Pi is connected to a switch (not a router). I then connect my laptop to the same switch, and I then want to start an SSH session with the Pi. I would also want to do FTP or SCP to the Raspberry Pi for deploying scripts.

How would I find the IP address assigned to the Raspberry Pi and my laptop, and could I use that information to do SSH connections to the Pi?

  • 2
    How are you allocating IP addresses? Is it only the Pi and your laptop and the unmanaged switch? – ivanivan Sep 9 at 4:09
  • @ivanivan yes it's just those two devices – Jose Chavez Sep 11 at 19:04
1

There's quite a few scenarios here.

If you have a standard consumer router also connected to this switch, it should have a built-in DHCP server that assigns IP addresses. You can also usually configure static mappings from there, and they will also frequently resolve hostnames via their built-in DNS caching server.


If you only have these two devices connected to the switch and no DHCP server (or consumer router containing one), you can:

  • Use link-local addresses
  • Or, manually assign static IP addresses (picked from the same RFC1918 subnet) on each device
  • Or, set up a DHCP server

Link-local addresses, especially with IPv6, may "just work". IPv6 interfaces should always have a link-local address. You can look for the address within your network configuration on each device. On Linux, the ip addr show command may help. On Windows, ipconfig /all. The syntax for connecting to one may be a bit funny.

A link-local/APIPA IPv4 address from 169.254.0.0/16 address may also work. Windows will assign one automatically if it does not receive an address from manual config or DHCP. Linux might not, depending on your network stack - look at Avahi.

Note that link-local and DHCP-assigned addresses are not "stable" - they can change, especially when you re-connect to the network. You may wish to also use a name service like NetBIOS/LLMNR, mDNS (Bounjour), etc., to enable you to discover these addresses by hostname.

0

In most Linux distros, you can find your IP address by typing the following in bash:

ip address

You will see all your network adapters and IP addresses. Most routers assign IPs in the 192.168.x.x range.

It definitely sounds like you didnt install the OpenSSH server, so you will need to install and start it with:

sudo apt install openssh-server; sudo service ssh start

Then you can SSH into your Pi with a SSH client from your laptop.

  • Note that ifconfig has been deprecated for a while and is not even available on some distros now. ip (e.g. ip addr) is the modern alternative. – Bob Sep 9 at 4:17
  • @Bob I noticed that change, but didnt realize it was deprecated. It wasnt that long ago it changed... I just noticed recently I had to install net-tools to get ifconfig, which I thought was strange... now I know why – Keltari Sep 9 at 4:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.