Hardware Reference
In-Depth Information
In this example, we see that
google.com
was looked up and translated to the IP
address 74.125.226.4. From this, we conclude that the name service is working. The
-c1
option on the
ping
command line causes only one ping to be performed. Otherwise,
ping
will keep trying, and you may need to
^C
to interrupt its execution.
If the name
google.com
does not resolve, you'll need to troubleshoot
/etc/resolv.conf
. As a last resort, you might switch back to using DHCP (
interfaces.bak
)
and reboot. If the
/etc/resolv.conf
file is updated with new parameters,
you might try again.
USB Adapters
If you have a USB Ethernet adapter (non-wireless), you can set up networking for that
also. The following line added to
/etc/network/interfaces
will cause it to use DHCP:
iface usb0 inet dhcp
For a fixed
usb0
IP address, configure as we did earlier (for
eth0
). For example:
iface usb0 inet static
address 192.168.0.178
gateway 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
This provides interface
usb0
with a fixed address of 192.168.0.178.
/etc/hosts File
If you have a static IP address for your Raspberry Pi, why not update your Linux, OS X,
or Windows hosts file (typically,
C:\Windows\system32\drivers\etc\hosts
) with a
hostname for it? For example, your hosts file could have the following line added:
$ cat /etc/hosts
. . .
192.168.0.177 rasp raspi rpi pi # My Raspberry Pi
Now you can use a hostname of
rasp
,
raspi
,
rpi
, or
pi
to access your Raspberry Pi
on the network.
Wireless Ethernet
If you haven't already done so, review the “Powered Hubs” section of Chapter 6. Wi-Fi
adapters can require 350 mA to 500 mA of current draw.