Getting Started with Python for the Internet of Things
上QQ阅读APP看书,第一时间看更新

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.