
| 实验名称 | 综合实验2 (以太网、 VTP、 STP生成树协议、 HSRP热备份路由协议、 ACL访问控制表) |
| 实验目的 | 1:在交换机上配置VTP 实现VTP同步 2:实现VLAN的负载均衡 其中SW1是VLAN 10、20、30的根 是VLAN40的根 3:实现SW1和SW2互相备份 4:ACL规则 (1)客户机之间可以访问服务器 (2)客户机不能远程登录服务器,但管理员可以 (3)所有客户机可以访问,但不能互相访问 (4)客户机不能PING通路由器,但可以PING通网关 |
| " 实验环境 | 1:1台路由器 2台3层交换机 1台2层交换机 4台PC机 2:SW1的F0/0接口和R1的F0/0接口相连 网段是 10.0.0.0/8 互联地址是 10.0.0.1/8 10.0.0.2/8 3:SW2的F0/0接口好R1的F0/1接口相连 网段是 20.0.0.0/8 互联地址是 20.0.0.1/8 20.0.0.2/8 4:SW1的F0/14 F0/15 好SW2的F0/14 F0/15相连 5:SW1的F0/1接口连接SW3的F0/14接口 的F0/1接口连接SW3的F0/15接口 6:SW3的F0/1接口 F0/2接口 F0/3接口 F0/4接口 分别连接PC1 PC2 PC3 PC4 7:SW1的管理IP是 192.168.0.1 SW2的管理IP是 192.168.0.2 SW3的管理IP是192.168.0.3 的管理IP是 接口的IP |
| 网络拓扑图 | |
| " 实验步骤 | 路由器R1的配置 R1(config)# interface f0/0 R1(config-if)# ip address 10.0.0.2 255.0.0.0 R1(config-if)# no shutdown R1(config-if)# exit R1(config)# interface f0/1 R1(config-if)# ip address 20.0.0.2 255.0.0.0 R1(config-if)# no shutdown R1(config-if)# exit R1(config)# interface loopback 0 R1(config-if)# ip address 30.0.0.2 255.0.0.0 R1(config-if)# no shutdown R1(config-if)# exit R1(config)# ip route 192.168.0.0 255.255.0.0 10.0.0.1 R1(config)# ip route 192.168.0.0 255.255.0.0 20.0.0.1 R1(config)# enable secret 123456 R1(config)# username benet password 123456 R1(config)# line vty 0 4 R1(config-line)# password 123456 R1(config-line)# login R1(config-line)# exit R1(config)# access-list 1 permit 192.168.30.0 0.0.0.255 R1(config)# line vty 0 4 R1(cofig-line)# login local R1(config-line)# access-class 1 in R1(config-line)# exit 交换机SW1的配置 S1(config)# vtp domain longlong S1(config)# vtp mode server S1(config)# vtp password 123456 S1(config)# vtp pruning S1(config)# vlan 10 S1(config-vlan)# name khj1 S1(config-vlan)# end S1(config)# vlan 20 S1(config-vlan)# name khj2 S1(config-vlan)# end S1(config)# vlan 20 S1(config-vlan)# name gly S1(config-vlan)# end S1(config)# vlan 20 S1(config-vlan)# name fwq S1(config-vlan)# end S1(config)# ip routing S1(config)# interface f0/0 S1(config-if)# no switchport S1(config-if)# ip address 10.0.0.1 255.0.0.0 S1(config-if)# no shutdown S1(config)# interface rang f0/14 – 15 S1(config-if)# switchport trunk en dot1q S1(config-if)# switchport mode trunk S1(config-if)# channel-group 1 mode on S1(config-if)# exit S1(config-if)# interface f0/1 S1(config-if)# switchport trunk en dot1q S1(config-if)# switchport mode trunk S1(config-if)# exit S1(config)# interface vlan 1 S1(config-if)# ip address 192.168.0.1 255.255.255.0 S1(config-if)# standby 1 ip 192.168. 0.254 S1(config-if)# standby 1 priority 200 S1(config-if)# standby 1 track fasteEthernet 0/0 100 S1(config-if)# no shutdown S1(config-if)# exit S1(config)# interface vlan 10 S1(config-if)# ip address 192.168.10.1 255.255.255.0 S1(config-if)# standby 10 ip 192.168.10.254 S1(config-if)# standby 10 priority 200 S1(config-if)# standby 10 track fasteEthernet 0/0 100 S1(config-if)# no shutdown S1(config-if)# exit S1(config)# interface vlan 20 S1(config-if)# ip address 192.168.20.1 255.255.255.0 S1(config-if)# standby 20 ip 192.168.20.254 S1(config-if)# standby 20 priority 200 S1(config-if)# standby 20 track fasteEthernet 0/0 100 S1(config-if)# no shutdown S1(config-if)# exit S1(config)# interface vlan 30 S1(config-if)# ip address 192.168.30.1 255.255.255.0 S1(config-if)# standby 30 ip 192.168.30.254 S1(config-if)# standby 30 priority 200 S1(config-if)# standby 30 track fasteEthernet 0/0 100 S1(config-if)# no shutdown S1(config-if)# exit S1(config)# interface vlan 40 S1(config-if)# ip address 192.168.40.1 255.255.255.0 S1(config-if)# standby 40 ip 192.168.40.254 S1(config-if)# standby 40 priority 150 S1(config-if)# standby 40 preempt S1(config-if)# no shutdown S1(config-if)# exit S1(config)# ip route 0.0.0.0 0.0.0.0 10.0.0.2 S1(config)# spanning-tree vlan 10 root primary S1(config)# spanning-tree vlan 20 root primary S1(config)# spanning-tree vlan 30 root primary S1(config)# spanning-tree vlan 40 root secondary
S1(config)# enable secret 123456 S1(config)# username benet password 123456 S1(config)# line vty 0 4 S1(config-line)# password 123456 S1(config-line)# login S1(config-line)# exit S1(config)# access-list 1 permit 192.168.30.0 0.0.0.255 S1(config)# line vty 0 4 S1(cofig-line)# login local S1(config-line)# access-class 1 in S1(config-line)# exit S1(config)# ip access-list extended long S1(config-ext-nacl)# permit ip 192.168.0.0 0.0.255.255 192.168.40.0 0.0.0.255 S1(config-ext-nacl)# perrmit ip 192.168.30.0 0.0.255.255 any S1(config-ext-nacl)#deny icmp any host 10.0.0.2 echo S1(config-ext-nacl)#deny icmp any host 20.0.0.2 echo S1(config-ext-nacl)# deny ip 192.168.0.0 0.0.255.255 192.168.0.0. 0.0.255.255 S1(config-ext-nacl)# permit ip any any S1(config)# interface vlan 1 S1(config-if)# ip acess-group long in S1(config-if)# exit S1(config)# interface vlan 10 S1(config-if)# ip acess-group long in S1(config-if)# exit S1(config)# interface vlan 20 S1(config-if)# ip acess-group long in S1(config-if)# exit S1(config)# interface vlan 30 S1(config-if)# ip acess-group long in S1(config-if)# exit S1(config)# interface vlan 40 S1(config-if)# ip acess-group long in S1(config-if)# exit 交换机SW2的配置 S2(config)# vtp domain longlong S2(config)# vtp mode client S2(config)# vtp password 123456 S2(config)# ip routing S2(config)# interface f0/0 S2(config-if)# no switchport S2(config-if)# ip address 20.0.0.1 255.0.0.0 S2(config-if)# no shutdown S2(config)# interface rang f0/14 – 15 S2(config-if)# switchport trunk en dot1q S2(config-if)# switchport mode trunk S2(config-if)# channel-group 1 mode on S2(config-if)# exit S2(config-if)# interface f0/1 S2(config-if)# switchport trunk en dot1q S2(config-if)# switchport mode trunk S2(config-if)# exit S2(config)# interface vlan 1 S2(config-if)# ip address 192.168.0.2 255.255.255.0 S2(config-if)# standby 1 ip 192.168.0.254 S2(config-if)# standby 1 priority 150 S2(config-if)# standby 1 preempt S2(config-if)# no shutdown S2(config-if)# exit S2(config)# interface vlan 10 S2(config-if)# ip address 192.168.10.2 255.255.255.0 S2(config-if)# standby 10 ip 192.168.10.254 S2(config-if)# standby 10 priority 150 S2(config-if)# standby 10 preempt S2(config-if)# no shutdown S2(config-if)# exit S2(config)# interface vlan 20 S2(config-if)# ip address 192.168.20.2 255.255.255.0 S2(config-if)# standby 20 ip 192.168.20.254 S2(config-if)# standby 20 priority 150 S2(config-if)# standby 20 preempt S2(config-if)# no shutdown S2(config-if)# exit S2(config)# interface vlan 30 S2(config-if)# ip address 192.168.30.2255.255.255.0 S2(config-if)# standby 30 ip 192.168.30.254 S2(config-if)# standby 30 priority 150 S2(config-if)# standby 30 preempt S2(config-if)# no shutdown S2(config-if)# exit S2(config)# interface vlan 40 S2(config-if)# ip address 192.168.40.2 255.255.255.0 S2(config-if)# standby 40 ip 192.168.40.254 S2(200 S2(config-if)# standby 40 preempt S2(config-if)# standby 40 track fasteEthernet 0/0 100 S2(config-if)# no shutdown S2(config-if)# exit S2(config)# ip route 0.0.0.0 0.0.0.0 20.0.0.2 S2(config)# spanning-tree vlan 10 root secondary S2(config)# spanning-tree vlan 20 root secondary S2(config)# spanning-tree vlan 30 root secondary S2(config)# spanning-tree vlan 40 root primary
S2(config)# enable secret 123456 S2(config)# username benet password 123456 S2(config)# line vty 0 4 S2(config-line)# password 123456 S2(config-line)# login S2(config-line)# exit S2(config)# access-list 1 permit 192.168.30.0 0.0.0.255 S2(config)# line vty 0 4 S2(cofig-line)# login local S2(config-line)# access-class 1 in S2(config-line)# exit S2(config)# ip access-list extended long S2(config-ext-nacl)# permit ip 192.168.0.0 0.0.255.255 192.168.40.0 0.0.0.255 S2(config-ext-nacl)# perrmit ip 192.168.30.0 0.0.255.255 any S2(config-ext-nacl)#deny icmp any host 10.0.0.2 echo S2(config-ext-nacl)#deny icmp any host 20.0.0.2 echo S2(config-ext-nacl)# deny ip 192.168.0.0 0.0.255.255 192.168.0.0. 0.0.255.255 S2(config-ext-nacl)# permit ip any any S2(config)# interface vlan 1 S2(config-if)# ip acess-group long in S2(config-if)# exit S2(config)# interface vlan 10 S2(config-if)# ip acess-group long in S2(config-if)# exit S2(config)# interface vlan 20 S2(config-if)# ip acess-group long in S2(config-if)# exit S2(config)# interface vlan 30 S2(config-if)# ip acess-group long in S2(config-if)# exit S2(config)# interface vlan 40 S2(config-if)# ip acess-group long in S2 (config-if)# exit SW3的配置 S3(config)# vtp domain longlong S3(config)# vtp mode client S3(config)# vtp password 123456 S3(config)# vtp pruning S3(config)# interface rang f0/14 – 15 S3(config-if)# switchport mode trunk S3(config-if)# channel-group 1 mode on S3(config-if)# exit S3(config)# interace vlan 1 S3(config-if)# ip address 192.168.0.3 255.255.255.0 S3(config-if)# no shutdown S3(config-if)# exit S3(config)# ip default-gateway 192.168.0.254 S3(config)# no ip routing S3(config)# interface f0/1 S3(config-if)# switchport access vlan 10 S3(config-if)# exit S3(config)# interface f0/2 S3(config-if)# switchport access vlan 20 S3(config-if)# exit S3(config)# interface f0/3 S3(config-if)# switchport access vlan 30 S3(config-if)# exit S3(config)# interface f0/4 S3(config-if)# switchport access vlan 40 S3(config-if)# exit S3(config)# enable secret 123456 S3(config)# username benet password 123456 S3(config)# line vty 0 4 S3(config-line)# password 123456 S3(config-line)# login S3(config-line)# exit S3(config)# access-list 1 permit 192.168.30.0 0.0.0.255 S3(config)# line vty 0 4 S3(cofig-line)# login local S3(config-line)# access-class 1 in S3(config-line)# exit |
| " 实验验证结果 | |
| 实验问题 | |
| 解决方案 | |
