Experiment topology:
"Color: #000000"> tutorial Environment Description:
1. Use routers R1 and R2 to simulate a PC and disable its routing function;
2. Set the IP address of port fa0/0 of router R1 to 192.168.1.2/24, and the default gateway to 192.168.1.1;
3. Set the IP address of port fa0/0 of router R2 to 192.168.0.2/24, and the default gateway to 192.168.0.1;
4. Disable the routing function of switch SW1 as a layer-2 switch, and divide two VLANs, vlan14 and vlan15;
5. Add port fa1/14 of switch SW1 to vlan14 and port fa1/15 to vlan15;
6. enable the sub-interfaces fa0/0.14 (IP: 192.168.0.1/24) and fa0/0.15 (IP: 192.168.1.1/24) on the fa0/0 interface of router R3) and encapsulate the corresponding VLAN numbers;
The experimental results require that R1 and R2 can ping each other.
Experiment configuration process:
Configuration list of switch SW1:
1. VLAN Division:
SW1 # VLAN data
SW1 (VLAN) # VLAN 14
SW1 (VLAN) # VLAN 15
SW1 (VLAN) # exit
2. Add the port to the corresponding VLAN:
SW1 (config) # int fa1/14
SW1 (config-If) # speed 100
SW1 (config-If) # duplex full
SW1 (config-If) # switchport mod ACC
SW1 (config-If) # switchport acc vlan 14
SW1 (config-If) # exit
SW1 (config) # int fa1/15
SW1 (config-If) # speed 100
SW1 (config-If) # duplex full
SW1 (config-If) # switchport mod ACC
SW1 (config-If) # switchport acc vlan 15
SW1 (config-If) # exit
3. Configure the trunk for port fa1/13:
SW1 (config) # int fa1/13
SW1 (config-If) # switchport mod trunk
SW1 (config-If) # switchport trunk encapsulation dot1q
SW1 (config-If) # No shut
SW1 (config-If) # exit
4. Disable the routing function of the vswitch:
SW1 (config) # No IP routing
Configuration list of router R3:
1. Enable router R3 routing:
R3 (config) # IP routing
2. Enable sub-interfaces, encapsulate VLANs, and set IP addresses:
R3 (config) # int fa0/0.14
R3 (config-subif) # encapsulation dot1q 14
R3 (config-subif) # IP add 192.168.0.1 255.255.255.0
R3 (config-subif) # No shut
R3 (config-subif) # exit
R3 (config) # int fa0/0.15
R3 (config-subif) # encapsulation dot1q 15
R3 (config-subif) # IP add 192.168.1.1 255.255.255.0
R3 (config-subif) # No shut
R3 (config-subif) # exit
3. Configure port fa0/0 and start the Port:
R3 (config) # int fa0/0
R3 (config-If) # speed100
R3 (config-If) # duplex full
R3 (config-If) # No shut
Configuration list of vror2 R2:
R2 (config) # No IP routing
R2 (config) # IP default-Gateway 192.168.0.1
R2 (config) # int fa0/0
R2 (config-If) # speed100
R2 (config-If) # duplex full
R2 (config-If) # IP add 192.168.0.2 255.255.255.0
R2 (config-If) # No shut
Configuration list of router r1:
R1 (config) # No IP routing
R1 (config) # IP default-Gateway 192.168.1.1
R1 (config) # int fa0/0
R1 (config-If) # speed100
R1 (config-If) # duplex full
R1 (config-If) # IP add 192.168.1.2 255.255.255.0
R1 (config-If) # No shut
R1 (config-If) # exit