I set-up two raspberry pi's and have been able to connect to them one at a time at my home network by setting-up SSH. What I now want to do is connect them to a desktop switch and connect the desktop switch to my Mac. I would like to be able to thus control both raspberry pis over their connection using the ethernet cables but without having a wireless or internet connection (to a router). I cannot find anywhere how I can make this possible and how I would connect to the raspberry pis. At my home network I simply open-up terminal, type in SSH [email protected] and have access to the RPi, but when my wifi is off and I use the desktop switch I cannot connect.
1 Answer
You have to ensure that all the devices on the switch have the same ip address range and netmask.
These particulars are usually handled by a router via DHCP but you are free to set these values manually on each device or run your own DHCP server(never tried that).
Based on the ip 192.168.2.2 for Pi1 you would want an address of 192.168.2.n for Pi2 and another 192.168.2.n address for the Mac. This is achieved with a netmask of 255.255.255.0
e.g.
Pi1
sudo ifconfig eth0 192.168.2.2 netmask 255.255.255.0
Pi2
sudo ifconfig eth0 192.168.2.3 netmask 255.255.255.0
Mac
ifconfig eth0 192.168.2.4 netmask 255.255.255.0
(I do not know if you need sudo on a Mac).