Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linux server question

Status
Not open for further replies.

deckoh

Technical User
Joined
Jul 20, 2004
Messages
1
Location
US
the short version is... I need a method to make linux request a dhcp lease....
I know of one way to do it for sure... but it would involve the server disconnecting everyone for several seconds every half hour...

soooo what I need is a way to check if the lease is good and if not then do a "ifdown eth0" followed with a "ifup eth0"

this is also a gaming server
 
thought of ping?
Code:
pingok=$(ping -c1 [URL unfurl="true"]www.google.de[/URL] >/dev/null 2>&1 && echo "ok")
if [[ "ping"$pingok == "pingok" ]]
then
	echo "online"
else
	echo "offline"
fi
perhaps you replace ' with your dns-server.

seeking a job as java-programmer in Berlin:
 
deckoh:
Using DHCP on a server is not a particularly good idea. Although most of the time when a lease expires, the DHCP server will hand your machine the same number, there are circumstances where it won't.

But to answer your question, on Linux, DHCP lease information can be found in files in /var/lib/dhcp.

Take a look at /var/lib/dhcp/dhclient-eth0.leases, for example, to see the lease information for eth0.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top