Networking Forums

Networking Forums > Computer Networking > Linux Networking > Discover DHCP

Reply
Thread Tools Display Modes

Discover DHCP

 
 
Evert Carton
Guest
Posts: n/a

 
      04-13-2004, 02:08 PM
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
 
 
 
 
Clive Dove
Guest
Posts: n/a

 
      04-13-2004, 04:09 PM
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
 
ray
Guest
Posts: n/a

 
      04-14-2004, 12:45 AM
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
 
David Lesaffre
Guest
Posts: n/a

 
      04-14-2004, 07:27 AM
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
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Discover Source IP wilson_eldritch Linux Networking 1 05-14-2008 09:09 PM
Discover IP range Gianluca Wireless Internet 1 11-14-2006 05:05 PM
DHCP Discover Messages Ignored Andy Windows Networking 1 11-07-2005 05:37 PM
discover which card did pxe in initrd ittay.dror@gmail.com Linux Networking 0 02-15-2005 07:27 AM
Best solution to discover NIC at bootup? Lars Olsson Linux Networking 4 09-06-2003 02:47 AM



1 2 3 4 5 6 7 8 9 10 11