实验课题(2019.4.10) 实验需求: 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地址 Pc2自动获得IP地址 Pc4自动获得IP地址 Pc3手动配置IP地址 ![] 2.热备份路由 3.Vlan10跟踪路由 Vlan20跟踪路由 4.链路捆绑 SW-3L ![] SW1 ![] 5.全网互通 PC1ping通全网 PC2ping通全网 6.通过acl让pc2无法访问pc3