Requirements: In the LAN, the configuration of VLAN on the switch can reduce the range of host communication broadcast domain, when some hosts need to communicate between the VLAN, but the switch does not support the three-tier exchange, you can use a 802.1Q router to achieve the interoperability of VLANs. This requires a sub-interface to be built on the Ethernet port, Assign the IP address as the gateway for the VLAN and start the 802.1Q.
Network: The router E0 port is connected with the Uplink trunk port (24th port) of the switch, and the switch downlink is divided into 3 VLANs with several hosts.
The topology map is as follows:
1. Configuration of routers
[Router]
[Router]inter E0
[Router-ethernet0]ip Add 10.0.0.1 255.255.255.0
[Router-ethernet0]inter e0.1//define Sub-interface E0.1
[Router-ethernet0.1]ip Add 172.16.1.1 255.255.255.0
[Router-ethernet0.1]vlan-type dot1q vid 1//Specifies that Ethernet sub-interfaces belong to VLAN1, which is applied on Ethernet sub-interfaces. Only after this command has been configured does the Ethernet Sub-interface embed the VLAN tag in the Ethernet frame header based on the configured VLAN ID number, and the switch interface that is connected to the network port can correctly handle the received frames.
[Router-ethernet0.1]inter e0.2//define Sub-interface E0.2
[Router-ethernet0.2]ip Add 172.16.2.1 255.255.255.0
[Router-ethernet0.2]vlan-type dot1q vid 2//specified Ethernet sub-interface belongs to VLAN2
[Router-ethernet0.2]inter e0.3//define Sub-interface E0.3
[Router-ethernet0.3]ip Add 172.16.3.1 255.255.255.0
[Router-ethernet0.3]vlan-type dot1q vid 3//specified Ethernet sub-interface belongs to VLAN3
[Router-ethernet0.3]inter E0
[Router-ethernet0]undo shut
% Interface Ethernet0 is up
[ROUTER-ETHERNET0]//cable to connect E0 port to S3026 24th port
%19:46:32:interface Ethernet0 changed state to up
%19:46:32:line protocol IP on interface Ethernet0, changed
%19:46:32:line protocol IP on interface Ethernet0.1, changed
%19:46:32:line protocol IP on interface Ethernet0.2, changed
%19:46:32:line protocol IP on interface Ethernet0.3, changed
2. Configuration of the switch
<Quidway>
<quidway>sys
Enter system view, return to User view with Ctrl+z.
[Quidway]vlan 1
[Quidway-vlan1]vlan 2
[Quidway-vlan2]port Ethernet 0/17 to ETH 0/19 ETH 0/22//Add 17th to 19th port, and 22nd port to VLAN2
[Quidway-vlan2]vlan 3
[Quidway-vlan3]port ETH 0/21//Add 21st port to VLAN2
[Quidway-vlan3]inter e0/24
[Quidway-ethernet0/24]port link-type trunk//Set port 24th to trunk ports
[Quidway-ethernet0/24]port trunk Permit VLAN all//Allow all VLAN traffic through
Please wait ... ............ ....... ....... ....... ..... Done.
[Quidway-ethernet0/24]dis Port trunk//inspection Trunk port configuration
Now, the following trunking ports exist:
Ethernet0/24
[Quidway-ethernet0/24]dis VLAN 2//Check VLAN2 configuration
VLAN Id:2
VLAN type:static
Route Interface:not configured
Description:vlan 0002
Tagged Ports:
Ethernet0/24
untagged Ports:
ETHERNET0/17 ETHERNET0/18 Ethernet0/19 ETHERNET0/22
[Quidway-ethernet0/24]dis VLAN 3//Check VLAN3 configuration
VLAN Id:3
VLAN type:static
Route Interface:not configured
Description:vlan 0003
Tagged Ports:
Ethernet0/24
untagged Ports:
Ethernet0/21
3. Check the network connectivity on the workstation. This workstation is connected to the S3026 21st port, belonging to VLAN2.
C:\Documents and Settings\administrator>ipconfig
Windows IP Configuration
Ethernet Adapter Local Area Connection:
Connection-specific DNS Suffix. :
IP address. ...........:172.16.2.22
Subnet Mask ........... : 255.255.255.0
Default Gateway ..... . : 172.16.2.1
C:\Documents and Settings\administrator>ping 172.16.3.1
Pinging 172.16.3.1 with bytes of data:
Reply from 172.16.3.1:bytes=32 time<10ms ttl=255
Reply from 172.16.3.1:bytes=32 time<10ms ttl=255
Reply from 172.16.3.1:bytes=32 time<10ms ttl=255
Reply from 172.16.3.1:bytes=32 time<10ms ttl=255
Ping statistics for 172.16.3.1:
Packets:sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trips times in Milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms