Difference between revisions of "Guide:Setting up a Static IP and DNS"

Jump to navigation Jump to search
m
category, formatting, typos
(Created page with "==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...")
 
m (category, formatting, typos)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Setting up a Static IP and fixing DNS issues==
== Preface ==
 
Some use cases require that you keep a static IP address, and don't 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.  
 
 
'''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 about your current network configuration. In order to get the information, you can use either of the following commands:
You'll need be logged in to your device and before you start changing anything, you'll need to collect some information about your current network configuration. In order to get the information, you can use either of the following commands:
Line 22: Line 12:
  ip addr</tt>
  ip addr</tt>


You'll get output similar to the following. Note down the Gateway as well as the Subnet Number.
You'll also need to get the Gateway:


<tt>
ip route</tt>


[[File:Ip_addr_1.png|800px]]
You'll get output similar to the following. Note down the Gateway as well as the Subnet Number.  


[[File:Ip_addr_1.png|200px]]


You'll need to modify the network interfaces file in order to set a static IP address.  
You'll need to modify the network interfaces file in order to set a static IP address.  
Line 32: Line 25:
<tt>
<tt>
  sudoedit /etc/network/interfaces</tt>
  sudoedit /etc/network/interfaces</tt>


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:  
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:  


 
[[File:Interfaces_1.png|200px]]
[[File:Interfaces_1.png|800px]]
 


<tt>
<tt>
Line 48: Line 38:
         dns-nameservers 8.8.8.8 8.8.4.4</tt>
         dns-nameservers 8.8.8.8 8.8.4.4</tt>


'''Address''' is what you'd like your IP address to be. Normally it's 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, [http://wiki.pine64.org/index.php/Guide-Locating_your_device to see what IP addresses are occupied].  
'''Address''' is what you'd like your IP address to be. Normally it's 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, [[Guide:Locating_your_device|to see what IP addresses are occupied]].


 
I don't 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
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 '''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 [https://www.lifewire.com/free-and-public-dns-servers-2626062 handy list here].  
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 [https://www.lifewire.com/free-and-public-dns-servers-2626062 handy list here].  
 


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


<tt>
<tt>
  sudo reboot</tt>
  sudo reboot</tt>


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. You could do a new scan and you will see your board occupying the new IP address you set.  
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. You could 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.  
SSH in, using either your newly set IP address or your Hostname. Now its time to check if WAN (internet) access still works.  


Line 85: Line 70:
  6 packets transmitted, 6 received, 0% packet loss, time 5007ms
  6 packets transmitted, 6 received, 0% packet loss, time 5007ms
  rtt min/avg/max/mdev = 11.394/13.836/19.891/2.927 ms</tt>
  rtt min/avg/max/mdev = 11.394/13.836/19.891/2.927 ms</tt>


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".  
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:  
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:  
 
 
   
   
<tt>
<tt>
Line 107: Line 89:
  rtt min/avg/max/mdev = 106.631/109.628/115.740/2.966 ms
  rtt min/avg/max/mdev = 106.631/109.628/115.740/2.966 ms
  rock64@rock64:~$ </tt>
  rock64@rock64:~$ </tt>


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.
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.


== References ==
* Forum link: https://forum.pine64.org/showthread.php?tid=4868&pid=30226#pid30226


----
[[Category:Rock64]][[Category:Guide]]
 
'''References'''
 
Forum link: https://forum.pine64.org/showthread.php?tid=4868&pid=30226#pid30226
118

edits

Navigation menu