Post by ivanPost by Dave YeoPost by ivanYes, you just turn on DHCP in TCP/IP, reboot and you should be away.
You can also use DHCP Monitor to check what IP address you get and how
long the lease lasts.
So you have to reboot?
I have found it is the easiest way to get everything set up the first
tim when moving from a fixed IP to DHCP.
You can also write a script that will clear routs etc and reset them
as necessary.
I use this script (below). It's also useful when switching from an
ethernet connection (at home) to a WiFi connection on a totally different
network (e.g. at work) without having to reboot.
Requires PR1UTIL.DLL by Paul Ratcliffe, although it's possible to remove
that requirement with a little rewriting.
/*****************************************************************************
* FlushIP *
* *
* Deactivate all IP interfaces and flush the routing and arp tables. This *
* basically amounts to a forcible reset of all TCP/IP configuration, which *
* is frequently necessary if we plan to subsequently switch over to a new *
* connection on a different network (without rebooting). *
*****************************************************************************/
PARSE ARG interface
CALL RxFuncAdd 'PRLoadFuncs', 'PR1UTIL', 'PRLoadFuncs'
CALL PRLoadFuncs
IF interface <> '' THEN DO
PARSE UPPER VAR interface 'LAN'_i .
IF VERIFY( _i, '01234567') <> 0 THEN DO
SAY 'Incorrect interface specified.'
SAY
SAY 'Syntax: FlushIP <interface>'
SAY
SAY 'Where <interface> must be "lan0" to "lan7".'
RETURN 0
END
ifs.0 = 1
ifs.1.name = interface
END
ELSE DO
IF PRQueryIFConfig('ifs.') <> '' THEN DO
SAY 'Failed to get current IP configuration. Using defaults.'
ifs.0 = 2
ifs.1.name = 'lan0'
ifs.2.name = 'lan1'
END
END
SAY 'Resetting IP configuration... '
'@dhcpmon -t' /* Terminate the DHCP client service */
'@route -f >nul' /* Flush the routing table */
DO i = 1 TO ifs.0 /* Shut down all IP interfaces */
IF ifs.i.name == 'lo' THEN ITERATE /* (except the loopback device) */
'@ifconfig' ifs.i.name 'down'
'@ifconfig' ifs.i.name 'delete'
IF rc == 0 THEN
SAY ' ->' ifs.i.name 'deleted'
END
'@arp -f >nul' /* Flush the ARP table */
SAY 'OK'
RETURN 0
--
Alex Taylor
Fukushima, Japan
http://www.altsan.org
Please take off hat when replying.