Configure VLAN Interface
Network Requirements
Configure the VLAN interface on Device to realize the intercommunication between PC1 and PC2 of different VLANs.
Network Topology
Figure 4-1 Network topology of configuring VLAN interface
Configuration Steps
Step1: Configure VLAN and port link type on Device.
#Create VLAN2 and VLAN3 on Device.
Device#configure terminal
Device(config)#vlan 2-3
|
#Configure the link type of port gigabitethernet0/1 and gigabitethernet0/2 on Device as Access. Port gigabitethernet0/1 permits the services of VLAN2 to pass and gigabitethernet0/2 permits the services of VLAN3 to pass.
Device(config)#interface gigabitethernet 0/1
Device(config-if-gigabitethernet0/1)#switchport mode access
Device(config-if-gigabitethernet0/1)#switchport access vlan 2
Device(config-if-gigabitethernet0/1)#exit
Device(config)#interface gigabitethernet 0/2
Device(config-if-gigabitethernet0/2)#switchport mode access
Device(config-if-gigabitethernet0/2)#switchport access vlan 3
Device(config-if-gigabitethernet0/2)#exit
|
Step2: Configure the VLAN interface and IP address on Device.
#Create VLAN2 interface on Device whose IP address is 1.1.1.1 and subnet mask is 255.255.255.0; create VLAN3 interface whose IP address is 2.1.1.1 and subnet mask is 255.255.255.0.
Device(config)#interface vlan 2
Device(config-if-vlan2)#ip address 1.1.1.1 255.255.255.0
Device(config-if-vlan2)#exit
Device(config)#interface vlan 3
Device(config-if-vlan3)#ip address 2.1.1.1 255.255.255.0
Device(config-if-vlan3)#exit
|
Step3: Check the result.
#View the information of VLAN interface on Device.
Device#show interface vlan 2
vlan2:
line protocol is up
Flags: (0xc008063) BROADCAST MULTICAST ARP RUNNING
Type: ETHERNET_CSMACD
Internet address: 1.1.1.1/24
Broadcast address: 1.1.1.255
Metric: 0, MTU: 1500, BW: 100000 Kbps, DLY: 100 usec, VRF: global
Reliability 255/255, Txload 1/255, Rxload 1/255
Ethernet address is 0012.2355.9913
5 minutes input rate 0 bits/sec, 0 packets/sec
5 minutes output rate 0 bits/sec, 0 packets/sec
0 packets received; 1 packets sent
0 multicast packets received
1 multicast packets sent
0 input errors; 0 output errors
0 collisions; 0 dropped
Unknown protocol 0
Device#show interface vlan 3
vlan3:
line protocol is up
Flags: (0xc008063) BROADCAST MULTICAST ARP RUNNING
Type: ETHERNET_CSMACD
Internet address: 2.1.1.1/24
Broadcast address: 2.1.1.255
Metric: 0, MTU: 1500, BW: 100000 Kbps, DLY: 100 usec, VRF: global
Reliability 255/255, Txload 1/255, Rxload 1/255
Ethernet address is 0012.2355.9913
5 minutes input rate 0 bits/sec, 0 packets/sec
5 minutes output rate 0 bits/sec, 0 packets/sec
0 packets received; 1 packets sent
0 multicast packets received
1 multicast packets sent
0 input errors; 0 output errors
0 collisions; 0 dropped
Unknown protocol 0
#PC1 can ping PC2.