配置一个第三层界面
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 interface1/1/1as a layer 3 interface.
- Defines an IPv4 address of10.10.20.209with a 24-bit mask.
switch#configswitch(config)#interface 1/1/1switch(config-if)#ip address 10.10.20.209/24
This example creates the following configuration:
- Configures interface1/1/2as a layer 3 interface.
- 定义了一个IPv6的广告dress of2001:0db8:85a3::8a2e:0370:7334with a 24-bit mask.
- Enables layer 3 transmit and receive counters.
switch#configswitch(config)#interface 1/1/2switch(config-if)#ipv6 address 2001:0db8:85a3::8a2e:0370:7334/24switch(config-if)#l3-counters txswitch(config-if)#l3-counters rx