Beginners Guide: Locating your board, connecting to it.
#4
Setting up a Static IP and fixing DNS issues


Preface 

Some use cases require that you keep a static IP address, and dont work well with hostnames. This guide will show you how to set up a static IP address and to fix up DNS issues that are commonly caused by that. 

You'll need be logged in to your device and before you start changing anything, you'll need to collect some information. 

The first command is 


Code:
ip a 

OR 


Code:
ip addr


You'll get something like the following. Note down the Gateway as well as the Subnet Number. 

[Image: PTyBQKM.png]

You'll need to modify the network interfaces file in order to set a static IP address. 

Code:
sudoedit /etc/network/interfaces

Insert your password and it should open up to the text editor interface you've become quite familiar with. You'll need to comment out the last line, and add your own settings. Mine are shown below: 

[Image: BAGOo6g.png?1]


Code:
    auto eth0
    iface eth0 inet static
        address 192.168.1.128
        netmask 255.255.255.0
        gateway 192.168.1.1
        dns-nameservers 8.8.8.8 8.8.4.4

Address is what you'd like your IP address to be. Normally its in the range of 192.168.1.xxx where xxx is a number between 1-254. You can use a Network scanning app, like Fing, the one I showed in the first part of this guide, to see what IP addresses are occupied. 


I dont know enough to know exactly what a netmask is, however, if your IP address had a "/24" after it, as shown above, the netmask would be 255.255.255.0

The gateway is what was shown in the command "ip route", write down its value here. In my case it was 192.168.1.1

The DNS nameserver simply tells your computer where to go to see what human readable URL corresponds to what IP address. I personally use Googles Nameservers, you can use that, or you can select one from the handy list here: https://www.lifewire.com/free-and-public...rs-2626062



Fill in the details, then save and exit the editor. Restart your device using the following command: 


Code:
sudo reboot

Wait a minute or so for it to boot up. If you want to see if its on the network with the new IP address address before trying to SSH into it, you can do so using a network scanning up, like FING, the same app I used in the first part of the guide. You should do a new scan and you will see your board occupying the new IP address you set. 

 
SSH in, using either your newly set IP address or your Hostname. Now its time to check if WAN (internet) access still works. 

We are going to ping googles DNS servers (any IP address SHOULD work) for this.

Code:
rock64@rock64:~$ ping 8.8.4.4 
PING 8.8.4.4 (8.8.4.4) 56(84) bytes of data.
64 bytes from 8.8.4.4: icmp_seq=1 ttl=57 time=19.8 ms
64 bytes from 8.8.4.4: icmp_seq=2 ttl=57 time=11.9 ms
64 bytes from 8.8.4.4: icmp_seq=3 ttl=57 time=11.3 ms
64 bytes from 8.8.4.4: icmp_seq=4 ttl=57 time=12.3 ms
64 bytes from 8.8.4.4: icmp_seq=5 ttl=57 time=12.4 ms
64 bytes from 8.8.4.4: icmp_seq=6 ttl=57 time=14.9 ms
^C
--- 8.8.4.4 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 11.394/13.836/19.891/2.927 ms


The "^C" key shown there is simply holding down Control and pressing C. This send the program a "SIGINT" which asks the program to "end" or "stop". 

This command shows that we can communicate with Googles DNS servers, which means that the internet is working.  To see confirm that the DNS service is working, redo the ping command, but use a text URL instead: 


 
Code:
rock64@rock64:~$ ping www.pine64.org
PING www.pine64.org (104.31.70.111) 56(84) bytes of data.
64 bytes from 104.31.70.111: icmp_seq=1 ttl=51 time=106 ms
64 bytes from 104.31.70.111: icmp_seq=2 ttl=51 time=108 ms
64 bytes from 104.31.70.111: icmp_seq=3 ttl=51 time=109 ms
64 bytes from 104.31.70.111: icmp_seq=4 ttl=51 time=115 ms
64 bytes from 104.31.70.111: icmp_seq=5 ttl=51 time=109 ms
64 bytes from 104.31.70.111: icmp_seq=6 ttl=51 time=107 ms
^C
--- www.pine64.org ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 106.631/109.628/115.740/2.966 ms
rock64@rock64:~$ 


You have now successfully assigned a static IP address to your board, and ensured that the internet is accessible and that the DNS service is working properly.
  Reply


Messages In This Thread
Connecting to your board via SSH - by Ptheven - 08-08-2017, 05:17 AM
Setting up a Hostname - by Ptheven - 08-08-2017, 06:53 AM
Setting up a Static IP and DNS server - by Ptheven - 08-08-2017, 08:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Information Beginners Guide: Adding USB Storage, Linux Formatting and Permissions Ptheven 4 7,006 03-06-2021, 01:49 PM
Last Post: helpmerock
  Step by step guide PXE diskless configuration. burglar_ot 13 13,886 11-01-2020, 11:26 PM
Last Post: michael.gruner
  Beginners Guide: Migrating to SSD rontant 17 21,301 05-24-2019, 12:23 PM
Last Post: thatchunkylad1989
Thumbs Up A guide for how I made RetroPie, RetroArch, and EmulationStation Work on the Rock64 Mrfixit2001 4 10,219 12-17-2018, 03:52 AM
Last Post: va88
  Guide - XRDP - Debian Stretch / Ubuntu Xenial / OMV S3phi40T 3 9,951 05-05-2018, 06:08 AM
Last Post: S3phi40T
Information Guide - Raid Array (Raid 0) Ptheven 0 3,031 10-07-2017, 09:22 AM
Last Post: Ptheven
Information Guide - Setting up a NFS Share Ptheven 0 3,601 09-26-2017, 04:44 AM
Last Post: Ptheven
  Guide - Setting up a SMB(Windows) file server Ptheven 0 10,179 08-21-2017, 08:54 AM
Last Post: Ptheven

Forum Jump:


Users browsing this thread: 1 Guest(s)