dhcp
dhcp - configure the DHCP parameters on a stream of a port.
SYNOPSIS
dhcp sub-command options
DESCRIPTION
The dhcp command is used to configure the DHCP parameters. Refer to RFC 2131 and RFC 2132 for detailed descriptions of DHCP. Note that stream get must be called before this command's get sub-command.
STANDARD OPTIONS
bootFileName
Boot file name, null terminated string; "generic" name or null in DHCPDISCOVER, fully qualified folder-path name in DHCPOFFER.
clientHwAddr
Client hardware address. (default = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00)
clientIpAddr
Client IP address. Only filled in if client is in BOUND, RENEW or REBINDING state and can respond to ARP requests. (default = 0.0.0.0)
flags
Available option values are:
Option |
Value |
Usage |
---|---|---|
dhcpNoBroadcast |
0 |
(default) Do not broadcast |
dhcpBroadcast |
0x8000 |
Broadcast |
hops
Set to zero by client. (default = 0)
hwLen
Hardware address length. (default = 6)
hwType
Hardware address types. Available option values are:
Option |
Value |
Usage |
---|---|---|
dhcpEthernet10Mb |
1 |
(default) Ethernet 10 Mb |
dhcpEthernet3Mb |
2 |
Ethernet 3 Mb |
dhcpAmateur |
3 |
Amateur radio AX.25 |
dhcpProteon |
4 |
Proteon ProNET token ring |
dhcpChaos |
5 |
Chaos |
dhcpIEEE |
6 |
IEEE 802 networks |
dhcpARCNET |
7 |
ARCNET |
dhcpHyperchannel |
8 |
Hyperchannel |
dhcpLanstar |
9 |
LanStar |
dhcpAutonet |
10 |
Autonet short address |
dhcpLocalTalk |
11 |
LocalTalk |
dhcpLocalNet |
12 |
LocalNet |
dhcpUltraLink |
13 |
Ethernet |
dhcpSMDS |
14 |
SMDS |
dhcpFrameRelay |
15 |
Frame Relay |
dhcpATM1 |
16 |
ATM |
dhcpHDLC |
17 |
HDLC |
dhcpFibreChannel |
18 |
Fibre Channel |
dhcpATM2 |
19 |
ATM |
dhcpSerialLine |
20 |
Serial Line |
dhcpATM3 |
21 |
ATM |
opCode
Operation code. Available option values are:
Option |
Value |
Usage |
---|---|---|
dhcpBootRequest |
1 |
(default) BOOTP request |
dhcpBootReply |
2 |
BOOTP reply |
optionCode
The code field of the options section of the DHCP frame. Available codes are:
Option |
Value |
Usage |
---|---|---|
dhcpPad |
0 |
(default) |
dhcpEnd |
255 |
|
dhcpSubnetMask |
1 |
|
dhcpTimeOffset |
2 |
|
dhcpGateways |
3 |
|
dhcpTimeServer |
4 |
|
dhcpNameServer |
5 |
|
dhcpDomainNameServer |
6 |
|
dhcpLogServer |
7 |
|
dhcpCookieServer |
8 |
|
dhcpLPRServer |
9 |
|
dhcpImpressServer |
10 |
|
dhcpResourceLocationServer |
11 |
|
dhcpHostName |
12 |
|
dhcpBootFileSize |
13 |
|
dhcpMeritDumpFile |
14 |
|
dhcpDomainName |
15 |
|
dhcpSwapServer |
16 |
|
dhcpRootPath |
17 |
|
dhcpExtensionPath |
18 |
|
IP Layer Parameters per Host
Option |
Value |
Usage |
---|---|---|
dhcpIpForwardingEnable |
19 |
|
dhcpNonLocalSrcRoutingEnable |
20 |
|
dhcpPolicyFilter |
21 |
|
dhcpMaxDatagramReassemblySize |
22 |
|
dhcpDefaultIpTTL |
23 |
|
dhcpPathMTUAgingTimeout |
24 |
|
IP Layer Parameters per Interface
Option |
Value |
Usage |
---|---|---|
dhcpPathMTUPlateauTable |
25 |
|
dhcpInterfaceMTU |
26 |
|
dhcpAllSubnetsAreLocal |
27 |
|
dhcpBroadcastAddress |
28 |
|
dhcpPerformMaskDiscovery |
29 |
|
dhcpMaskSupplier |
30 |
|
dhcpPerformRouterDiscovery |
31 |
|
dhcpRouterSolicitAddr |
32 |
|
dhcpStaticRoute |
33 |
|
Link Layer Parameters per Interface
Option |
Value |
Usage |
---|---|---|
dhcpTrailerEncapsulation |
34 |
|
dhcpARPCacheTimeout |
35 |
|
dhcpEthernetEncapsulation |
36 |
|
TCP Parameters
Option |
Value |
Usage |
---|---|---|
dhcpTCPDefaultTTL |
37 |
|
dhcpTCPKeepAliveInterval |
38 |
|
dhcpTCPKeepGarbage |
39 |
|
Application And Service Parameters
Option |
Value |
Usage |
---|---|---|
dhcpNISDomain |
40 |
|
dhcpNISServer |
41 |
|
dhcpNTPServer |
42 |
|
dhcpVendorSpecificInfo |
43 |
|
dhcpNetBIOSNameSvr |
44 |
|
dhcpNetBIOSDatagramDistSvr |
45 |
|
dhcpNetBIOSNodeType |
46 |
|
dhcpNetBIOSScope |
47 |
|
dhcpXWinSysFontSvr |
48 |
|
DHCP Extensions
Option |
Value |
Usage |
---|---|---|
dhcpRequestedIPAddr |
50 |
|
dhcpIPAddrLeaseTime |
51 |
|
dhcpOptionOverload |
52 |
|
dhcpTFTPSvrName |
66 |
|
dhcpBootFileName |
67 |
|
dhcpMessageType |
53 |
|
dhcpSvrIdentifier |
54 |
|
dhcpParamRequestList |
55 |
|
dhcpMessage |
56 |
|
dhcpMaxMessageSize |
57 |
|
dhcpRenewalTimeValue |
58 |
|
dhcpRetryCountValue |
4 |
The configurable retry count of the DHCP Extention server. |
dhcpRebindingTimeValue |
59 |
|
dhcpVendorClassId |
60 |
|
dhcpClientId |
61 |
|
dhcpXWinSysDisplayMgr |
49 |
|
dhcpNISplusDomain |
64 |
|
dhcpNISplusServer |
65 |
|
dhcpMobileIPHomeAgent |
68 |
|
dhcpSMTPSvr |
69 |
|
dhcpPOP3Svr |
70 |
|
dhcpNNTPSvr |
71 |
|
dhcpWWWSvr |
72 |
|
dhcpDefaultFingerSvr |
73 |
|
dhcpDefaultIRCSvr |
74 |
|
dhcpStreetTalkSvr |
75 |
|
dhcpSTDASvr |
76 |
|
dhcpAgentInformationOption |
82 |
|
dhcpNetwareIpDomain |
62 |
|
dhcpNetworkIpOption |
63 |
|
optionData
The data in the options section of the DHCP frame. Option data may either be set as a single value (for example, 255.255.255.0), a stream of bytes (for example, {01 03 06 0F 2C 2E 2F 39}) or as a list of enumerated values (for example, [list dhcpSubnetMask dhcpGateways dhcpDomainNameServer]) (default = { })
optionDataLength
The length of the data in the options section of the DHCP frame. (default = 0)
relayAgentIpAddr
Relay agent IP address, used in booting by a relay agent. (default = 0.0.0.0)
seconds
Seconds elapsed since client began address acquisition or renewal process. (default = 0)
serverHostName
Optional server host name, null terminated string. (default ="")
serverIpAddr
IP address of next server to use in bootstrap; returned in DHCPOFFER, DHCPACK by server. (default = 0.0.0.0)
transactionID
Random number chosen by client and used by the client and server to associate messages and responses between a client and a server. (default = 0)
yourIpAddr
'your' (client) IP address. (default = 0.0.0.0)
COMMANDS
The dhcp command is invoked with the following sub-commands. If no sub-command is specified, returns a list of all sub-commands available.
dhcp cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the dhcp command.
dhcp config option value
Modify the configuration options of the dhcp. If no option is specified, returns a list describing all of the available options (see STANDARD OPTIONS) for arp.
dhcp decode capFrame [chasID cardID portID]
Decodes a captured frame in the capture buffer and updates TclHal. dhcp getOption command can be used after decoding to get the option data. Specific errors are:
- No connection to a chassis
- The captured frame is not a valid DHCP packet
dhcp get chasID cardID portID
Gets the current configuration of the dhcp frame for port with id portID on card cardID, chassis chasID. from its hardware. Note that stream get must be called before this command's get sub-command. Call this command before calling dhcp cget option value to get the value of the configuration option. Specific errors are:
- No connection to a chassis
- Invalid port number
dhcp getFirstOption
The first option is retrieved. Specific errors are:
- There are no more entries in the list.
dhcp getNextOption
The next option is retrieved. Specific errors are:
- getFirstOption has not been called yet.
- There are no more entries in the list.
dhcp getOption optionCodeType
Gets the option data for optionCodeType. Specific errors are:
- There is no option data for the optionCodeType.
dhcp set chasID cardID portID
Sets the configuration of the dhcp in IxHAL for port with id portID on card cardID, chassis chasID by reading the configuration option values set by the dhcp config option value command. Specific errors are:
- No connection to a chassis
- Invalid port number
- The port is being used by another user
- The configured parameters are not valid for this port
dhcp setDefault
Sets to IxTclHal default values for all configuration options.
dhcp setOption optionCodeType
Sets the option data for optionCodeType. Specific errors are:
- The configured parameters are not valid for this port
EXAMPLES
package require IxTclHal
# In this example we'll generate a DHCP response packet
# with a number of option fields
set host galaxy
set username user
# Check if we're running on UNIX - connect to the TCL Server
# which must be running on the chassis
if [isUNIX] {
if [ixConnectToTclServer $host] {
ixPuts "Could not connect to $host"
return 1
}
}
# Now connect to the chassis
if [ixConnectToChassis $host] {
ixPuts $::ixErrorInfo
return 1
}
# Get the chassis ID to use in port lists
set chas [ixGetChassisID $host]
# Assume card to be used is in slot 1
set card 1
set port 1
set portList [list [list $chas $card $port]]
# Login before taking ownership
if [ixLogin $username] {
ixPuts $::ixErrorInfo
return 1
}
# Take ownership of the ports we'll use
if [ixTakeOwnership $portList] {
ixPuts $::ixErrorInfo
return 1
}
# Put the port in loopback mode
port setFactoryDefaults $chas $card $port
port setDefault
# Stream: 1 packet at 1%, with framesize large enough to hold all options
stream setDefault
stream config -numFrames 1
stream config -dma stopStream
stream config -rateMode usePercentRate
stream config -percentPacketRate 1
stream config -framesize 512
# Set up IP: udp with 494 byte packet
ip setDefault
ip config -ipProtocol udp
ip config -totalLength 494
ip set $chas $card $port
# Set up protocol
protocol setDefault
protocol config -name ipV4
protocol config -appName Dhcp
# Set up UDP
udp setDefault
udp config -sourcePort bootpClientPort
udp config -destPort bootpServerPort
udp set $chas $card $port
# Setup DHCP with options
dhcp setDefault
dhcp config -opCode dhcpBootReply
dhcp config -hwType dhcpEthernet10Mb
dhcp config -hwLen 6
dhcp config -flags dhcpBroadcast
dhcp config -yourIpAddr 192.168.18.154
dhcp config -serverIpAddr 192.168.18.2
dhcp config -clientHwAddr {01 02 03 04 05 06}
# Options
dhcp config -optionData 255.255.255.0
dhcp setOption dhcpSubnetMask
dhcp config -optionData 192.168.18.254
dhcp setOption dhcpRouter
dhcp setOption dhcpGateways
dhcp config -optionData 192.168.18.2
dhcp setOption dhcpNameServer
dhcp config -optionData widgets.com
dhcp setOption dhcpDomainName
dhcp config -optionData {cc ee 22 11 33 ff}
dhcp setOption dhcpNetBIOSScope
dhcp config -optionData [list dhcpSubnetMask \
dhcpGateways \
dhcpDomainNameServer \
dhcpDomainName \
dhcpNetBIOSNameSvr \
dhcpNetBIOSNodeType \
dhcpNetBIOSScope]
dhcp setOption dhcpParamRequestList
dhcp set $chas $card $port
stream set $chas $card $port 1
port set $chas $card $port
ixWritePortsToHardware portList
# Let go of the ports that we reserved
ixClearOwnership $portList
# Disconnect from the chassis we're using
ixDisconnectFromChassis $host
# If we're running on UNIX, disconnect from the TCL Server
if [isUNIX] {
ixDisconnectTclServer $host
}