IP Addressing Commands 159
User Guidelines
The
ip address dhcp
command allows any interface to dynamically learn its IP address by
using the DHCP protocol.
Some DHCP Servers require that the DHCPDISCOVER message have a specific host name.
The most typical usage of the
ip address dhcp
hostname
host-name
command is when
host-
name
is the host name provided by the system administrator.
If a device is configured to obtain its IP address from a DHCP server, it sends a
DHCPDISCOVER message to provide information about itself to the DHCP server on the
network.
•If the
ip address dhcp
command is used with or without the optional keyword, the DHCP
option 12 field (host name option) is included in the DISCOVER message. By default, the
specified DHCP host name is the device globally configured host name.
However, you can use the
ip address dhcp hostname
host-name
command to place a different
name in the DHCP option 12 field than the globally configured host name of the device.
The
no ip address dhcp
command deconfigures any IP address that was acquired, thus
sending a DHCPRELEASE message.
Example
The following example acquires an IP address on an Ethernet interface from DHCP.
ip default-gateway
The
ip default-gateway
Global Configuration mode command defines a default gateway (router).
To remove the default gateway use the
no
form of this command.
Syntax
ip default-gateway ip-address
no ip default-gateway
ip-address
— Valid IP address that specifies the IP address of the default gateway.
Default Configuration
No default gateway is defined.
Command Mode
Global configuration
Console (config)# interface ethernet g8
Console (config-if)# ip address dhcp