dhcp server and isp's dns...

This is a discussion on dhcp server and isp's dns... within the Linux Networking forums, part of the Linux Forums category; I'm setting up a router/dhcp server, and my router gets its IP and DNS info via DHCP from ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-30-2003
Luke
 
Posts: n/a
Default dhcp server and isp's dns...


I'm setting up a router/dhcp server, and my router gets its IP and DNS
info via DHCP from my ISP.

How can I pass the DNS info along to my clients when the DNS info is
dynamically assigned? I see in the DHCP howto that you can do it easily
if they are static, but what about dynamic?

And what's the best way to add the
/sbin/route add -host 255.255.255.255 dev eth1
thing automatically? In the /etc/init.d/dhcp script? I'm using debian,
and am worried that file will be overwritten every time dhcp is
updated via apt-get... is this a valid concern?

--
Luke StClair
run_faster@hotmail.com
PGP key: http://www.students.uiuc.edu/~clairst
Reply With Quote
  #2 (permalink)  
Old 12-30-2003
Andrey Asadchev
 
Posts: n/a
Default Re: dhcp server and isp's dns...

Luke wrote:
> I'm setting up a router/dhcp server, and my router gets its IP and DNS
> info via DHCP from my ISP.
>
> How can I pass the DNS info along to my clients when the DNS info is
> dynamically assigned? I see in the DHCP howto that you can do it easily
> if they are static, but what about dynamic?


I doubt the DNS servers of your provider will be changing IPs often
enough to cause your discomfort. They are dynamically assigned, yes -
but they are the same every time (unless the provider is doing something
really really weird). Get the nameservers IPs from /etc/resolv.conf on
the router and put them into /etc/dhcp(3)?/dhcpd.conf.

Alternatively you can setup your own DNS server. apt-get install bind9
will install DNS server. You dont really have to do anything besides
telling your client machines to use your internal DNS server. I.e: your
DNS server IP is 192.168.1.10. In dhcpd.conf put
"domain-name-servers 192.168.1.10;"


> And what's the best way to add the
> /sbin/route add -host 255.255.255.255 dev eth1
> thing automatically? In the /etc/init.d/dhcp script? I'm using debian,
> and am worried that file will be overwritten every time dhcp is
> updated via apt-get... is this a valid concern?
>


Why do you want to do that? Win98 and above work fine without it. Cant
say much about win95 since never had them on network.
In any case, edit your /etc/network/interfaces to read someting like

<snip>
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
up /sbin/route add -host 255.255.255.255 dev eth1
</snip>

"up" just tells the system to run command after the interface is up.
Guess what "down" does. :-)

> I'm using debian,
> and am worried that file will be overwritten every time dhcp is
> updated via apt-get... is this a valid concern?
>


Not a valid concern. How often is your dhcp updated anyways? Mine has
been updated only once since woody came out.
Reply With Quote
  #3 (permalink)  
Old 12-30-2003
Luke
 
Posts: n/a
Default Re: dhcp server and isp's dns...

On 2003-12-30, Andrey Asadchev <dont.spam.me@softhome.net> wrote:
> Luke wrote:
>> How can I pass the DNS info along to my clients when the DNS info is
>> dynamically assigned? I see in the DHCP howto that you can do it easily
>> if they are static, but what about dynamic?

>
> I doubt the DNS servers of your provider will be changing IPs often
> enough to cause your discomfort. They are dynamically assigned, yes -
> but they are the same every time (unless the provider is doing something
> really really weird). Get the nameservers IPs from /etc/resolv.conf on
> the router and put them into /etc/dhcp(3)?/dhcpd.conf.


How do my hardware routers handle this? Seems like it should be
possible with dhcpd, and its definitely the preferred behavior for me in
this case (though I do recognize that the DNS servers will change
infrequently).

>
> Alternatively you can setup your own DNS server. apt-get install bind9
> will install DNS server. You dont really have to do anything besides
> telling your client machines to use your internal DNS server. I.e: your
> DNS server IP is 192.168.1.10. In dhcpd.conf put
> "domain-name-servers 192.168.1.10;"
>


I may get around to this eventually, but ideally, i'd like to have as
few services as possible running on this new machine... so I'd like to
say no to this unless necessary...

>
>> And what's the best way to add the
>> /sbin/route add -host 255.255.255.255 dev eth1

>
> Why do you want to do that? Win98 and above work fine without it. Cant
> say much about win95 since never had them on network.
> In any case, edit your /etc/network/interfaces to read someting like
>

Quoted from DHCPd README:

In order for dhcpd to work correctly with picky DHCP clients (e.g.,
Windows 95), it must be able to send packets with an IP destination
address of 255.255.255.255. Unfortunately, Linux insists on changing
255.255.255.255 into the local subnet broadcast address (in this case,
the address would be 192.5.5.223). This results in a DHCP protocol
violation. While many DHCP clients don't notice the problem, some (e.g.,
all Microsoft DHCP clients) will recognize the violation. Clients that
have this problem will appear not to see DHCPOFFER messages from the
server.

</QUOTE>

So what I thought this meant was that "all Mircosoft DHCP clients" would
need this workaround, as mentioned above... sounds like from your post,
that this is not the case, however. I don't need to support win95, so I
guess I won't bother with it then.

><snip>
> iface eth0 inet static
> address 192.168.1.1
> netmask 255.255.255.0
> up /sbin/route add -host 255.255.255.255 dev eth1
></snip>
>
>
> Not a valid concern. How often is your dhcp updated anyways? Mine has
> been updated only once since woody came out.


Huh, I would've thought the /etc/init.d/dhcp scripts would have been
replaced each upgrade... thanks for the info

--
Luke StClair
run_faster@hotmail.com
PGP key: http://www.students.uiuc.edu/~clairst
Reply With Quote
  #4 (permalink)  
Old 12-30-2003
Andrey Asadchev
 
Posts: n/a
Default Re: dhcp server and isp's dns...

Luke wrote:
> On 2003-12-30, Andrey Asadchev <dont.spam.me@softhome.net> wrote:
>
>>Luke wrote:
>>
>>>How can I pass the DNS info along to my clients when the DNS info is
>>>dynamically assigned? I see in the DHCP howto that you can do it easily
>>>if they are static, but what about dynamic?

>>
>>I doubt the DNS servers of your provider will be changing IPs often
>>enough to cause your discomfort. They are dynamically assigned, yes -
>>but they are the same every time (unless the provider is doing something
>>really really weird). Get the nameservers IPs from /etc/resolv.conf on
>>the router and put them into /etc/dhcp(3)?/dhcpd.conf.

>
>
> How do my hardware routers handle this? Seems like it should be
> possible with dhcpd, and its definitely the preferred behavior for me in
> this case (though I do recognize that the DNS servers will change
> infrequently).


Not sure about your question. How to get the nameserver info from your
router?

> So what I thought this meant was that "all Mircosoft DHCP clients" would
> need this workaround, as mentioned above... sounds like from your post,
> that this is not the case, however. I don't need to support win95, so I
> guess I won't bother with it then.


I must have skipped that part of the HOWTO :-).
I have ran dhcpd v3 and v2 and Windows clients (98 and above) had no
problems at all. I am also using Debian Woody. If you do run into
trouble i guess it does not hurt to check that options as well.


> Huh, I would've thought the /etc/init.d/dhcp scripts would have been
> replaced each upgrade... thanks for the info


Debian policy
<snip>
The /etc/init.d scripts must be treated as configuration files, either
(if they are present in the package, that is, in the .deb file) by
marking them as conffiles, or, (if they do not exist in the .deb) by
managing them correctly in the maintainer scripts (see Configuration
files, Section 10.7). This is important since we want to give the local
system administrator the chance to adapt the scripts to the local
system, e.g., to disable a service without de-installing the package, or
to specify some special command line options when starting a service,
while making sure her changes aren't lost during the next package upgrade
</snip>




Reply With Quote
  #5 (permalink)  
Old 12-30-2003
James Knott
 
Posts: n/a
Default Re: dhcp server and isp's dns...

Luke wrote:

>
> I'm setting up a router/dhcp server, and my router gets its IP and DNS
> info via DHCP from my ISP.
>
> How can I pass the DNS info along to my clients when the DNS info is
> dynamically assigned? I see in the DHCP howto that you can do it easily
> if they are static, but what about dynamic?
>
> And what's the best way to add the
> /sbin/route add -host 255.255.255.255 dev eth1
> thing automatically? In the /etc/init.d/dhcp script? I'm using debian,
> and am worried that file will be overwritten every time dhcp is
> updated via apt-get... is this a valid concern?
>


While your IP is dynamic, your host name might not be. For example, my host
name is based on my computer mac address, which doesn't change. Failing
that, the Linux dhcp client can run a script, whenever the IP changes. You
should be able to do something with that, to update the DNS info.

--

Fundamentalism is fundamentally wrong.

To reply to this message, replace everything to the left of "@" with
james.knott.
Reply With Quote
  #6 (permalink)  
Old 12-30-2003
Luke
 
Posts: n/a
Default Re: dhcp server and isp's dns...

On 2003-12-30, Andrey Asadchev <dont.spam.me@softhome.net> wrote:
> Luke wrote:
>> On 2003-12-30, Andrey Asadchev <dont.spam.me@softhome.net> wrote:
>>
>>>Luke wrote:

>> How do my hardware routers handle this? Seems like it should be
>> possible with dhcpd, and its definitely the preferred behavior for me in
>> this case (though I do recognize that the DNS servers will change
>> infrequently).

>
> Not sure about your question. How to get the nameserver info from your
> router?


No, that was a bit unclear. What I meant was that all the hardware
routers I've ever owned have not had any difficulty getting DHCP and
nameserver information and passing them on to my client computers, even
with nameservers changing. So it seems like the most popular DHCP
servers on one of the most configurable operating systems should be able
to handle this as well, but I haven't seen/heard of how to do it yet....
anyone know how?

>
> Debian policy
><snip>


Nice... sounds good to me...


--
Luke StClair
run_faster@hotmail.com
PGP key: http://www.students.uiuc.edu/~clairst
Reply With Quote
  #7 (permalink)  
Old 12-30-2003
Luke
 
Posts: n/a
Default Re: dhcp server and isp's dns...

On 2003-12-30, James Knott <bit_bucket@rogers.com> wrote:
> Luke wrote:
>
>>
>> I'm setting up a router/dhcp server, and my router gets its IP and DNS
>> info via DHCP from my ISP.
>>
>> How can I pass the DNS info along to my clients when the DNS info is
>> dynamically assigned? I see in the DHCP howto that you can do it easily
>> if they are static, but what about dynamic?
>>
>> And what's the best way to add the
>> /sbin/route add -host 255.255.255.255 dev eth1
>> thing automatically? In the /etc/init.d/dhcp script? I'm using debian,
>> and am worried that file will be overwritten every time dhcp is
>> updated via apt-get... is this a valid concern?
>>

>
> While your IP is dynamic, your host name might not be. For example, my host
> name is based on my computer mac address, which doesn't change.


I don't quite understand what you're saying here... I want my router to
assign DHCP addresses and give DNS server addresses to its clients
(windows and linux). However, the DHCP server will get its IP from my
ISP, along with my ISP's current nameservers. My DHCP server will use
dyndns services to update the hostname/ip mapping...

> Failing
> that, the Linux dhcp client can run a script, whenever the IP changes. You
> should be able to do something with that, to update the DNS info.


I don't want my clients to have to do anything except pick "Use DHCP" in
windows, or iface ethX inet dhcp in debian...




--
Luke StClair
run_faster@hotmail.com
PGP key: http://www.students.uiuc.edu/~clairst
Reply With Quote
  #8 (permalink)  
Old 12-30-2003
Andrey Asadchev
 
Posts: n/a
Default Re: dhcp server and isp's dns...


> No, that was a bit unclear. What I meant was that all the hardware
> routers I've ever owned have not had any difficulty getting DHCP and
> nameserver information and passing them on to my client computers, even
> with nameservers changing. So it seems like the most popular DHCP
> servers on one of the most configurable operating systems should be able
> to handle this as well, but I haven't seen/heard of how to do it yet....
> anyone know how?



Ok. You can do that. Something crude and very simple :

NAMESERVERS=$(
for i in $( cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f2); do
echo -n $i", ";
done | sed 's/, $//'
)

# the sed line should be a single line.
DHCPD=$(cat /etc/dhcp3/dhcpd.conf |
sed "s/^\([[:space:]]*option domain\-name\-servers\).*$/\1 $NAMESERVERS;/g")

echo "$DHCPD" > /etc/dhcp3/dhcpd.conf
/etc/init.d/dhcpd restart

Make this into a script file and call it from dhcp client hooks or from
/etc/dhclient-sciprt when nameserver info changes. Check out the man
pages for dhclient.

The better way would be to get nameserver information directly from dhcp
client, check for unexpected values and have some kind of template
dhcpd.conf. But this is just to give an idea



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:19 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0