Configuring a layer 3 interface

Prerequisites

A layer 2 interface.

Procedure
  1. Change to global configuration mode with the command config.
  2. Change to the interface configuration context for the interface with the command interface.
  3. Enable routing support with the command routing.
  4. Assign an IPv4 address with the command ip address, or an IPv6 address with the command ipv6 address.
  5. If required, enable support for layer 3 counters with the command l3-counters.
  6. Review interface configuration settings with the command show interface.

Examples

This example creates the following configuration:

  • Configures interface 1/1/1 as a layer 3 interface.
  • Defines an IPv4 address of 10.10.20.209 with a 24-bit mask.
switch# config
switch(config)# interface 1/1/1
switch(config-if)# routing
switch(config-if)# ip address 10.10.20.209/24

This example creates the following configuration:

  • Configures interface 1/1/2 as a layer 3 interface.
  • Defines an IPv6 address of 2001:0db8:85a3::8a2e:0370:7334 with a 24-bit mask.
  • Enables layer 3 transmit and receive counters.
switch# config
switch(config)# interface 1/1/2
switch(config-if)# routing
switch(config-if)# ipv6 address 2001:0db8:85a3::8a2e:0370:7334/24 
switch(config-if)# l3-counters tx 
switch(config-if)# l3-counters rx