Network Configuration
Configuring any of the network options requires a good understanding of the concepts laid out in the previous sections. All of the following examples use four different VLANs: VLAN 10, VLAN 20, VLAN 30, and VLAN 40.
The option 1 configuration requires the interfaces connected to the router to be configured into the correct VLANs. No special configuration is required on R1, as each interface would be configured like a standard LAN interface; the VLANs are invisible to R1 in this configuration.
Table 1 shows an example, using the diagram from Figure 1.
Table 1
Step |
Action(s) |
Command(s) |
1 |
Enter global configuration mode. |
SW1#configure terminal |
2 |
Enter into VLAN configuration mode and/or create a VLAN (optional). |
SW1(config)#vlan vlan-id |
3 |
Configure a name for the VLAN (optional). |
SW1(config-vlan)#name name |
4 |
Enter into interface configuration mode for the first interface connecting to R1. |
SW1(config-vlan)#interface fastethernet0/0 |
5 |
Configure the access VLAN for the interface. |
SW1(config-if)#switchport access vlan 10 |
6 |
Enter into interface configuration mode for the second interface connecting to R1. |
SW1(config-vlan)#interface fastethernet0/1 |
7 |
Configure the access VLAN for the interface. |
SW1(config-if)#switchport access vlan 20 |
8 |
Enter into interface configuration mode for the third interface connecting to R1. |
SW1(config-vlan)#interface fastethernet0/2 |
9 |
Configure the access VLAN for the interface. |
SW1(config-if)#switchport access vlan 30 |
10 |
Enter into interface configuration mode for the fourth interface connecting to R1. |
SW1(config-vlan)#interface fastethernet0/3 |
11 |
Configure the access VLAN for the interface. |
SW1(config-if)#switchport access vlan 40 |
For option 2, the router must become aware of the VLANs being used and route accordingly. Table 2 shows an example of this configuration, using the diagram from Figure 2.
Table 2
Step |
Action(s) |
Command(s) |
1 |
Enter global configuration mode. |
SW1#configure terminal |
2 |
Enter into VLAN configuration mode and/or create a VLAN (optional). |
SW1(config)#vlan vlan-id |
3 |
Configure a name for the VLAN (optional). |
SW1(config-vlan)#name name |
4 |
Enter into interface configuration mode for the first interface connecting to R1. |
SW1(config-vlan)#interface fastethernet0/0 |
5 |
Configure the interface to become a trunk. Note: Routers don’t support the dynamic trunking protocol (DTP), so the trunk must be manually enabled. |
SW1(config-if)#switchport mode trunk |
6 |
Enter global configuration mode. |
R1#configure terminal |
7 |
Create a new sub-interface on the physical interface connecting to SW1. Note: For this example, I’m using sub-interface numbers that match the VLAN numbers, but this is not required. |
R1(config)#interface fastethernet0/0.10 |
8 |
Configure the interface to use IEEE 802.1Q encapsulation and handle traffic for VLAN 10. |
R1(config-if)#encapsulation dot1Q 10 |
9 |
Create another new sub-interface on the physical interface connecting to SW1. |
R1(config)#interface fastethernet0/0.20 |
10 |
Configure the interface to use IEEE 802.1Q encapsulation and handle traffic for VLAN 20. |
R1(config-if)#encapsulation dot1Q 20 |
11 |
Create another new sub-interface on the physical interface connecting to SW1. |
R1(config)#interface fastethernet0/0.30 |
12 |
Configure the interface to use IEEE 802.1Q encapsulation and handle traffic for VLAN 30. |
R1(config-if)#encapsulation dot1Q 30 |
8 |
Create another new sub-interface on the physical interface connecting to SW1. |
R1(config)#interface fastethernet0/0.40 |
9 |
Configure the interface to use IEEE 802.1Q encapsulation and handle traffic for VLAN 40. |
R1(config-if)#encapsulation dot1Q 40 |
All Layer 3 addressing information would now be configured on the sub-interfaces that are configured.
For option 3, the configuration requires that you set up the SVI within the switch to handle the VLAN traffic. Table 3 shows an example of this configuration, using the diagram from Figure 3.
Table 3
Step |
Action(s) |
Command(s) |
1 |
Enter global configuration mode. |
SW1#configure terminal |
2 |
Enter into VLAN configuration mode and/or create a VLAN (optional). |
SW1(config)#vlan vlan-id |
3 |
Configure a name for the VLAN (optional). |
SW1(config-vlan)#name name |
4 |
Configure a new SVI interface for the first VLAN (10). |
SW1(config-vlan)#interface vlan 10 |
5 |
Configure a new SVI interface for the second VLAN (20). |
SW1(config-vlan)#interface vlan 20 |
6 |
Configure a new SVI interface for the third VLAN (30). |
SW1(config-vlan)#interface vlan 30 |
7 |
Configure a new SVI interface for the fourth VLAN (40). |
SW1(config-vlan)#interface vlan 40 |
All Layer 3 addressing information would now be configured on the SVI interfaces that are configured.