
P A R T I
C O N N E C T I N G T H E B O A R D
76
If you need to return to automatic settings via DHCP, you need to edit the
interfaces
file
again and delete the
address
,
netmask
and
gateway
settings. Replace
static
with
dhcp
at the end of the
iface
line, and then restart the networking service again.
Setting a manual IP address isn’t quite enough to get your Pi connected to the outside world.
Computers on modern networks have both a numerical address identifier—known as an IP
address—and a hostname or domain name. It’s this latter, friendly name that allows you
simply to type
www.raspberrypi.org
into your browser, instead of trying to remember
93.93.128.176
.
A system called a
Domain Name Service (DNS) server
is responsible for looking up the friendly
names you supply and converting them into the numbers required to access the system. It
operates much like an automated telephone directory. Before you’ll be able to access Internet-
connected systems via their domain names, you’ll need to tell the Pi which DNS servers to use.
The list of DNS servers, known as
nameservers
in Linux parlance, is stored in
/etc/resolv.
conf
. When the system gets its details through DHCP, this file is automatically filled in; but
when you set an address manually, you need to provide the addresses of the nameservers on
your network. Normally, this would be the address of your router as found in the
gateway
line from the
interfaces
file (described earlier in this chapter).
To set the nameservers, open the file with
nano
by typing the following command at the
terminal:
sudo nano /etc/resolv.conf
Add each nameserver on a separate line, prefaced with
nameserver
and a space. As an
example, the
resolv.conf
configuration for a network that uses Google’s publicly accessi-
ble nameservers to resolve domain names would appear like this:
nameserver 8.8.8.8
nameserver 8.8.4.4
You’ll notice that the nameserver addresses need to be supplied as IP addresses, rather than
domain names. If you provided domain names instead, the Pi would enter an infinite loop of
trying to find a nameserver to ask how it can find the nameservers.
Save the file by pressing CTRL + O, and then quit
nano
by pressing CTRL + X. Restart the
networking interface by typing the following:
sudo /etc/init.d/networking restart
Содержание A
Страница 1: ......
Страница 2: ......
Страница 3: ...Raspberry Pi User Guide 2nd Edition...
Страница 4: ......
Страница 5: ...Raspberry Pi User Guide 2nd Edition Eben Upton and Gareth Halfacree...
Страница 10: ......
Страница 26: ...R A S P B E R R Y P I U S E R G U I D E S E C O N D E D I T I O N 10...
Страница 28: ......
Страница 29: ...Chapter 1 Meet the Raspberry Pi...
Страница 37: ...Chapter 2 Getting Started with the Raspberry Pi...
Страница 56: ......
Страница 57: ...Chapter 3 Linux System Administration...
Страница 79: ...Chapter 4 Troubleshooting...
Страница 89: ...Chapter 5 Network Configuration...
Страница 109: ...Chapter 6 The Raspberry Pi Software Configuration Tool...
Страница 122: ......
Страница 123: ...Chapter 7 Advanced Raspberry Pi Configuration...
Страница 140: ......
Страница 141: ...Chapter 8 The Pi as a Home Theatre PC...
Страница 151: ...Chapter 9 The Pi as a Productivity Machine...
Страница 159: ...C H A P T E R 9 T H E P I A S A P R O D U C T I V I T Y M A C H I N E 143 Figure 9 4 Exporting a file from The Gimp...
Страница 160: ......
Страница 161: ...Chapter 10 The Pi as a Web Server...
Страница 171: ...Part III Programming with the Raspberry Pi Chapter 11 An Introduction to Scratch Chapter 12 An Introduction to Python...
Страница 172: ......
Страница 173: ...Chapter 11 An Introduction to Scratch...
Страница 189: ...Chapter 12 An Introduction to Python...
Страница 216: ......
Страница 218: ......
Страница 219: ...Chapter 13 Learning to Hack Hardware...
Страница 234: ......
Страница 235: ...Chapter 14 The GPIO Port...
Страница 249: ...Chapter 15 The Raspberry Pi Camera Module...
Страница 265: ...Chapter 16 Add on Boards...
Страница 279: ...Part V Appendixes Appendix A Python Recipes Appendix B Camera Module Quick Reference Appendix C HDMI Display Modes...
Страница 280: ......
Страница 281: ...Appendix A Python Recipes...
Страница 287: ...Appendix B Raspberry Pi Camera Module Quick Reference...
Страница 293: ...Appendix C HDMI Display Modes...