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 02-28-2002, 08:16 PM   #1
diveguy
LQ Newbie
 
Registered: Feb 2002
Location: Near St Louis, MO
Posts: 18

Rep: Reputation: 0
nic card and dns


Hi,
I need to know how to automatically set the dns name server for the nic card using command line or a script. I have the nic card loading fine using the /etc/sysconfig/network-scripts/ifcfg-eht0 file. I have routes loading fine using the /etc/rc.d/rc.local file. I know the dns ip goes in the /etc/resolv.conf file. What I want is to not have to manually put that into the file. Is there a way like the ip address and routes to automatically have it added?
 
Old 02-28-2002, 08:40 PM   #2
Malicious
Member
 
Registered: Jan 2002
Location: Galveston Island
Distribution: suse, redhat
Posts: 208

Rep: Reputation: 30
Add a line to the /etc/sysconfig/network file that has:

DNSSRVRS 192.168.0.1 192.168.100.1

Substitute your nameserver ip(s) as appropriate. The /etc/sysconfig/network-scripts/ifup script reads this file and creates /etc/resolv.conf. You may want to check that script and make sure my spelling is correct.
 
Old 02-28-2002, 09:05 PM   #3
diveguy
LQ Newbie
 
Registered: Feb 2002
Location: Near St Louis, MO
Posts: 18

Original Poster
Rep: Reputation: 0
That didn't do anything. I went to /etc/sysconfig/network...added DNSSRVRS 192.168.0.33, saved it and rebooted but it wasn't in the resolv.conf file. And I couldn't ping anything by name.
 
Old 02-28-2002, 09:33 PM   #4
Malicious
Member
 
Registered: Jan 2002
Location: Galveston Island
Distribution: suse, redhat
Posts: 208

Rep: Reputation: 30
Oops, you also need to add a line to the /etc/sysconfig/network that says:

SEARCH domain.com

with your domain name.

Sorry, forgot about that.
 
Old 03-04-2002, 07:56 AM   #5
diveguy
LQ Newbie
 
Registered: Feb 2002
Location: Near St Louis, MO
Posts: 18

Original Poster
Rep: Reputation: 0
Added that SEARCH degree.com to the network file and it still did not do anything. If I manually add the nameserver and search info to the resolv.conf file everything works perfectly. But adding those lines to the network file make no changes to resolv.conf.
 
Old 03-04-2002, 08:22 AM   #6
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
I think that depends on which distribution you use. You could easily check the ifup script to see if it does anything with the DNSSRVRS variable. You could always add it to the ifup script yourself.

Something like this might work:

if [ "$DNSSRVRS" != "" ]
then
mv /etc/resolv.conf /etc/resolv.conf.sv

for dnsserver in $DNSSRVRS
do
echo nameserver $dnsserver >> /etc/resolv.conf
done

echo search $SEARCH >> /etc/resolv.conf

fi


You'd have to set the SEARCH variable to the right value. I also haven't tested it so you might need to check it to make sure it all works right.
 
  


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
eth0 NIC Card Not Working! 3com 3c501 NIC. Mustard010 Linux - Networking 16 08-15-2007 02:22 AM
NIC card 1_8_7 Slackware 10 02-18-2005 06:37 PM
2 NIC DNS Configuration adham1sa Linux - Networking 4 12-22-2004 03:45 AM
two public ips on one nic for home office dns servers rioguia Linux - Networking 12 08-19-2004 03:59 PM
Setting DNS route on wireless NIC crunchywelch Linux - Wireless Networking 5 08-18-2003 08:17 PM

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

All times are GMT -5. The time now is 07:16 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