default-gateway

Syntax

default-gateway <IP-ADDR>

no default-gateway <IP-ADDR>

Description

Assigns an IPv4 or IPv6 default gateway to the management interface. An IPv4 default gateway can only be configured if a static IPv4 address was assigned to the management interface. An IPv6 default gateway can only be configured if a static IPv6 address was assigned to the management interface. The default gateway should be on the same network segment.

The no form of this command removes the default gateway from the management interface.

Command context

config-if-mgmt

Parameters

<IP-ADDR>

Specifies an IP address in IPv4 format (x.x.x.x), where x is a decimal number from 0 to 255, or IPv6 format (xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx), where x is a hexadecimal number from 0 to F.

When specifying an IPv4 address, you can remove leading zeros. For example, the address 192.169.005.100 becomes 192.168.5.100.

When specifying an IPv6 address, you can use two colons (::) to represent consecutive zeros (but only once), remove leading zeros, and collapse a hextet of four zeros to a single 0. For example, this address 2222:0000:3333:0000:0000:0000:4444:0055 becomes 2222:0:3333::4444:55.

Authority

Administrators

Examples

Setting a default gateway with the IPv4 address of 198.168.5.1:

switch(config)# interface mgmt
switch(config-if-mgmt)# default-gateway 198.168.5.1

Setting an IPv6 address of 2001:DB8::1:

switch(config)# interface mgmt
switch(config-if-mgmt)# default-gateway 2001:DB8::1