DEV Community

Discussion on: I'm an ops person. Ask me anything!

Collapse
 
tcratius profile image
Me, myself, and Irenne

I have a raspberry pi, what would be a way of finding it connected via ethernet to home router/modem and how can I transfer files?

Collapse
 
benaryorg profile image
#benaryorg

Use a static IP, although I don't particularly like that method.

Or query your DHCP server (usually your router). Most of the time it's possible using names too.
If you setup your own DHCP server you can also do one of the following:

  • give it a fixed IP
  • use it's hostname for DNS resolution (dnsmasq can do this for example)
  • read/parse/grep the lease files or something

If that isn't possible or not wanted, you can boot it up at a screen and run ifconfig, there you'll see the MAC address (e.g. ether 01:24:de:ad:be:ef). Note that.
You can then (assuming you are on the same network when it does some network operations, like renewing the DHCP lease) use things like arp (Address Resolution Protocol; the protocol making a MAC from an IP) or rarp (Reverse ARP).

Copying files can then be done easily using SSH/SFTP (using e.g. scp), or, if it doesn't need to be encrypted, netcat.
Netcat would be something like nc -q1 -lp 1337 >file on the RPi and nc -q1 $IP_OF_RPI 1337 <file locally.