LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-25-2010, 08:08 PM   #1
lemon09
Member
 
Registered: Jun 2009
Location: kolkata,India
Distribution: Mandriva,openSuse,Mint,Debian
Posts: 285
Blog Entries: 1

Rep: Reputation: 37
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.
 
Old 01-25-2010, 08:21 PM   #2
bsdunix
Senior Member
 
Registered: May 2006
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761

Rep: Reputation: 80
Looks like your answer is here:

http://expert.mandriva.com/question/76893
 
Old 01-27-2010, 06:39 AM   #3
lemon09
Member
 
Registered: Jun 2009
Location: kolkata,India
Distribution: Mandriva,openSuse,Mint,Debian
Posts: 285

Original Poster
Blog Entries: 1

Rep: Reputation: 37
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
 
Old 01-27-2010, 06:48 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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.
 
Old 01-27-2010, 08:23 AM   #5
eyemole80
Member
 
Registered: Jun 2004
Distribution: Fedora Core 1
Posts: 47
Blog Entries: 1

Rep: Reputation: 16
in /etc/sysconfig/network*/ifcfg-eth0 file add following line

peerdns = no
 
Old 01-27-2010, 02:44 PM   #6
bskrakes
Member
 
Registered: Sep 2006
Location: Canada, Alberta
Distribution: RHEL 4 and up, CentOS 5.x, Fedora Core 5 and up, Ubuntu 8 and up
Posts: 251

Rep: Reputation: 32
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.

Last edited by bskrakes; 01-27-2010 at 02:44 PM. Reason: type'O
 
Old 01-28-2010, 02:54 PM   #7
lemon09
Member
 
Registered: Jun 2009
Location: kolkata,India
Distribution: Mandriva,openSuse,Mint,Debian
Posts: 285

Original Poster
Blog Entries: 1

Rep: Reputation: 37
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!!!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set DNS servers? How to stop auto change of DNS servers? newtovanilla Linux - Newbie 1 10-29-2008 09:19 PM
change DNS without rebooting javeree Linux - Networking 5 12-01-2004 10:03 PM
how can i change dns in mandrake10 piton Linux - Networking 1 10-06-2004 09:40 AM
change port# response from dns charon's coin Linux - Networking 1 08-24-2003 08:44 PM
Change dns ip guanyu Linux - Networking 4 08-19-2003 02:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration