IP Addressing Commands

This chapter contains the following sections:

ip address

Use the ip address Interface Configuration (Ethernet, VLAN, Port-channel) mode command to define an IP address for an interface. Use the no form of this command to remove an IP address definition.

Syntax

OOB port:

ip address ip-address {mask | /prefix-length} [default-gateway-ip-address]

no ip address

In-Band interfaces:

ip address ip-address {mask | /prefix-length}

no ip address [ip-address]

Parameters

  • ip-address—Specifies the IP address.

  • mask—Specifies the network mask of the IP address.

  • prefix-length—Specifies the number of bits that comprise the IP address prefix. The prefix length must be preceded by a forward slash (/). (Range: 8–30)

  • default-gateway-ip-address—Specifies the default gateway IP address. The route is gotten a metric of 4 for an In-Band interface and 2 for OOB.

Default Configuration

No IP address is defined for interfaces.

Command Mode

Interface Configuration mode

User Guidelines

Use the ip address command to define a static IP address on an interface.

In-Band interfaces

Multiple IP addresses are supported. A new defined IP address is added on the interface.

Defining a static IP address on an interface stops a DHCP client running on the interface and removes the IP address assigned by the DHCP client.

If a configured IP address overlaps another configured one a warning message is displayed. To change an existed IP address, delete the existed one and add the new one.

While no IP address is assigned either by DHCP client or manually the default IP address 192.168.1.254 is assigned on the Default VLAN.

OOB port

One IP address is supported. A new IP address defined on the OOB port overrides the previously defined IP address on the OOB port.

Defining a static IP address on the OOB port stops a DHCP client running on the OOB port and deletes an IP address assigned by the DHCP client.

While no IP address is assigned either by DHCP client or manually the default IP address 192.168.1.254 is assigned on the OOB port

Examples

Example 1. The following example configures VLAN 1 with IP address 131.108.1.27 and subnet mask 255.255.255.0.

switchxxxxxx(config)# interface vlan 1
switchxxxxxx(config-if)# ip address 131.108.1.27 255.255.255.0

Example 2. The following example configures 3 overlapped IP addresses.

switchxxxxxx(config)# interface vlan 1
switchxxxxxx(config-if)# ip address 1.1.1.1 255.0.0.0
switchxxxxxx(config)# exit
switchxxxxxx(config)# interface vlan 2
switchxxxxxx(config-if)# ip address 1.2.1.1 255.255.0.0
switchxxxxxx(config)# This IP address overlaps IP address 1.1.1.1/8 on vlan1, are you sure? [Y/N]Y
switchxxxxxx(config)# exit
switchxxxxxx(config)# interface vlan 3
switchxxxxxx(config-if)# ip address 1.3.1.1 255.255.0.0
switchxxxxxx(config)# This IP address overlaps IP address 1.1.1.1/8 on vlan1, are you sure? [Y/N]Y
switchxxxxxx(config)# exit

Example 3. The following example configures IP address on OOB:

switchxxxxxx(config)# interface oob
switchxxxxxx(config-if)# ip address 131.108.1.27 255.255.255.0 131.108.1.100

ip address dhcp

Use the ip address dhcp Interface Configuration (Ethernet, VLAN, Port-channel) mode command to acquire an IP address for an Ethernet interface from the Dynamic Host Configuration Protocol (DHCP) server. Use the no form of this command to release an acquired IP address.

Syntax

ip address dhcp

no ip address dhcp

Command Mode

Interface Configuration mode

User Guidelines

Use the ip address dhcp command to enable DHCP client on the interface.

The ip address dhcp command removes all the manually configured addresses on the interface.

The default route (Default Gateway) received in DHCP Router option (Option 3) is assigned a metric of 8 for an In-Band interface and 6 for OOB.

Use the no form of the command to disable DHCP client on interface.

Example

The following example acquires an IP address for VLAN 100 from DHCP.

switchxxxxxx(config)# interface vlan100
switchxxxxxx(config-if)# ip address dhcp

renew dhcp

Use the renew dhcp Privileged EXEC mode command to renew an IP address that was acquired from a DHCP server for a specific interface.

Syntax

renew dhcp interface-id [force-autoconfig]

Parameters

  • interface-id—Specifies an interface.

  • force-autoconfig - If the DHCP server holds a DHCP option 67 record for the assigned IP address, the record overwrites the existing device configuration.

Command Mode

Privileged EXEC mode

User Guidelines

Use the renew dhcp command to renew a DHCP address on an interface.

This command does not enable DHCP client on an interface and if DHCP client is not enabled on the interface, the command returns an error message.

Example

The following example renews an IP address on VLAN 19 that was acquired from a DHCP server:

switchxxxxxx# renew dhcp vlan 19

ip default-gateway

The ip default-gateway Global Configuration mode command defines a default gateway (device). Use the no form of this command to restore the default configuration.

Syntax

ip default-gateway ip-address

no ip default-gateway [ip-address]

Parameters

  • ip-address—Specifies the default gateway IP address.

Command Mode

Global Configuration mode

Default Configuration

No default gateway is defined.

User Guidelines

Use the ip default-gateway command to defines a default gateway (default route).

The ip default-gateway command adds the default route with metric of 4 for the gateway connected on an In-Band interface and 2 for the gateway connected on OOB.

Use the no ip default-gateway ip-address command to delete one default gateway.

Use the no ip default-gateway command to delete all default gateways.

Example

The following example defines default gateway 192.168.1.1.

switchxxxxxx(config)# ip default-gateway 192.168.1.1

show ip interface

Use the show ip interface EXEC mode command to display the usability status of configured IP interfaces.

Syntax

show ip interface [interface-id]

Parameters

  • interface-id—Specifies an interface ID on which IP addresses are defined.

Default Configuration

All IP addresses.

Command Mode

User EXEC mode

Examples

Example 1 - The following example displays all configured IP addresses and their types:

switchxxxxxx# show ip interface

IP Address       I/F     I/F Status  Type   Directed   Redirect  Status
                          admin/oper        Broadcast
-------------    ------  ----------- ------- --------  --------- -----
10.5.230.232/24  vlan 1  UP/UP       Static  disable   Enabled   Valid
10.5.234.202/24 vlan 4 UP/DOWN Static disable Disabled Valid
10.5.240.200/24 oob UP/UP Static Valid

Example 2 - The following example displays the IP addresses configured on the given L2 interfaces and their types:

switchxxxxxx# show ip interface vlan 1

IP Address       I/F     I/F Status  Type   Directed   Redirect  Status
                          admin/oper        Broadcast
-------------    ------  ----------- ------- --------  --------- -----
10.5.230.232/24  vlan 1  UP/UP       Static  disable   Enabled   Valid

arp

Use the arp Global Configuration mode command to add a permanent entry to the Address Resolution Protocol (ARP) cache. Use the no form of this command to remove an entry from the ARP cache.

Syntax

arp ip-address mac-address [interface-id]

no arp ip-address

Parameters

  • ip-address—IP address or IP alias to map to the specified MAC address.

  • mac-address—MAC address to map to the specified IP address or IP alias.

  • interface-id—Address pair is added for specified interface.

Command Mode

Global Configuration mode

Default Configuration

No permanent entry is defined.

If no interface ID is entered, address pair is relevant to all interfaces.

User Guidelines

The software uses ARP cache entries to translate 32-bit IP addresses into 48-bit hardware (MAC) addresses. Because most hosts support dynamic address resolution, static ARP cache entries generally do not need to be specified.

Example

The following example adds IP address 198.133.219.232 and MAC address 00:00:0c:40:0f:bc to the ARP table.

switchxxxxxx(config)# arp 198.133.219.232 00:00:0c:40:0f:bc vlan100

arp timeout (Global)

Use the arp timeout Global Configuration mode command to set the time interval during which an entry remains in the ARP cache. Use the no form of this command to restore the default configuration.

Syntax

arp timeout seconds

no arp timeout

Parameters

  • seconds—Specifies the time interval (in seconds) during which an entry remains in the ARP cache. (Range: 1–40000000).

Default Configuration

The default ARP timeout is 60000 seconds, if IP Routing is enabled, and 300 seconds if IP Routing is disabled.

Command Mode

Global Configuration mode

Example

The following example configures the ARP timeout to 12000 seconds.

switchxxxxxx(config)# arp timeout 12000

ip arp proxy disable

Use the ip arp proxy disable Global Configuration mode command to globally disable proxy Address Resolution Protocol (ARP). Use the no form of this command reenable proxy ARP.

Syntax

ip arp proxy disable

no ip arp proxy disable

Default

Disabled by default.

Command Mode

Global Configuration mode

User Guidelines

This command overrides any proxy ARP interface configuration.

The command is supported only when IP Routing is enabled.

Example

The following example globally disables ARP proxy.

switchxxxxxx(config)# ip arp proxy disable 

ip proxy-arp

Use the ip proxy-arp Interface Configuration mode command to enable an ARP proxy on specific interfaces. Use the no form of this command disable it.

Syntax

ip proxy-arp

no ip proxy-arp

Default Configuration

ARP Proxy is enabled.

Command Mode

Interface Configuration mode

User Guidelines

This configuration can be applied only if at least one IP address is defined on a specific interface.

The command is supported only when IP Routing is enabled.

Example

The following example enables ARP proxy when the switch is in router mode.

switchxxxxxx(config-if)# ip proxy-arp

clear arp-cache

Use the clear arp-cache Privileged EXEC mode command to delete all dynamic entries from the ARP cache.

Syntax

clear arp-cache

Command Mode

Privileged EXEC mode

Example

The following example deletes all dynamic entries from the ARP cache.

switchxxxxxx# clear arp-cache

show arp

Use the show arp Privileged EXEC mode command to display entries in the ARP table.

Syntax

show arp [ip-address ip-address] [mac-address mac-address] [interface-id]

Parameters

  • ip-address ip-address—Specifies the IP address.

  • mac-address mac-address—Specifies the MAC address.

  • interface-id—Specifies an interface ID.

Command Mode

Privileged EXEC mode

User Guidelines

Since the associated interface of a MAC address can be aged out from the FDB table, the Interface field can be empty.

If an ARP entry is associated with an IP interface that is defined on a port or port-channel, the VLAN field is empty.

Example

The following example displays entries in the ARP table.

switchxxxxxx# show arp
ARP timeout: 80000 Seconds

VLAN
-------
VLAN 1
VLAN 1
VLAN 2

Interface
---------------
gi1/0/1
gi1/0/2
gi1/0/1
gi1/0/2

IP Address
----------
10.7.1.102
10.7.1.135
11.7.1.135
12.10.1.13

HW Address
-----------------
00:10:B5:04:DB:4B
00:50:22:00:2A:A4
00:12:22:00:2A:A4
00:11:55:04:DB:4B

Status
-------
Dynamic
Static
Dynamic
Dynamic

show arp configuration

Use the show arp configuration privileged EXEC command to display the global and interface configuration of the ARP protocol.

Syntax

show arp configuration

Parameters

This command has no arguments or key words.

Command Mode

Privileged EXEC mode

Example

switchxxxxxx# show arp configuration
Global configuration:
	ARP Proxy: enabled
	ARP timeout:    80000 Seconds
Interface configuration:
VLAN 1:
	ARP Proxy: disabled
	ARP timeout:60000 Seconds
VLAN 10:
	ARP Proxy: enabled
	ARP timeout:	70000 Seconds
VLAN 20:
	ARP Proxy: enabled
	ARP timeout:	80000 Second (Global)

interface ip

Use the interface ip Global Configuration mode command to enter the IP Interface Configuration mode.

Syntax

interface ip ip-address

Parameters

  • ip-address—Specifies one of the IP addresses of the device.

Command Mode

Global Configuration mode

Example

The following example enters the IP interface configuration mode.

switchxxxxxx(config)# interface ip 192.168.1.1
switchxxxxxx(config-ip)# 

ip helper-address

Use the ip helper-address Global Configuration mode command to enable the forwarding of UDP Broadcast packets received on an interface to a specific (helper) address. Use the no form of this command to disable the forwarding of broadcast packets to a specific (helper) address.

Syntax

ip helper-address {ip-interface | all} address [udp-port-list]

no ip helper-address {ip-interface | all} address

Parameters

  • ip-interface—Specifies the IP interface.

  • all—Specifies all IP interfaces.

  • address—Specifies the destination broadcast or host address to which to forward UDP broadcast packets. A value of 0.0.0.0 specifies that UDP broadcast packets are not forwarded to any host.

  • udp-port-list—Specifies the destination UDP port number to which to forward Broadcast packets (Range: 1–59999). This can be a list of port numbers separated by spaces.

Default Configuration

Forwarding of UDP Broadcast packets received on an interface to a specific (helper) address is disabled.

If udp-port-list is not specified, packets for the default services are forwarded to the helper address.

Command Mode

Global Configuration mode

User Guidelines

This command forwards specific UDP Broadcast packets from one interface to another, by specifying a UDP port number to which UDP broadcast packets with that destination port number are forwarded. By default, if no UDP port number is specified, the device forwards UDP broadcast packets for the following six services:

  • IEN-116 Name Service (port 42)

  • DNS (port 53)

  • NetBIOS Name Server (port 137)

  • NetBIOS Datagram Server (port 138)

  • TACACS Server (port 49)

  • Time Service (port 37)

Many helper addresses may be defined. However, the total number of address-port pairs is limited to 128 for the device.

The setting of a helper address for a specific interface has precedence over the setting of a helper address for all the interfaces.

Forwarding of BOOTP/DHCP (ports 67, 68) cannot be enabled with this command. Use the DHCP relay commands to relay BOOTP/DHCP packets.

The ip-interface argument cannot be the OOB port.

Example

The following example enables the forwarding of UDP Broadcast packets received on all interfaces to the UDP ports of a destination IP address and UDP port 1 and 2.

switchxxxxxx(config)# ip helper-address all 172.16.9.9 49 53 1 2

show ip helper-address

Use the show ip helper-address Privileged EXEC mode command to display the IP helper addresses configuration on the system.

Syntax

show ip helper-address

Parameters

This command has no arguments or key words.

Command Mode

Privileged EXEC mode

User Guidelines

Example

The following example displays the IP helper addresses configuration on the system:

switchxxxxxx# show ip

Interface
------------
192.168.1.1
192.168.2.1

Helper Address
--------------
172.16.8.8
172.16.9.9

UDP Ports
------------------------
37, 42, 49, 53, 137, 138
37, 49

show ip dhcp client interface

Use the show ip dhcp client interface command in User EXEC or Privileged EXEC mode to display DHCP client interface information.

Syntax

show ip dhcp client interface [interface-id]

Parameters

  • interface-id—Interface identifier.

Command Mode

User EXEC mode

User Guidelines

If no interfaces are specified, all interfaces on which DHCP client is enabled are displayed. If an interface is specified, only information about the specified interface is displayed.

Example

The following is sample output of the show ip dhcp client interface command:

switchxxxxxx# show ip dhcp client interface
VLAN 100 is in client mode
Address: 170.10.100.100 Mask: 255.255.255.0 T1 120, T2 192
Default Gateway: 170.10.100.1
DNS Servers: 115.1.1.1, 87.12.34.20
DNS Domain Search List: company.com
Host Name: switch_floor7
Configuration Server Addresses: 192.1.1.1 202.1.1.1
Configuration Path Name: qqq/config/aaa_config.dat
Image Path Name: qqq/image/aaa_image.ros
POSIX Timezone string: EST5EDT4,M3.2.0/02:00,M11.1.0/02:00
VLAN 1200 is in client mode
Address: 180.10.100.100 Mask: 255.255.255.0 T1 120, T2 192
Default Gateway: 180.10.100.1
DNS Servers: 115.1.1.1, 87.12.34.20
DNS Domain Search List: company.com
Host Name: switch_floor7
Configuration Server Addresses: configuration.company.com
Configuration Path Name: qqq/config/aaa_config.dat
Image Path Name: qqq/image/aaa_image.ros
POSIX Timezone string: EST5EDT4,M3.2.0/02:00,M11.1.0/02:00
Option 43: 5A1N;K4;B3;IFE80::2E0:81FF:FE2D:3799;J6088