Configuring VLANs
A virtual LAN (VLAN) enables multiplexing multiple IP and PPPoE interfaces and MPLS interfaces over a single physical Ethernet port. This multiplexing is accomplished through VLAN subinterfaces. Ethernet interfaces support the 802.1q-1998 IEEE Standards for Local and Metropolitan Area Networks: Virtual Bridged Local Area Networks, which the router uses as its standardized format for frame tagging.
The Ethernet V2 frame format enables multiplexing of different protocols over a single physical link. IEEE 802.1q compatibility extends the frame format by adding a tag that contains a VLAN ID. This feature enables multiplexing of different channels (VLANs) over the physical link; each channel is able to multiplex different protocols.
This capability works very much like ATM encapsulation as described in RFC 2684Multiprotocol Encapsulation over ATM Adaptation Layer 5 (September 1999). This encapsulation type enables multiplexing of multiple protocols over a single ATM virtual circuit (VC).
As shown in Figure 13, VLANs are similar to ATM VCs, with the VLAN ID serving the same function as the virtual path identifier (VPI) and virtual channel identifier (VCI) to multiplex the different channels over the physical link. The Ethernet protocol type serves the same function within a VLAN as the logical link control (LLC) subnetwork attachment point (SNAP) within a VC, to multiplex the different protocols over the channel.
![]()
In a VLAN configuration, the router can send VLAN 0 tagged or untagged frames.
All VLAN subinterfaces use the MAC address of the Ethernet interface over which they are configured. However, some configurations, such as multiple IP over VLAN subinterfaces, require that you connect many VLAN subinterfaces to a single device. In these cases, the device uses the MAC address to identify and select the correct VLAN to use. When the MAC address is the same for all VLANs, uneven load balancing of traffic occurs. To ensure proper load balancing, you must assign unique MAC addresses to the individual VLAN subinterfaces that are connected to the device. Any ARP requests and responses generated for the IP address assigned to a VLAN subinterface use this MAC address.
You must assign the MAC address when you configure the VLAN ID. If you change the MAC address of the VLAN subinterface after you configure it, system errors can occur. To change the MAC address, you must first remove the VLAN subinterface and then reconfigure it.
- JUNOSe IP, IPv6, and IGP Configuration Guide, Chapter 1, Configuring IP
- JUNOSe Link Layer Configuration Guide, Chapter 7, Configuring Point-to-Point Protocol over Ethernet
Creating a VLAN Major Interface
To use VLANs, you must first configure the Ethernet interface for VLAN encapsulation. This creates the VLAN major interface. For example:
- Specify a Fast Ethernet, Gigabit Ethernet, or 10-Gigabit Ethernet port.
host1(config)#interface fastEthernet 4/0- Specify VLAN as the encapsulation method.
host1(config-if)#encapsulation vlanThe router creates the VLAN major interface.
You can now create multiple VLAN subinterfaces to carry higher-level protocols. For examples, see Common VLAN Configurations, next.
Common VLAN Configurations
Ethernet interfaces support IP, PPPoE, MPLS, or both IP and PPPoE on each VLAN. In addition to a VLAN major interface level, a VLAN subinterface level distinguishes the VLAN.
This section describes how to create the following common VLAN configurations, which you can configure on Fast Ethernet, Gigabit Ethernet, and 10-Gigabit Ethernet interfaces:
- IP over VLAN
- PPPoE over VLAN
- MPLS over VLAN
- IP over VLAN and PPPoE over VLAN
NOTE: You cannot configure VLANs on the Fast Ethernet port of the SRP module.
Configuring IP over VLAN
To configure IP over VLAN over an Ethernet interface:
- Specify a Fast Ethernet, Gigabit Ethernet, or 10-Gigabit Ethernet port.
host1(config)#interface fastEthernet 4/0- Specify VLAN as the encapsulation method.
host1(config-if)#encapsulation vlanThe VLAN major interface is added.
- Create a VLAN subinterface by adding a subinterface number to the interface identification command.
host1(config-if)#interface fastEthernet 4/0.3- Do one of the following:
- Assign a VLAN ID for the subinterface.
host1(config-if)#vlan id 201- Assign a VLAN ID and the optional unique MAC address for the subinterface.
host1(config-if)#vlan id 201 mac-address 0090.1a01.1234
- Assign an IP address and mask.
host1(config-if)#ip address 192.6.129.5 255.255.255.0- (Optional) Configure additional VLAN subinterfaces by completing Steps 3 through 5.
Figure 14 illustrates the IP/VLAN/Fast Ethernet stacking, showing two separate VLAN subinterfaces. Configure one VLAN subinterface entirely; then configure the next VLAN subinterface.
![]()
Configuring PPPoE over VLAN
To configure PPPoE over VLAN over an Ethernet interface:
- Specify a Fast Ethernet, Gigabit Ethernet, or 10-Gigabit Ethernet port.
host1(config)#interface fastEthernet 4/1- Specify VLAN as the encapsulation method.
host1(config-if)#encapsulation vlanThe VLAN major interface is added.
- Create a VLAN subinterface by adding a subinterface number to the interface identification command.
host1(config-if)#interface fastEthernet 4/1.1- Do one of the following:
host1(config-if)#vlan id 201Assign a VLAN ID and the optional unique MAC address for the subinterface. host1(config-if)#vlan id 201 mac-address 0090.1a01.1234
- Specify PPPoE as the encapsulation method on the interface.
host1(config-if)#pppoe- Create a PPPoE subinterface.
host1(config-if)#pppoe subinterface fastEthernet 4/1.1.1- Specify PPP as the encapsulation method on the interface.
host1(config-if)#encapsulation ppp- Assign an IP address and mask.
host1(config-if)#ip address 192.6.129.5 255.255.255.0- (Optional) Configure additional VLAN subinterfaces by completing Steps 3 through 8.
Figure 15 illustrates the PPPoE/VLAN/Fast Ethernet stacking, showing two separate VLAN subinterfaces. One VLAN subinterface has two PPPoE subinterfaces, and one VLAN subinterface has one PPPoE subinterface.
![]()
Configuring MPLS over VLAN
To configure MPLS over VLAN over an Ethernet interface:
- Specify a Fast Ethernet, Gigabit Ethernet, or 10-Gigabit Ethernet port.
host1(config)#interface fastEthernet 4/0- Specify VLAN as the encapsulation method.
host1(config-if)#encapsulation vlanThe VLAN major interface is added.
- Create a VLAN subinterface by adding a subinterface number to the interface identification command.
host1(config-if)#interface fastEthernet 4/1.1- Do one of the following:
host1(config-if)#vlan id 400Assign a VLAN ID and the optional unique MAC address for the subinterface. host1(config-if)#vlan id 400 mac-address 0090.1a01.1234Figure 16 illustrates the MPLS/VLAN/Fast Ethernet stacking, showing one VLAN subinterface.
![]()
Configuring IP over VLAN and PPPoE over VLAN
To configure IP over VLAN with PPPoE over the same VLAN over an Ethernet interface:
- Specify a Fast Ethernet, Gigabit Ethernet, or 10-Gigabit Ethernet port.
host1(config)#interface fastEthernet 4/1- Specify VLAN as the encapsulation method.
host1(config-if)#encapsulation vlanThe VLAN major interface is added.
- Create a VLAN subinterface by adding a subinterface number to the interface identification command.
host1(config-if)#interface fastEthernet 4/1.1- Do one of the following:
host1(config-if)#vlan id 400Assign a VLAN ID and the optional unique MAC address for the subinterface. host1(config-if)#vlan id 400 mac-address 0090.1a01.1234
- Create an IP interface on the same VLAN as the PPPoE interface.
host1(config-if)#ip address 164.10.6.71 255.255.255.0- Specify PPPoE as the encapsulation method on the interface.
host1(config-if)#pppoe- Create a PPPoE subinterface.
host1(config-if)#pppoe subinterface fastEthernet 4/1.1.1- Specify PPP as the encapsulation method on the interface.
host1(config-if)#encapsulation ppp- Assign an IP address and mask.
host1(config-if)#ip address 192.6.129.5 255.255.255.0- (Optional) Configure additional PPPoE subinterfaces by completing Steps 7 through 9 using unique numbering.
To configure additional IP interfaces over the VLAN major interface:
- Create a new VLAN subinterface by adding a unique subinterface number to the interface identification command.
host1(config-if)#interface fastEthernet 4/1.2- Assign a VLAN ID for the subinterface.
host1(config-if)#vlan id 401- Assign an IP address and mask.
host1(config-if)#ip address 164.10.6.51 255.255.255.0Figure 17 illustrates the configuration steps for two VLAN subinterfaces. In this example:
- VLAN subinterface 4/1.1 has an IP interface, a PPPoE interface, and multiple PPPoE subinterface stacks.
- VLAN subinterface 4/1.2 has only an IP interface.
NOTE: Before you can remove a VLAN subinterface, you must remove the upper-layer interface stack.
![]()
encapsulation ppp
host1(config-if)#encapsulation pppUse the no version to disable PPP on the interface. encapsulation vlan
host1(config-if)#encapsulation vlanUse the no version to disable VLAN on an interface. ip address
- Use to set a primary or secondary IP address for an interface or subinterface.
- Specify the layer 2 encapsulation before you set the IP address.
- Example
host1(config-if)#ip address 192.6.129.5 255.255.255.0Use the no version to remove an IP address or disable IP processing. pppoe
host1(config-if)#pppoeUse the no version to disable PPPoE on the interface. pppoe subinterface fastEthernet
host1(config-if)#pppoe subinterface fastEthernet 4/1.1.1Use the no version to remove a PPPoE subinterface on a Fast Ethernet interface. pppoe subinterface gigabitEthernet
pppoe subinterface tenGigabitEthernet
- Use to create a PPPoE subinterface on a Gigabit Ethernet interface or on a 10-Gigabit Ethernet interface.
- Example 1Creates a PPPoE subinterface on an ERX-7xx model, ERX-14xx model, or the ERX-310 router
host1(config-if)#pppoe subinterface gigabitEthernet 4/2.1.1Example 2Creates a PPPoE subinterface on the E320 router host1(config-if)#pppoe subinterface tenGigabitEthernet 4/0/2.1.1Use the no version to remove a PPPoE subinterface on a Gigabit Ethernet interface or on a 10-Gigabit Ethernet interface. vlan description
- Use to assign an alias or description to a VLAN subinterface.
- You can use a maximum of 64 characters for the description or to name the alias.
- Example
host1(config-if)#vlan description randolph56aUse the no version to remove the VLAN description. vlan id
- Use to specify the VLAN ID.
- Use a VLAN ID that is in the range 04095 and is unique within the Ethernet interface.
- Issue the vlan id command before any upper bindings are made, such as IP or PPPoE.
- Use the mac-address keyword to specify a unique MAC address for the VLAN subinterface. When you do not specify a unique MAC address, the VLAN uses the MAC address of the Ethernet interface.
- Use the optional keyword untagged to specify that frames be sent untagged. The keyword is valid only for VLAN ID 0. Tagged frames can be received, but untagged frames are sent.
- Examples
host1(config-if)#vlan id 400host1(config-if)#vlan id 4 255 mac-address 0090.1a01.1234There is no no version.