Discover DHCP

This is a discussion on Discover DHCP within the Linux Networking forums, part of the Linux Forums category; Hi all, 1) Is there an easy scriptable way to find out whether there is a DHCP-server on the ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-13-2004
Evert Carton
 
Posts: n/a
Default Discover DHCP

Hi all,

1) Is there an easy scriptable way to find out whether there is a DHCP-server
on the network you're connecting to ?
Also:
2) (and I know this is probably a bad idea)
Is there an easy scriptable way to find out about the IP-network you're
connecting to ? And more: to find available IP-adresses, ie, IP-addresses
that are not in use ?
The second problem would be tricky I guess, since if you want to use
broadcast to find out, it does somewhat imply that you have an
IP-addresses assigned to your card already, in the IP-network you're
connecting to. It would therefore more be a broadcast on MAC-level, and
ask all the cards you've found for their IP-address. Dunno if this is
possible. I do know (or should I say: I do presume) that IP-usually works by issuing an ARP "whohas
x.x.x.x"-broadcast request, upon which communication with that discovered
card does work on MAC-level. Hence the use of ARP-tables.
I don't know whether issuing a request for an IP-address to a given MAC-address, the reverse query.
I would need to discover before the IP-addresses is assigned to my card. I would like to use answers to the
above to make decisions about configuration for my card. And I know, I know, this would somewhat imply
"stealing" an IP-address that might not be available not be available 10 minutes from now.
3) Do I make any sense ? ;-)

Regards,
Evert



Reply With Quote
  #2 (permalink)  
Old 04-13-2004
Clive Dove
 
Posts: n/a
Default Re: Discover DHCP

Evert Carton wrote:

> Hi all,
>
> 1) Is there an easy scriptable way to find out whether there is a
> DHCP-server on the network you're connecting to ?
> Also:
> 2) (and I know this is probably a bad idea)
> Is there an easy scriptable way to find out about the IP-network
> you're connecting to ? And more: to find available IP-adresses, ie,
> IP-addresses that are not in use ?
> The second problem would be tricky I guess, since if you want to use
> broadcast to find out, it does somewhat imply that you have an
> IP-addresses assigned to your card already, in the IP-network you're
> connecting to. It would therefore more be a broadcast on MAC-level,
> and ask all the cards you've found for their IP-address. Dunno if this
> is possible. I do know (or should I say: I do presume) that IP-usually
> works by issuing an ARP "whohas x.x.x.x"-broadcast request, upon which
> communication with that discovered card does work on MAC-level. Hence
> the use of ARP-tables. I don't know whether issuing a request for an
> IP-address to a given MAC-address, the reverse query. I would need to
> discover before the IP-addresses is assigned to my card. I would like
> to use answers to the above to make decisions about configuration for
> my card. And I know, I know, this would somewhat imply
> "stealing" an IP-address that might not be available not be available
> 10 minutes from now. 3) Do I make any sense ? ;-)
>
> Regards,
> Evert


"3) Do I make any sense?"

No.

What are your trying to achieve that the standard dhcp client that was
probably installed in your system by default will not achieve?

Why do you want to find out all of the available ip addresses? You only
need to use the one that the dhcp server daemon assigns to you and you
dhcp client daemon will do that for you.

You don't need to have an ip address to get an ip address. Your machine
starts out with an ip address of 0.0.0.0 and your dhcp client daemon
takes care of asking the dhep server daemon to give it an ip address
which it then uses to communicate with the net. You broadcast a
request and a dhcp server daemon broadcasts an offer. Neither need know
the ip address of the other and in fact the client doesn't actually
have one.

It you accept the offer the server assigns an ip address on a fixed time
lease and specifies a netmask and the addresses of a couple of dns
servers and secifies a gateway address and your dhcp client daemon will
then configure your network connection to conform, all untouched by
human hands.

Once the two dhcp daemons have done their job, the system will then
bahave the same as any fixed ip system until you shut down or until the
time comes to renew the lease, at which time the two will again
communicate with each other for that purpose.


Clive







Modern


Reply With Quote
  #3 (permalink)  
Old 04-14-2004
ray
 
Posts: n/a
Default Re: Discover DHCP

On Tue, 13 Apr 2004 16:08:42 +0200, Evert Carton wrote:

> Hi all,
>
> 1) Is there an easy scriptable way to find out whether there is a DHCP-server
> on the network you're connecting to ?
> Also:
> 2) (and I know this is probably a bad idea)
> Is there an easy scriptable way to find out about the IP-network you're
> connecting to ? And more: to find available IP-adresses, ie, IP-addresses
> that are not in use ?
> The second problem would be tricky I guess, since if you want to use
> broadcast to find out, it does somewhat imply that you have an
> IP-addresses assigned to your card already, in the IP-network you're
> connecting to. It would therefore more be a broadcast on MAC-level, and
> ask all the cards you've found for their IP-address. Dunno if this is
> possible. I do know (or should I say: I do presume) that IP-usually works by issuing an ARP "whohas
> x.x.x.x"-broadcast request, upon which communication with that discovered
> card does work on MAC-level. Hence the use of ARP-tables.
> I don't know whether issuing a request for an IP-address to a given MAC-address, the reverse query.
> I would need to discover before the IP-addresses is assigned to my card. I would like to use answers to the
> above to make decisions about configuration for my card. And I know, I know, this would somewhat imply
> "stealing" an IP-address that might not be available not be available 10 minutes from now.
> 3) Do I make any sense ? ;-)
>
> Regards,
> Evert


I have written a program which will ping every possible address on the
network and then give you a summary of the ones that answered - it's not
too difficult.

Reply With Quote
  #4 (permalink)  
Old 04-14-2004
David Lesaffre
 
Posts: n/a
Default Re: Discover DHCP

Evert Carton wrote:

> 2) (and I know this is probably a bad idea)
> Is there an easy scriptable way to find out about the IP-network you're
> connecting to ? And more: to find available IP-adresses, ie, IP-addresses
> that are not in use ?


check out arping (http://www.habets.pp.se/synscan/prog...hp?prog=arping)


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 01:25 AM.


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