this post was submitted on 23 Feb 2024
30 points (87.5% liked)

Selfhosted

40347 readers
403 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hi! I hope this is the right community to ask.

Next week I will be on the road for 5 Days for work. I have quite some spare time, so I thought I would dig up my raspberry project again and hopefully finish it.

I need it with me, because it controls some hardware, so a VPN to home does not work. So only option I could think of, is to connect the pi directly to my laptop via an ethernet cable. As far as I understood from some research is that I would need to install and run an DHCP server on my laptop, which they did not recommend. Alternatively they suggested to just take a router and plug both devices in there. I don't really have a spare router, so that's not an option either.

To be hones it confuses me a little, that there does not seem to be a standard for connecting to a device directly over a single cable and login with a user account.

Any recommendations how I can work on the pi like with ssh?

Thanks a lot!

you are viewing a single comment's thread
view the rest of the comments
[–] rtxn@lemmy.world 31 points 9 months ago* (last edited 9 months ago) (14 children)

Give each device a static address, and set the default gateway to whatever's on the other end of the cable. You might need a crossover cable, but most NICs can work using a straight-through.

E.g. set the laptop's address to 169.254.1.1/16 and default gateway to 169.254.1.2, and the RPi's address to 169.254.1.2/16 and default gateway to 169.254.1.1. They should be able to talk to each other then.

If those addresses seem familiar - Windows uses the 169.254.0.0/16 subnet to automatically assign random addresses if DHCP fails, so that if there are several computers in the subnet, they'll at least have addresses that can talk to each other. It's called APIPA in Windows, and Zeroconf in the Unixverse.

[–] WbrJr@lemmy.ml 1 points 9 months ago (3 children)

Thanks! That seems rather easy. Only thing I'm not sure about, I have basically only access to the pi over SSH. I could use a screen and keyboard but would prefer not to. What would happen if I configure the network wrong on the pi and can not connect anymore, even over my home network? Could I change the config by putting the SD card into my laptop and changing a file? Or is it possible to make it redundant, so if it can't find a DHCP server, it automatically switches to the preconfigured settings you described? :) Thanks a lot

[–] Darkassassin07@lemmy.ca 3 points 9 months ago

Configure ethernet with fixed IPs, and configure wifi to use your phone hotspot.

Then you can use one to troubleshoot the other as needed.

Then your normal setup would be wired between the pi+laptop, with the laptop connected to local wifi for internet.

[–] atzanteol@sh.itjust.works 1 points 9 months ago

Network interfaces can be assigned multiple IP addresses. You should be able to use DHCP and a link local address at the same time.

That said I think this is easier to do with network manager. I'm not sure how it works with the rpi. But "link local address rpi" is a good search term to start with.

[–] rtxn@lemmy.world 1 points 9 months ago* (last edited 9 months ago)

I've never used a pi, but it should be possible to mount the root partition and edit the /etc/network/interfaces or /etc/dhcpcd.conf file, or /etc/NetworkManager/conf.d/* if you have NetworkManager (systemctl status NetworkManager to check).

You should also make sure that sshd is listening for connections from any address (0.0.0.0 and ::).

load more comments (10 replies)