I have a laptop (Ubuntu), two Pi (Raspbian and Arch) and a Netgear FS108 network switch. I can make any of the computers communicate via WiFi, but I want them to communicate via the switch (wired). I've been told that I need to assign IP addresses, but I don't know how to go about it. What should I do?
Simplest way would be that you plug your router (or whatever you used for wireless) into switch because it looks like your wireless router was DHCP server in that network. It should work automatically.
-
Sorry for not mentioning, but the problem is that I need the system to be portable, i.e work away from the router I have. Can I be sure that it'll work when I take it into school if I'm relying on my home router? – James Wood Mar 10 '14 at 15:03
-
That is exactly what DHCP is for. Virtually all networks (unless they are secured for some special purpose) use DHCP. If you did allocate static addresses you would have to assign different values for each network. – Milliways Mar 11 '14 at 1:35
-
@James Wood you can just bring your router from home to school and you will have DHCP addresses. Another way I would go is to install DHCP server to one of your RPIs, you can find tutorials for that online. – 10robinho Mar 11 '14 at 9:58
The simple approach is to let all hosts attached to your switch generate link-local addresses IPv4. They are in the 169.254/16 block. OS X and Windows hosts will do this by default in absence of a DHCP server.
On Linux, some distributions don't enable this functionality by default so you need to set it up by hand. It is known as Zero Configuration Networking. I thought Ubuntu came with Avahi already installed, but perhaps it's not running?
# install avahi
sudo apt-get install avahi-daemon
# set up a low-priority route
route add default dev eth0 metric 99
route add -net 169.254.0.0 netmask 255.255.0.0 dev eth0 metric 99
# run the auto-ip daemon
/usr/sbin/avahi-autoipd --daemonize --syslog --wait eth0
To check what hosts are present, from Linux you can do a broadcast ping:
ping -b 169.254.255.255
-
None of my Linuxes seem to be doing that. I ran this command on my laptop (but with
eth0
rather thaneth4
), and it changed some of the output ofifconfig
. But it doesn't seem to have helped. – James Wood Mar 10 '14 at 23:02 -
@JamesWood The command you refer to assigns an IPv6 address. – Kuba hasn't forgotten Monica Mar 11 '14 at 3:54
-
1I ran all of those commands (
sudo
ed) but they didn't make a difference.avahi
was already installed, and I think was running anyway. Just plugging in the router (as per the other answer) worked. Thanks anyway. – James Wood Mar 11 '14 at 22:01
DHPC
in the switch should allocate addresses. – Milliways Mar 9 '14 at 23:39