New to Pi, but want to be able to connect two Pi’s together using an ethernet and communicate with each other.
How would I do this?
New to Pi, but want to be able to connect two Pi’s together using an ethernet and communicate with each other.
How would I do this?
If you connect them with a simple CAT5 cable (568A to 568A or 568B to 568B, no crossover needed) then assign an IP address on each end of the link it will "just work".
The system will assign an IP address from 169.254.xxx.xxx
automatically by default, but that's a pain as you have to find the new IP address each time you reboot either system. Setting a static IP address is easy.
Use sudo ip addr add 192.168.137.1 dev eth0
on one RPi and sudo ip addr add 192.168.137.2 dev eth0
on the other to give them both fixed IP addresses.
Or add these lines in /etc/dhcpcd.conf (on RPi1)
interface eth0
static ip_address=192.168.137.1/24
static routers=192.168.137.1
and these lines on RPi2
interface eth0
static ip_address=192.168.137.2/24
static routers=192.168.137.2
Reboot or restart dhcpcd5 to get those new fixed IP addresses activated.