Using the CLI to configure IP Addressing, Gateway, and Time-To-Live (TTL)

Viewing the current IP configuration

Do one of the following:

  • Use the show ip command to view the IP addressing for each VLAN that is configured in the switch.

    If only the DEFAULT_VLAN exists, then its IP configuration applies to all ports in the switch. Where multiple VLANs are configured, the IP addressing is listed per VLAN. The display includes switch-wide packet time-to-live, and (if configured) the switch’s default gateway and Timep configuration.

  • Use the show management command to view the IP addressing and time server IP addressing that is configured on the switch.

Examples

The switch’s default IP addressing

In the factory default configuration (no IP addressing assigned), the switch’s IP addressing appears as:

switch(config)# show ip

 Internet (IP) Service

   IP Routing : Disabled

   Default Gateway :
   Default TTL     : 64
   Arp Age         : 20
   Domain Suffix   :
   DNS server      :

                      |                                           Proxy ARP
VLAN                  | IP Config  IP Address      Subnet Mask    Std Local
--------------------- + ---------- --------------- -------------- ----------
DEFAULT_VLAN          | DHCP/Bootp

Show IP listing with non-default IP addressing configured

With multiple VLANs and some other features configured, show ip provides additional information:

switch(config)# show ip

 Internet (IP) Service

   IP Routing : Disabled

   Default Gateway : 10.20.227.1
   Default TTL     : 64
   Arp Age         : 20
   Domain Suffix   :
   DNS server      :

                      |                                           Proxy ARP
VLAN                  | IP Config  IP Address      Subnet Mask    Std Local
--------------------- + ---------- --------------- -------------- ----------
DEFAULT_VLAN          | Manual     10.28.227.101   255.255.248.0   No   No
VLAN22                | Disabled

Configuring an IP address and subnet mask on a VLAN

Use one of the following forms of the vlan command to configure an IP address and subnet mask:

  • vlan <vlan-id> ip address <ip-address>/<mask-length>

  • vlan <vlan-id> ip address <ip-address> <mask-bits>

  • vlan <vlan-id> ip address <dhcp-bootp>

You must either include the ID of the VLAN for which you are configuring IP addressing or go to the context configuration level for that VLAN. (If you are not using VLANs on the switch—that is, if the only VLAN is the default VLAN—then the VLAN ID is always "1".)

The default IP address setting for the DEFAULT_VLAN is DHCP/Bootp. On additional VLANs you create, the default IP address setting is disabled.

Examples

The following example configures IP addressing on the default VLAN with the subnet mask specified in mask bits.

switch(config)# vlan 1 ip address 10.28.227.103 255.255.255.0

The following example configures the same IP addressing as the preceding example, but specifies the subnet mask by mask length.

switch(config)# vlan 1 ip address 10.28.227.103/24

Removing an IP address that is configured on a VLAN

Use one of the following forms of the vlan command to delete an IP address that is configured on a VLAN:

  • no vlan <vlan-id> ip address <ip-address>/<mask-length>

  • no vlan <vlan-id> ip address <ip-address> <mask-bits>

Examples

The following example deletes an IP address configured on VLAN 1.

switch (config) no vlan 1 ip address 10.28.227.103/24

Configuring multiple IP addresses on a VLAN (multinetting)

Use one of the following forms of the vlan command to configure multiple IP addresses on a VLAN (multinetting).

  • vlan <vlan-id> ip address <ip-address>/<mask-length>

  • vlan <vlan-id> ip address <ip-address> <mask-bits>

The following is supported:

  • Up to 2000 IP addresses for the switch

  • Up to 32 IP addresses for the same VLAN

  • Up to 512 IP VLANs, that is, VLANs on which you can configure IP addresses

  • Each IP address on a VLAN must be for a separate subnet, whether on the same VLAN or different VLANs.

The Internet (IP) Service screen in the Menu interface displays the first IP address for each VLAN. You must use the CLI show ip command to display the full IP address listing for multinetted VLANs.

Examples

Configuring and displaying a multinetted VLAN

If you wanted to multinet VLAN_20 (VID = 20) with the IP addresses shown below, you would perform steps similar to the following. For this example, assume that the first IP address is already configured.

IP Address VID IP Address Subnet Mask
1st address 20 10.25.33.101 255.255.240.0
2nd address 20 10.26.33.101 255.255.240.0
3rd address 20 10.27.33.101 255.255.240.0
switch(config)# vlan 20
switch(vlan-20)# ip address 10.26.33.101/20
switch(vlan-20)# ip address 10.27.33.101/20

switch(config)# show ip

 Internet (IP) Service

   IP Routing      : Disabled

   Default Gateway : 10.20.227.1
   Default TTL     : 64
   Arp Age         : 20
   Domain Suffix   : 
   DNS server      :

                       |                                           Proxy ARP
   VLAN                | IP Config  IP Address      Subnet Mask    Std Local
   ------------------- + ---------- --------------- -------------- ----------
   DEFAULT_VLAN        | Manual     10.20.30.100   255.255.240.0   No   No
   VLAN_20             | Manual     10.25.33.101   255.255.240.0   No   No
                       | Manual     10.26.33.101   255.255.240.0   No   No
                       | Manual     10.27.33.101   255.255.240.0   No   No

Multinetting on the default VLAN

To multinet the default VLAN, you would do the following:

switch(vlan-20)# vlan 1
switch(vlan-1)# ip address 10.21.30.100/20

switch(config)# show ip

 Internet (IP) Service

   IP Routing      : Disabled

   Default Gateway : 10.20.227.1
   Default TTL     : 64
   Arp Age         : 20
   Domain Suffix   : 
   DNS server      :

                       |                                           Proxy ARP
   VLAN                | IP Config  IP Address      Subnet Mask    Std Local
   ------------------- + ---------- --------------- -------------- ----------
   DEFAULT_VLAN        | Manual     10.20.30.100   255.255.240.0   No   No
                       | Manual     10.21.30.100   255.255.240.0   No   No
   VLAN_20             | Manual     10.25.33.101   255.255.240.0   No   No
                       | Manual     10.26.33.101   255.255.240.0   No   No
                       | Manual     10.27.33.101   255.255.240.0   No   No

Removing IP addresses from a multinetted VLAN

Use one of the following forms of the vlan command to delete an IP address that is configured on a multinetted VLAN:

  • no vlan <vlan-id> ip address <ip-address>/<mask-length>

  • no vlan <vlan-id> ip address <ip-address> <mask-bits>

Configuring the optional default gateway

One default gateway can be manually assigned to the switch. The switch does not allow IP addressing received from a DHCP or Bootp server to replace a manually configured default gateway.

Prerequisites

Before you use the CLI to configure the optional default gateway, you must be at the global configuration level.

Configuring the optional default gateway

Use the ip default-gateway <ip-address> command to configure the optional default gateway:

Examples

The following example shows the configuration of the default gateway with the IP address 10.28.227.115.

switch(config)# ip default-gateway 10.28.227.115

Setting the Time-To-Live (TTL)

The Time-To-Live (TTL) is the maximum number of routers (hops) through which a packet can pass before being discarded. Each router decreases a packet’s TTL by 1 before forwarding the packet. If a router decreases the TTL to 0, the router drops the packet instead of forwarding it.

Prerequisites

Before you use the CLI to set the TTL, you must be at the global configuration level.

Setting the TTL

Use the ip ttl <number-of-hops> command to set the TTL. The default value for the TTL is 64 and the range is 2 - 255.

Examples

The following example sets the TTL to 60.

switch(config)# ip ttl 60