IP Addressing Commands

This chapter contains the following sections:

clear arp-cache

To delete all dynamic IP entries or a specific IP entry from the ARP cache, use the clear arp-cache Privileged EXEC mode command.

Syntax

clear arp-cache [ip-address]

Parameters

ip-address—(Optional) The IP address to be deleted.

Command Mode

Privileged EXEC mode

Example

switchxxxxxx# clear arp-cache

ip default-gateway

To define a default gateway, use the ip default-gateway Global Configuration mode command.

To revert to its default setting, use the no form of this command.

Syntax

ip default-gateway IPv4-ADDR

no ip default-gateway

Parameters

IPv4-ADDR—IPv4 address of the default gateway.

Default Configuration

No default gateway is defined.

Command Mode

Global Configuration mode

Example

switchxxxxxx(config)# ip default-gateway 192.168.1.100

ip domain lookup

To enable the IP Domain Naming System (DNS)-based host-name-to-address translation, use the ip domain lookup Global Configuration mode command.

To revert to its default setting, use the no form of this command.

Syntax

ip domain lookup

no ip domain lookup

Parameters

N/A

Default Configuration

Enabled

Command Mode

Global Configuration mode

User Guidelines

This command enables the switch to query domain name for DNS server.

Example

switchxxxxxx(config)# ip domain loopkup

ip domain name

To define a default domain name that the switch uses to complete unqualified host names, use the ip domain name Global Configuration mode command.

To delete the static-defined default domain name, use the no form of this command.

Syntax

ip domain name hostname

no ip domain name

Parameters

hostname—Default domain name used to complete unqualified host names. Do not include the initial period that separates an unqualified name from the domain name. Length: 1 to 255 characters. Maximum label length of each domain level is 63 characters.

Default Configuration

No default domain name is defined.

Command Mode

Global Configuration mode

User Guidelines

Any IP hostname that does not contain a domain name (that is, any name without a dot) will have the dot and the default domain name appended to it before being added to the host table.

Domain names and hostnames are restricted to the ASCII letters A through Z (case-insensitive), the digits 0 through 9, the underscore and the hyphen. A period (.) is used to separate labels.

The maximum size of each domain level is 63 characters. The maximum name size is 255 bytes.

Example

switchxxxxxx(config)# ip domain name website.com

ip host

To define the static host-name-to-address mapping in the DNS hostname cache, use the ip host Global Configuration mode command

To remove the static-host name-to-address, use the no form of this command.

Syntax

ip host hostname address1 [address2...address8]

no ip host hostname address1 [address2...address8]

Parameters

  • hostname—Name of the host. (Length: 1 to 158 characters. Maximum label length of each domain level is 63 characters.)

  • address1—Associated host IP address (IPv4 or IPv6, if IPv6 stack is supported).

  • address2...address8—(Optional) Up to seven additional associated IP addresses, delimited by a single space (IPv4 or IPv6, if IPv6 stack is supported).

Default Configuration

No host is defined.

Command Mode

Global Configuration mode

User Guidelines

Hostnames are restricted to ASCII letters A through Z (case-insensitive), the digit 0 through 9, the underscore and the hyphen symbols. A period (.) is used to separate labels.

An IP application will receive the IP addresses in the following order:

  • IPv6 addresses in the order specified by the command.

  • IPv4 addresses in the order specified by the command.

Use the no format of the command with the address1...address8 argument to delete the specified addresses. The entry is deleted if all its addresses are deleted.

Example

switchxxxxxx(config)# ip host accounting.website.com 176.10.23.1

ip name-server

To configure the DNS servers, use the ip name-server Global Configuration mode command.

To disable the DNS servers, use the no form of this command.

Syntax

ip name-server server-address1 [server-address2...server-address8]

no ip name-server

Parameters

server-address1—IPv4 or IPv6 addresses of a single name server.

server-address2...server-address8—(Optional) IPv4 or IPv6 addresses of additional name servers.

Default Configuration

No DNS server is configured.

Command Mode

Global Configuration mode

Example

switchxxxxxx(config)# ip name-server 192.168.1.20
switchxxxxxx(config)# ip name-server 192.168.1.20 192.168.1.50

management vlan ip-address

To define the IP address for the management VLAN, use the management vlan ip-address Global Configuration mode command.

Syntax

management vlan ip-address ip-address mask mask

Parameters

ip-address—The IP address.

mask—The network mask of the IP address.

Default Configuration

The default IP address of the management VLAN is 192.168.1.254.

Command Mode

Global Configuration mode

User Guidelines

If a dynamic IP address is already defined, the user must enter the no management ip dhcp client command to disable it before setting a static IP address.

If you modify the static IP address, enter the no management ip dhcp client command to automatically add.

Example

The following example configures the management VLAN with IP address 131.108.1.27 and subnet mask 255.255.255.0:

switchxxxxxx(config)# management vlan ip address 131.108.1.27 mask 255.255.255.0

management vlan ip dhcp client

To acquire an IP address for the management VLAN from the DHCP server, use the management vlan ip dhcp client Global Configuration mode command.

To release an acquired IP address, use the no form of this command.

Syntax

management vlan ip dhcp client

no management vlan ip dhcp client

Parameters

N/A

Default Configuration

DHCP client is enabled.

Command Mode

Global Configuration mode

User Guidelines

This command enables the switch to dynamically learn its IP address by using the DHCP protocol.

DHCP client configuration on the switch implicitly removes the static IP address configuration on the management VLAN.

If the switch 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.

The no management vlan ip dhcp client command releases any IP address that was acquired, and sends a DHCPRELEASE message.

Example

switchxxxxxx(config)# management vlan ip dhcp client

show arp

To display all entries in the ARP table, use the show arp Privileged EXEC mode command.

Syntax

show arp

Parameters

N/A

Command Mode

Privileged EXEC mode

Example

switchxxxxxx# show arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.1.22             ether   00:10:60:DB:6E:FE   C                     eth0

show hosts

To display the DNS servers defined on the switch, use the show hosts Privileged EXEC mode command.

Syntax

show hosts

Parameters

N/A

Command Mode

Privileged EXEC mode

Example

switchxxxxxx# show hosts
Name/address lookup is enabled
Default Domain Table
                 Domain                        Source   Preference
--------------------------------------------- --------- ----------
Name Server Table
              IP Address                       Source   Preference
--------------------------------------------- --------- ----------
Cache Table
Flags: (STA, OK)
STA - Static
OK - Okay
          Host                  IP Address            Type    State
------------------------- ------------------------ --------- --------

show ip

To display the IP address of the management VLAN, use the show ip Privileged EXEC mode command.

Syntax

show ip

Parameters

N/A

Default Configuration

N/A

Command Mode

Privileged EXEC mode

Example

switchxxxxxx# show ip
IP Address: 192.168.1.254
Subnet Netmask: 255.255.255.0
Default Gateway: 192.168.1.1

show ip dhcp

To display the IP DHCP status, use the show ip dhcp Privileged EXEC mode command.

Syntax

show ip dhcp

Parameters

N/A

Default Configuration

N/A

Command Mode

Privileged EXEC mode

Example

switchxxxxxx# show ip dhcp
DHCP Status : disabled