Principle: the principle of three-tier exchange, vlan mode and static routing
Purpose: Learn how the three switches, the configuration of vlan
Experimental tools: two PC, a Layer 2 switch, a three-layer switch, a router
1. configure the device, where the pc dragged three, three routers; r2 here to change the configuration to three switches, R3 is set to change the configuration Layer 2 switch configuration now
R1:
R2: renamed SW-3
R3: renamed sw
The basic configuration is complete (ISP on behalf of the operator's network), then start setting the experimental data
2. First network cable connected to the device, open interface information
Information set up an experiment:
PC1 ip address: 192.168.1.10
PC2 ip address: 192.168.2.20
PC3 ip address: 199.30.30.30
sw switcher f1 / 0 to vlan10, access; f1 / 0 to vlan20, accesss; f1 / 1 to trunk
three switches sw-3 f1 / 1 as trunk, f1 / at 1 is divided into two logical sub-interfaces, vlan10: 192.168.1.1, vlan20: 192.168.2.1; Layer Interface f1 / required at a given Layer 3 forwarding function 0 , ip address: 199.30.40.2
f0 / 1 Interface ip address of R1: 199.30.40.1 f0 / 0 Address: 199.30.30.1
3. Click Run to start configuring
Order with equipment according to personal habits, but can not be missed with a personal feel can be configured from the outside, from the inside out, or configuration, this time I start to router Host Configuration
R1 configure the IP address, and two non-directly connected network segment, i.e. static route, 192.168.1.0 and 192.168.2.0 added into, since both segments are needed to skip the SW-3 f1 / 0, You can set a default route to
Add a default route
Here configured, begin configuring sw-3
Open f1 / 0 forwarding, ip address configuration, and then configure the two vlan f1 / 1 physical interface virtual sub-interface, do show ip interface brief view
To f1 / 1 vlan configuration mode trunk, perform encapsulation type dot1q
配置完毕,接下来配置二层sw,给三个接口配置VLAN模式。f1/0设为vlan10,跟PC机相连,所以设为接入模式access;f1/1跟三层交换相连,设为中继模式trunk,所有vlan信息都可以传输;f1/2跟pc端相连,vlan设为20,接入模式设为接入模式access;
configure terminal 进入全局模式;vlan 10,20 创建vlan10 和vlan20(创建vlan时会自动进入vlan模式);exit返回上一层;interface f1/2 进入f1/2接口;switchport mode access 配置vlan模式为access;switchport access vlan 20 将此接口加入到vlan20中(中间配置错误,配成了vlan10,幸好及时发现,配置数据要以最开始设定好的理论值配,不能配错)
配置好f1/2后,exit返回上一层;interface f1/0 进入到f1/0接口;switchport mode access 配置f1/0接口vlan模式为接入模式access;switchport access vlan 10 将接口加入到vlan10中;int f1/1 进入f1/1接口;switchport mode trunk 配置接口vlan模式为 trunk;
switchport trunk encapulusation dot1q 配置trunk模式的封装类型为dot1q; do show vlan-switch brief查看vlan信息
可以用show interface f1/1 switchport 查看交换机接口信息验证
接下来配置三台PC机的IP地址
PC1 ip:192.168.1.10 网关192.168.1.1
PC2 ip:192.168.2.20 网关:192.168.2.1
PC3 ip:199.30.30.30 网关:199.30.30.1
接下来PC1 ping 一波PC2
to ping, you can also find I just try to ping a wave of PC3, the results failed to show not access the host, but this is a good thing, not afraid to have problems, then begin to analyze why the ping unsuccessful
Here the first ping PC3 own, self-wave
No problem, the next ping gateway
Did not ask to mention, followed by a ping PC1, the results show a connection timeout
Then you begin to see that R1 is configured correctly, do show ip route routing table
Routing table has two directly connected network segment 199.30.40.0 and 199.30.30.0, I own a default route configuration, ie, received information leading to the other segments are sent to 199.30.40.2, namely f1 three-tier exchange / 0 interface, R1, no problem
In this case consider the three-tier exchange f1 / 0 interface has not turned Layer forwarding or other problem; see above steps, sw-3 was found no entry for a route to the configuration of 199.30.30.0, added to it, ip route 199.30.30.0 255.255.255.0 199.30.40.1
Pass, ha ha
It took two hours, his mind finally turn up, this will not repeat this mistake, we learn a lesson, thank you watch