实验课题(2019.4.10)
![实验课题2](https://s1.51cto.com/images/blog/201904/10/66f046095164c6674606b9846660a3d2.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
实验需求:
1、pc1属于vlan10 pc2/pc4属于vlan20
2、Vlan10流量默认从SW-3L走,vlan20流量从R3走(互为热备)
3、二层交换机与三层交换机有链路捆绑
4、Pc1/2/4机器自动获取ip地址
5、全网互通pc3服务器,pc4受到acl控制,无法访问
解题:
一、划分网段
PC1属于vlan10、PC2\PC4属于vlan20
Sw-3L上的vlan10的IP是192.168.10.10
Sw-3L上的Vlan20的IP是192.168.20.20
R3上的子接口f0/0.1的IP是192.168.10.20
R3上的子接口f0/0.2的IP是192.168.20.30
其他网段如图所示
二、各个设备上的设置
SW1上的设置:
sw1#conf t
sw1(config)#vlan 10,20//建立vlan10和vlan20
sw1(config-vlan)#e
sw1(config)#int f1/0
sw1(config-if)#switchport access vlan 10//进入端口,设置端口属于vlan10
sw1(config-if)#e
sw1(config)#int f1/1
sw1(config-if)#switchport access vlan 20//进入端口,设置端口属于vlan20
sw1(config-if)#int f1/2
sw1(config-if)#switchport access vlan 20//进入端口,设置端口属于vlan20
sw1(config)#int range f1/3 - 4
sw1(config-if-range)#channel-group 1 mode on
sw1(config-if-range)#e
sw1(config)#
sw1(config)#int port-channel 1
sw1(config-if)#switchport mode trunk
sw1(config-if)#e
sw1(config)#int f1/5
sw1(config-if)#switchport mode trunk
SW-3L上的设置:
SW-3L#conf t
SW-3L(config)#vlan 10,20,30
SW-3L(config-vlan)#e
SW-3L(config)#int f1/2
SW-3L(config-if)#switchport access vlan 30
SW-3L(config-if)#e
SW-3L(config)#int range f1/0 - 1
SW-3L(config-if-range)#channel-group 1 mode on
SW-3L(config-if-range)#e
SW-3L(config)#int port-channel 1
SW-3L(config-if)#switchport mode t
SW-3L(config-if)#e
SW-3L(config)#int vlan 10
SW-3L(config-if)#ip add 192.168.10.10 255.255.255.0
SW-3L(config-if)#standby 1 ip 192.168.10.1
SW-3L(config-if)#standby 1 preempt
SW-3L(config-if)#standby 1 track f1/2
SW-3L(config-if)#e
SW-3L(config)#int vlan 20
SW-3L(config-if)#ip add 192.168.20.20 255.255.255.0
SW-3L(config-if)#standby 2 ip 192.168.20.1
SW-3L(config-if)#standby 2 priority 50
SW-3L(config-if)#e
SW-3L(config)#int vlan 30
SW-3L(config-if)#ip add 192.168.30.2 255.255.255.0
SW-3L(config-if)#no shut
SW-3L(config-if)#e
SW-3L(config)#int vlan 10
SW-3L(config-if)#ip add 192.168.10.10 255.255.255.0
SW-3L(config-if)#ip helper-address 192.168.30.1
SW-3L(config-if)#e
SW-3L(config)#int vlan 20
SW-3L(config-if)#ip add 192.168.20.20 255.255.255.0
SW-3L(config-if)#ip helper-address 192.168.30.1
SW-3L(config-if)#e
SW-3L(config)#router ospf 1
SW-3L(config-router)#network 192.168.30.0 0.0.0.255 are
SW-3L(config-router)#network 192.168.30.0 0.0.0.255 area 0
SW-3L(config-router)#network 192.168.10.0 0.0.0.255 area 0
SW-3L(config-router)#network 192.168.20.0 0.0.0.255 area 0
R1上的设置:
R1#conf t
R1(config)#int f0/1
R1(config-if)#ip add 192.168.30.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#e
R1(config)#int f0/0
R1(config-if)#ip add 192.168.40.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#
R1(config-if)#int f1/0
R1(config-if)#ip add 192.168.50.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#e
R1(config)#router ospf 1
R1(config-router)#network 192.168.30.0 0.0.0.255 are
R1(config-router)#network 192.168.30.0 0.0.0.255 area 0
R1(config-router)#network 192.168.30.0 0.0.0.255 area 0
R1(config-router)#network 192.168.40.0 0.0.0.255 area 0
R1(config-router)#network 192.168.50.0 0.0.0.255 area 0
R1(config-router)#e
R1(config)#ip dhcp pool v10
R1(dhcp-config)#network 192.168.10.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.10.1
R1(dhcp-config)#e
R1(config)#ip dhcp pool v20
R1(dhcp-config)#network 192.168.20.0 255.255.255.0
R1(dhcp-config)#default-router 192.168.20.1
R1(dhcp-config)#end
R1#conf t
R1(config)#access-list 1 deny host 192.168.20.2
R1(config)#access-list 1 permit any
R1(config)#int f1/0
R1(config-if)#ip access-group 1 out
R3上的设置:
R3#conf t
R3(config)#int f0/0
R3(config-if)#no shut
R3(config-if)#e
R3(config)#int f0/0.1
R3(config-subif)#encapsulation dot1Q 10
R3(config-subif)#ip add 192.168.10.20 255.255.255.0
R3(config-subif)#ip helper-address 192.168.40.1
R3(config-subif)#standby 1 ip 192.168.10.1
R3(config-subif)#standby 1 priority 50
R3(config-subif)#e
R3(config)#int f0/0.2
R3(config-subif)#en
R3(config-subif)#encapsulation dot1Q 20
R3(config-subif)#ip add 192.168.20.30 255.255.255.0
R3(config-subif)#ip helper-address 192.168.40.1
R3(config-subif)#standby 2 ip 192.168.20.1
R3(config-subif)#standby 2 preempt
三、测试
1.pc1自动获得IP地址
![实验课题2](https://s1.51cto.com/images/blog/201904/10/7ba710a2014735d01e1c770094d3c3ea.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
Pc2自动获得IP地址
![实验课题2](https://s1.51cto.com/images/blog/201904/10/ae0db34de8b6a370840aaf4cd62d7467.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
Pc4自动获得IP地址
![实验课题2](https://s1.51cto.com/images/blog/201904/10/78828367fcadce2b5d927a0a4e5fe145.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
Pc3手动配置IP地址
![实验课题2](https://s1.51cto.com/images/blog/201904/10/d13c7a7bbfd7baf273489ae244415e23.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![]
2.热备份路由
![实验课题2](https://s1.51cto.com/images/blog/201904/10/5c7b1dbd8d8081224cf20f22d0b13288.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![实验课题2](https://s1.51cto.com/images/blog/201904/10/c0b2ea9f23e6462ee3fef556b585a2a0.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
3.Vlan10跟踪路由
![实验课题2](https://s1.51cto.com/images/blog/201904/10/9375c9d2a021cecb3b4c65dffc963476.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
Vlan20跟踪路由
![实验课题2](https://s1.51cto.com/images/blog/201904/10/2a40b093bccd28abaaa3aeb4917aaeda.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
4.链路捆绑
SW-3L
![实验课题2](https://s1.51cto.com/images/blog/201904/10/01d848c6a4765ab0b964725da678fbef.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![]
SW1
![实验课题2](https://s1.51cto.com/images/blog/201904/10/d29514faa127d94e21e9c49c68d76e25.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![]
5.全网互通
PC1ping通全网
![实验课题2](https://s1.51cto.com/images/blog/201904/10/5e833b8b7f6eef572b57c989a7682162.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
PC2ping通全网
![实验课题2](https://s1.51cto.com/images/blog/201904/10/48f6adbc0131e2317965c9d6f2164c4b.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
6.通过acl让pc2无法访问pc3