DNS, Changing your

From PCLinuxOSHelp Knowledge Base
Jump to: navigation, search

Here is a simple way to change your DNS numbers.

In your favorite text editor open the /etc/sysconfig/network-scripts/ifcfg-xxxx where as ifcfg.xxxx could be ppp0, eth0 or wlan0 as the root user.

In our example we will be using a command line editor called nano. Also since I am using a Ethernet connection I will be using ifcfg-eth0


First change to the root user using "SU"

[dwmoar@workbox ~]$ su
Password: Note: Your password will not be displayed on the screen

Now open the ifcfg-eth0 file using nano

[root@workbox dwmoar]# nano /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.25
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=yes
DNS1=192.168.1.1  <--- note existing DNS number
RESOLV_MODS=no
IPV6INIT=no
IPV6TO4INIT=no
ACCOUNTING=yes

Now to this we want to add our new DNS number. Add the following lines if they are not already there. If they are there than just change the numbers. Normally the DNS is set to your ISP DNS or that of your Modem/Router


DNS1=208.67.222.222 <-- Open DNS servers
DNS2=208.67.220.220 <-- Open DNS servers

These could be any public DNS server numbers such as Google 4.4.4.4 or 4.4.2.2

When you are finished you file should look something like this

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.25
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=no
USERCTL=yes
DNS1=208.67.222.222     <-- your new DNS Numbers
DNS2=208.67.220.220     <-- your new DNS Numbers
RESOLV_MODS=no
IPV6INIT=no
IPV6TO4INIT=no
ACCOUNTING=yes

Your DNS numbers may vary depending on which DNS server you have chosen to use. Save your file using <ctrl>+X. Now in order to make them active we need to restart our network. To do this from the console window enter the following command, followed by pressing the ENTER key,

service network restart

you should then see something like this

[root@workbox dwmoar]# service network restart
Shutting down interface eth0:                                                                                  [  OK  ]
Shutting down loopback interface:                                                                              [  OK  ]
Bringing up loopback interface:                                                                                [  OK  ]
Bringing up interface eth0:                                                                                    [  OK  ]
[root@workbox dwmoar]#

Now you are using your new DNS server numbers. These new DNS numbers will be used each and every time that you power on your computer.