Difference between revisions of "Networking"

imported>Handy
imported>Cscs
Line 1: Line 1:
= What's this all about? =
= What's this all about? =


Generally, if you are using a different Domain Name Server (DNS) than that provided by your ISP, or you are using the likes of Google's nameservers from your Google account you will find that your DNS or other non-standard nameserver addresses will, after you have set them up, get lost on reboot as '''/etc/resolv.conf''' is overwritten during the boot process.
Generally, if you are using a different Domain Name Server (DNS) than that provided by your ISP, or you are using the likes of Google's nameservers from your Google account you will find that your DNS or other non-standard nameserver addresses will, after you have set them up, get lost on reboot as '''/etc/resolv.conf''' can be overwritten by NetworkManager or during the boot process. Here we will look at 2 techniques to preserve your settings; resolvconf.conf from openresolv, and DHCP using resolv.conf.head/tail.  


== How do we solve this problem? ==
= openresolv and /etc/resolvconf.conf =
 
The resolvconf.conf file is a shell script that is sourced by resolvconf, meaning that resolvconf.conf must contain valid shell commands. Take a look at its [https://jlk.fjfi.cvut.cz/arch/manpages/man/resolvconf.conf.5 man page] for more details and commands.
The file is located at /etc/resolvconf.conf and will require root privelege to edit.
After making any changes simply update and apply your settings with the following command
 
sudo resolvconf -u
 
(note - changes will take effect immediately)
 
== Example ==
 
For this example we will prepend OpenDNS nameservers to the top of our resolvconf file whenever called.
We can achieve this by adding the following lines to the bottom of resolvconf.conf and running the update command.
 
# OpenDNS servers
name_servers="208.67.222.222 208.67.220.220"
 
= DHCP and resolv.conf.head/tail =


We can input our settings to the '''/etc/resolv.conf.head''' file. If this file does not exist then create it. The contents of '''/etc/resolv.conf.head''' get sent to the top of '''/etc/resolv.conf''' during the boot process.
We can input our settings to the '''/etc/resolv.conf.head''' file. If this file does not exist then create it. The contents of '''/etc/resolv.conf.head''' get sent to the top of '''/etc/resolv.conf''' during the boot process.


== Examples please? ==
== Examples ==


To use the Google nameservers associated with your Google account, you would add the following to '''/etc/resolvconf.conf'''  
To use the Google nameservers associated with your Google account, you would add the following to '''/etc/resolv.conf.head'''  


  # Google nameservers
  # Google nameservers
Line 27: Line 45:
  nameserver 77.109.139.29
  nameserver 77.109.139.29


== If Pacman times out on you sometimes ==
== /etc/resolv.conf.tail (for when pacman times out) ==


You can create the '''/etc/resolv.conf.tail''' file & add the following to it, (I'm using the OpenDNS address, you could use any other DNS or nameserver that you have access to):
You can create the '''/etc/resolv.conf.tail''' file & add the following to it, (I'm using the OpenDNS address, you could use any other DNS or nameserver that you have access to):
Anonymous user