July 31, 2019

How to change DNS server in CentOS 7

IP and Gateway configuration
With this 2 commands you can see centos network configurations

     nano /etc/sysconfig/network-scripts/ifcfg-eth0
     vi /etc/sysconfig/network-scripts/ifcfg-eth0

the result of this commands should be sommthing like this

DEVICE=eth0
TYPE=Ethernet
UUID=281a600c-aaba-4297-bf51-15b18d2d8619
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=23.227.x.x
PREFIX=26
GATEWAY=23.227.x.x
DNS1=4.2.2.4
DOMAIN=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:50:56:B0:4D:D6
LAST_CONNECT=1410687738

2 important element that you should change are IPADDR &  GATEWAY
to change the ip address change the value of IPADDR and to change gateway change the value of GATEWAY

Gateway Configuration
With this 2 commands you can see centos Gateway configurations

        nano /etc/sysconfig/network
        vi /etc/sysconfig/network
the result of this commands should be sommthing like this

NETWORKING=yes
HOSTNAME=server.domain.com
GATEWAY=23.227.x.x
you can change the Gateway by editing the value of GATEWAY

Configure DNS Server
With this 2 commands you can see centos Gateway configurations

         nano /etc/resolv.conf
         vi /etc/resolv.conf
the result of this commands should be sommthing like this
nameserver 8.8.8.8
nameserver 192.168.1.1
you can change the values for dns servers


No comments:

Post a Comment

How to Install Docker CE on CentOS 8 and RHEL 8

  Docker  is a daemon-based container engine which allows us to deploy applications inside containers.  Docker is available in two versions,...