LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-18-2004, 02:12 PM   #1
Kane635
Member
 
Registered: Jul 2004
Posts: 36

Rep: Reputation: 15
DHCP Problems - Script?


[kane@localhost kane]$ su
Password:
[root@localhost kane]# cat /etc/resolv.conf
nameserver 192.168.1.1
[root@localhost kane]#
nameserver 64.78.119.1
nameserver 64.78.119.2
search localhost
[root@localhost kane]# vi /etc/resolv.conf
[root@localhost kane]# cat /etc/resolv.conf
nameserver 64.78.119.1
nameserver 64.78.119.2
search localhost
[root@localhost kane]#

Anyway, I don't want toe 192.168.1.1 there. Its my firewall, and the DNS request goes to that first, then the others, making my DNS problem about 15 seconds in timeout. Anyone give me a script to remove the first line of /etc/resolv.conf at startup?
 
Old 09-18-2004, 02:56 PM   #2
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
Why make a script to do that when you can just set the DHCP server to give out the right nameservers to begin with?

Anyway, try:
Code:
#!/bin/bash
if grep -q "192\.168\.1\.1" /etc/resolv.conf; then
  sed -e "s/nameserver 192\.168\.1\.1//g" /etc/resolv.conf > /tmp/newresolv
  # If you don't like sed, you could use the next line instead:
  # grep -v "192\.168\.1\.1" /etc/resolv.conf > /tmp/newresolv
  mv /tmp/newresolv /etc/resolv.conf
fi
 
Old 09-18-2004, 04:17 PM   #3
Kane635
Member
 
Registered: Jul 2004
Posts: 36

Original Poster
Rep: Reputation: 15
Woot!

I can't configure the DHCP server to not retreive from my firewall, even though it doesn't serve as a DNS server. =.= I don't know why. + Where do I stick the script to boot on start?
 
Old 09-18-2004, 04:42 PM   #4
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
What is in your dhcpd.conf? It shouldn't give out anything you don't tell it to.

As for the script... this might be different on your distribution, but save it wherever you like... if you save it as /etc/network/fixdhcp, edit your /etc/network/interfaces file to look like this:

Code:
iface eth0 inet dhcp
  up /etc/network/fixdhcp
Test it with "ifdown eth0; ifup eth0"
 
  


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
DHCP problems - multiple DHCP servers sat86 Linux - Networking 4 10-02-2005 05:43 AM
DHCP Script FlameKhan Linux - Networking 6 09-05-2005 01:30 AM
DHCP Problems jmoulinier Linux - Networking 3 07-02-2004 12:25 PM
firewall script. DHCP? e1000 Linux - Networking 1 11-08-2003 08:13 AM
XP Pro Build 2600/sp1 v.1105 DHCP Client to Redhat 8.0 DHCP Server - Problems atomant Linux - Networking 5 06-28-2003 11:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:35 AM.

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