This task explains how to configure 802.1Q VLAN subinterfaces. To remove these subinterfaces, see the “Removing an 802.1Q
VLAN Subinterface” section.

Note
|
-
You can programmatically configure and retrieve the VLAN interfaces and subinterfaces parameters using openconfig-vlan.yang OpenConfig data model. To get started with using data models, see the
Programmability Configuration Guide for Cisco 8000 Series Routers.
-
The OpenConfig VLAN data model uses structured vlan/match containers to represent VLAN matching. The vlan-id leaf supports only a single VLAN value and does not represent VLAN lists or ranges. See the OpenConfig model documentation for details.
|
RP/0/RP0/CPU0:router# configure
/* Enter subinterface configuration mode and specifies the interface type, location, and subinterface number. */
RP/0/RP0/CPU0:router(config)# interface TenGigE 0/2/0/4.10
-
Replace the interface-path-id argument with one of the following instances:
-
Physical Ethernet interface instance, or with an Ethernet bundle instance. Naming notation is rack /slot /module /port , and a slash between values is required as part of the notation.
-
Ethernet bundle instance. Range is from 1 through 65535.
-
Replace the subinterface argument with the subinterface value. Range is from 0 through 4095.
-
Naming notation is interface-path-id.subinterface , and a period between arguments is required as part of the notation.
/* Set the Layer 2 encapsulation of an interface. */
RP/0/RP0/CPU0:router(config-subif)# encapsulation dot1q 100

Note
|
|
/* Assign an IP address and subnet mask to the subinterface. */
RP/0/RP0/CPU0:router(config-subif)# ipv4 address 178.18.169.23/24
-
Replace ip-address with the primary IPv4 address for an interface.
-
Replace mask with the mask for the associated IP subnet. The network mask can be specified in either of two ways:
-
The network mask can be a four-part dotted decimal address. For example, 255.0.0.0 indicates that each bit equal to 1 means
that the corresponding address bit belongs to the network address.
-
The network mask can be indicated as a slash (/) and number. For example, /8 indicates that the first 8 bits of the mask are
ones, and the corresponding bits of the address are network address.
/* The exit command is not explicitly required. */
RP/0/RP0/CPU0:router(config-subif)# exit
RP/0/RP0/CPU0:router(config)# end
or
RP/0/RP0/CPU0:router(config)# commit
-
When you issue the end command, the system prompts you to commit changes:
Uncommitted changes found, commit them before exiting(yes/no/cancel)?
[cancel]:
- Entering yes saves configuration changes to the running configuration file, exits the configuration session, and returns the router to
EXEC mode.
- Entering no exits the configuration session and returns the router to EXEC mode without committing the configuration changes.
- Entering cancel leaves the router in the current configuration session without exiting or committing the configuration changes.
-
Use the commit command to save the configuration changes to the running configuration file and remain within the configuration session.
Example
"RP/0/RP0/CPU0:S3(config)#interface fourHundredGigE 0/5/0/1.100
RP/0/RP0/CPU0:S3(config-subif)#ipv4 address 100.100.100.100/31
RP/0/RP0/CPU0:S3(config-subif)#encapsulation dot1q 100
RP/0/RP0/CPU0:S3(config-subif)#no shutdown
RP/0/RP0/CPU0:S3(config-subif)#commit
Mon Jul 8 23:05:01.979 PDT
RP/0/RP0/CPU0:S3(config-subif)#end
RP/0/RP0/CPU0:S3#show interfaces fourHundredGigE 0/5/0/1.100 brief
Mon Jul 8 23:05:08.784 PDT
Intf Intf LineP Encap MTU BW
Name State State Type (byte) (Kbps)
--------------------------------------------------------------------------------
FH0/5/0/1.100 up up 802.1Q 1518 400000000
RP/0/RP0/CPU0:S3#show interfaces brief location 0/5/CPU0 | include 802.1Q
Mon Jul 8 23:07:43.929 PDT
FH0/5/0/1.100 up up 802.1Q 1518 400000000
RP/0/RP0/CPU0:S3#
RP/0/RP0/CPU0:S3#"