Skip to Content
Raspberry Pi 3 Cookbook for Python Programmers - Third Edition
book

Raspberry Pi 3 Cookbook for Python Programmers - Third Edition

by Steven Lawrence Fernandes, Tim Cox
April 2018
Beginner content levelBeginner
552 pages
13h 58m
English
Packt Publishing
Content preview from Raspberry Pi 3 Cookbook for Python Programmers - Third Edition

How to do it...

To set the network interface settings, edit /etc/network/interfaces using the following code:

sudo nano /etc/network/interfaces  

Now perform the following steps:

  1. We can add the details for our particular network, the IP address number we want to allocate to it, the netmask address of the network, and the gateway address, as follows:
iface eth0 inet static
  address 192.168.1.10
  netmask 255.255.255.0
  gateway 192.168.1.254
  
  1. Save and exit by pressing Ctrl + X, Y, and Enter.
  2. To set the name servers for DNS, edit /etc/resolv.conf using the following code:
sudo nano /etc/resolv.conf
  
  1. Add the addresses for your DNS servers as follows:
nameserver 8.8.8.8
nameserver 8.8.4.4  
  1. Save and exit by pressing Ctrl + X, Y, and Enter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Raspberry Pi for Python Programmers Cookbook - Second Edition

Raspberry Pi for Python Programmers Cookbook - Second Edition

Tim Cox

Publisher Resources

ISBN: 9781788629874Supplemental Content