LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to change the DNS (https://www.linuxquestions.org/questions/linux-networking-3/how-to-change-the-dns-784726/)

lemon09 01-25-2010 08:08 PM

How to change the DNS
 
Hello friends!!!

can anybody tell me how to change the DNS in Mandriva Linux.
I tried to change it from the file
Code:

/etc/resolv.conf
but the thing is that when I restarted the network after the configuration the DNS was again rolled back to the previous setting.
How can I change the setting permanently.

bsdunix 01-25-2010 08:21 PM

Looks like your answer is here:

http://expert.mandriva.com/question/76893

lemon09 01-27-2010 06:39 AM

I followed the link:
http://expert.mandriva.com/question/76893

But the code snippet presented over there is quite different from mine. In my machine it looks like the following:

Code:

make_resolv_conf() {
  local d
  local ns
 
  if [ -n "$DOMAIN" ]; then
    d="search $DOMAIN"
  fi

  if [ x"$new_domain_name_servers" != x ]; then
    if [ -n "$DOMAIN" ]; then
    # already done above
    d="search $DOMAIN"
    elif [ x"$new_domain_search" != x ]; then
      d="search $new_domain_search"
    elif [ x"$new_domain_name" != x ]; then
      # Note that the DHCP 'Domain Name Option' is really just a domain
      # name, and that this practice of using the domain name option as
      # a search path is both nonstandard and deprecated.
      d="search $new_domain_name"
    fi
    for nameserver in $new_domain_name_servers; do
      ns="$ns"$'\n'"nameserver ${nameserver}"
    done

  elif [ "x${new_dhcp6_name_servers}" != x ] ; then

    if [ -n "$DOMAIN" ]; then
    # already done above
    d="search $DOMAIN"
    elif [ "x${new_dhcp6_domain_search}" != x ] ; then
      d="search ${new_dhcp6_domain_search}"
    fi
    for nameserver in ${new_dhcp6_name_servers} ; do
      ns="$ns"$'\n'"nameserver ${nameserver}"
    done
  fi

  if [ -n "$d" -o -n "$ns" ]; then
    change_resolv_conf "$d" "$ns"
  fi

}


Now the thing is that I use DHCP for my network configuration and I want to change the DNS. I try to change it in /etc/resolv.conf but the change is not reflected when I reboot.
How can I change the script.

Please help!!!!!!!!!!11

pixellany 01-27-2010 06:48 AM

By default, I think DHCP automatically detects the DNS addresses and updates resolv.conf. I've seen settings to disable this, but I don't know where it shows up in config files.

eyemole80 01-27-2010 08:23 AM

in /etc/sysconfig/network*/ifcfg-eth0 file add following line

peerdns = no

bskrakes 01-27-2010 02:44 PM

I think this will work in your version of Linux (Mandriva) from the command line type:
Quote:

system-config-network
If you are doing it from the GUI open the terminal and type:
Quote:

system-config-network-tui
From this system-config tool you change your IP Address and DNS configuration.

lemon09 01-28-2010 02:54 PM

well thanks for all your help s but the problem is not yet solved!!!!!!

firstly @ bskrakes
Code:

system-config-network
no such file exists

@eyemole80
I think yours shall help. Though the problem is not with eth0 but with ppp0...yet I have changed accordingly!!!!


All times are GMT -5. The time now is 06:46 AM.