Configuring a layer 3 interface
Procedure
-
Change to the interface configuration context for the interface with the command
interface
. -
Interfaces are layer 3 by default. If you previously set the interface to layer 2, then enable routing support with the command
routing
. -
Assign an IPv4 address with the command
ip address
, or an IPv6 address with the commandipv6 address
. -
If required, enable support for layer 3 counters with the command
l3-counters
. -
If required, set the IP MTU with the command
ip mtu
. -
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)# 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)# ipv6 address 2001:0db8:85a3::8a2e:0370:7334/24 switch(config-if)# l3-counters tx switch(config-if)# l3-counters rx