OcNOS-SP : Layer 3 Guide : Layer 3 Unicast Configuration Guide : VLAN Interfaces
VLAN Interfaces
This chapter contains examples for configuring VLAN interfaces.
Overview
Several Virtual LAN (VLAN) interfaces can be configured on a single Ethernet interface. Once created, a VLAN interface functions the same as any physical interface.
NSM recognizes VLAN interfaces as physical interfaces. Once VLAN interfaces are created in the kernel, and IP addresses are assigned to them, OcNOS commands can be used to configure and display VLAN interfaces the same as any physical interface. OcNOS routing protocols, such as OSPF and BGP can run across networks using VLAN interfaces.
Two systems with physical connectivity (either directly connected or connected through a switch), can communicate with each other via VLAN interfaces that have the same VLAN IDs and belong to the same network.
If the physical interfaces are not directly connected to a switch, the corresponding ports on the switch must be configured as trunks, and should not be associated to any VLANs in the switch. The commands to configure switch ports as trunks depend on the type of the switch, and are beyond the scope of this document.
Topology
Figure 20-132 is used to describe VLAN interface configuration. In this example, there are two routers, R1 and R2, and the eth1 interface of R1 is connected directly to eth2 using an ethernet cable.
VLAN Connections
The vlan1.10 VLAN interface is created on R1, and vlan1.10 is created on R2. The VLAN interfaces are configured in the same network: R1 and R2 can reach each other using the VLAN connection.
Note: A VLAN ID of both VLAN interfaces is the same (10). Two systems with different VLAN IDs cannot communicate, even if they are in the same network, since a VLAN ID tags packets sent on a VLAN interface.
Create a VLAN Interface
When a VLAN interface is configured, a Layer 3 interface based on the bridge-group number and VLAN ID is created. This Layer 3 interface is advertised to all the Layer 3 protocols.
#configure terminal
Enter configure mode.
(config)#bridge 1 protocol mstp
Create a MSTP bridge.
(config)#vlan database
Enter VLAN mode.
(config-vlan)#vlan 10 bridge 1
Enable VLAN 10 on bridge 1.
(config-vlan)#exit
Exit VLAN mode.
(config)#interface eth1
Enter interface mode
(config-if)#switchport
Configure interface as Layer2 interface.
(config-if)#bridge-group 1
Associate bridge group 1.
(config-if)#switchport mode trunk
Configure interface eth1 as Layer2 trunk mode.
(config-if)#switchport trunk allowed vlan add 10
Associate VLAN 10 as trunk port.
(config-if)#commit
Commit the candidate configuration to the running
(config-if)#exit
Exit interface mode.
Add IP Addresses to VLAN Interface
In NSM, you can add or remove IP addresses from VLAN interfaces, like normal interfaces. Using IMISH type:
 
#configure terminal
Enter configure mode
(config)#interface vlan1.10
Enter interface mode
(config-if)#ip address 192.168.1.50/24
Assign ip address to vlan interface
(config-if)#commit
Commit the candidate configuration to the running
(config-if)#end
Exit interface mode.
 
Display VLAN Interfaces
In OcNOS, VLAN interfaces appear as any physical interfaces, in the show running-config or the show ip interface brief outputs, and can be configured as any other interface.
The following is a sample output of the show ip interface brief command on R1.
Note: The IP address of interface vlan1.10 has correctly been changed by NSM:
#show ip interface brief
 
'*' - address is assigned by dhcp client
 
Interface IP-Address Admin-Status Link-Status
eth0 10.12.56.26 up up
lo 127.0.0.1 up up
lo.management 127.0.0.1 up up
vlan1.1 unassigned up up
vlan1.10 192.168.1.50 up up
xe1 unassigned up up
xe2 unassigned up up
xe3 unassigned up down
xe4 unassigned up down
xe5 unassigned up down
xe6 unassigned up down
xe7 unassigned up down
xe8 unassigned up down
xe9 unassigned up down
xe10 unassigned up down
xe11 unassigned up down
xe12 unassigned up down
xe13 unassigned up up
xe14 unassigned up down
xe15 unassigned up down
xe16 unassigned up up
xe17 unassigned up down
xe18 unassigned up down
xe19 unassigned up down
xe20 unassigned up down
xe21 unassigned up down
xe22 unassigned up down
xe23 unassigned up down
xe24 unassigned up down
xe25 unassigned up down
xe26 unassigned up down
xe28 unassigned up down
xe29 unassigned up down
xe30 unassigned up down
xe31 unassigned up down
xe32 unassigned up up
xe33 unassigned up down
xe34 unassigned up down
xe35 unassigned up down
xe36 unassigned up down
xe37 unassigned up up
xe38 unassigned up down
xe39 unassigned up down
xe40 unassigned up down
xe41 unassigned up up
xe42 unassigned up down
xe43 unassigned up down
xe44 unassigned up down
xe45 unassigned up up
xe46 unassigned up down
xe47 unassigned up down
xe48 unassigned up up
xe49/1 unassigned up up
xe49/2 unassigned up down
xe49/3 unassigned up down
xe49/4 unassigned up down
xe50/1 unassigned up up
xe50/2 unassigned up down
xe50/3 unassigned up down
xe50/4 unassigned up down
xe51/1 unassigned up down
xe51/2 unassigned up down
xe51/3 unassigned up down
xe51/4 unassigned up down
xe52/1 unassigned up down
xe52/2 unassigned up down
xe52/3 unassigned up down
xe52/4 unassigned up down
xe53/1 unassigned up up
xe53/2 unassigned up down
xe53/3 unassigned up down
xe53/4 unassigned up down
xe54/1 unassigned up up
xe54/2 unassigned up down
xe54/3 unassigned up down
xe54/4 unassigned up down
Below is the NSM routing table, which shows the connected network 192.168.1.0/24 of vlan1.10. These interfaces will now act as any physical interfaces, and all routing protocols will run across this network.
#show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter+F27 area, E - EVPN,
v - vrf leaked
* - candidate default
 
IP Route Table for VRF "default"
C 127.0.0.0/8 is directly connected, lo, 00:16:43
C 192.168.1.0/24 is directly connected, vlan1.10, 00:02:05
C 192.168.52.0/24 is directly connected, eth0, 00:16:39
 
Gateway of last resort is not set