1

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?

  • Welcome to Raspberry Pi Stack Exchange! While we want to help you solve your issue, it's kind of hard to tell what you want in this context. Do you want help setting up static IPs on all of your computers (2 Pis & Ubuntu laptop) or just on the Pi? If you could clarify that, we should be able to address your issue directly regarding the Pi. As it is now your issue would require an answer for each OS, including one that is Off-topic here. Thanks! – RPiAwesomeness Mar 9 '14 at 20:42
  • Sorry for being vague. I'm asking about all 3 computers, so should this question be moved somewhere else? Thanks. – James Wood Mar 9 '14 at 21:18
  • Not necessarily. If you edit your question to ask how to set a static IP for the Pis, ignoring the Ubuntu laptop, then it's perfectly fine. You could then ask how to set a static IP on Ubuntu over on askubuntu.com. – RPiAwesomeness Mar 9 '14 at 22:45
  • 1
    You shouldn't have to do anything. Just plug in and DHPC in the switch should allocate addresses. – Milliways Mar 9 '14 at 23:39
  • @Milliways the correct protocol name is DHCP =) – lenik Mar 11 '14 at 1:25
1

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
1

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 than eth4), and it changed some of the output of ifconfig. 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 Ober Mar 11 '14 at 3:54
  • 1
    I ran all of those commands (sudoed) 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.