使用思科packet tracer做局域网综合实验

在这里插入图片描述
使用思科packet tracer做局域网综合实验_第1张图片
1、本实验使用cisco 的packet tracer模拟器实现
2、知识点包括,vlan划分,接口加入到vlan,HSRP,dhcp和dhcp中继,ospf技术,ACL,NAT,
具体要求:
二层交换配置vlan,1-20接口分别加入到vlan10,20

汇聚交换机使用两台,实现mstp+vrrp的冗余配置,要求vlan10数据默认从sw1走,vlan20数据默认从vlan20走,

数据中心交换机做dhcp为终端分配ip地址,汇聚做dhcp中继

内网使用ospf做路由协议 实现全网通信,

访问外网使用默认路由,实现vlan10走电信线路,vkan20走联通线路

内网访问外网使用nat,外网的地址池是12.1.1.10-15,和13.1.1.10-15

发布内网的服务器的web服务,可以让外网的人访问,发布dns服务只对内网服务。

配置步骤:
sw1

ena
conf t
hostname sw1
line con 0
exec-t 0 0
exit

vlan 10
exit
#设置交换机为接入接口类型,并设置为快速接口加快生成权收敛
int rang f0/1-20
sw mode ac
sw acc vlan 10
spanning-tree portfast
int ran f0/23-24
sw mode tr
sw tr all vlan 10
exit
spanning-tree mode rapid
===sw2
ena
conf t
hostname sw2
line con 0
exec-t 0 0
exit

vlan 20
int ran f0/1-20
sw mode ac
sw acc vlan 20
spanning-tree portfast
int ran f0/23-24
sw mode tr
sw tr all vlan 20
exit
spanning-tree mode rapid
========sw3
ena
conf t
hostname sw3
line con 0
exec-t 0 0
exit

vlan 10
vlan 20
exit

ip routing

int ran g1/0/20-24
sw tr en dot1q
sw mo tr
sw tr allo vlan 10,20
exit

int vlan 10
ip add 172.16.10.1 255.255.255.0
no sh
#接口模式下配置hsrp
standby 10 ip 172.16.10.254 :虚拟接口地址
standby 10 priority 120 设置vlan10优先级
standby 10 track GigabitEthernet1/0/1
int vlan 20
ip add 172.16.20.1 255.255.255.0
no sh
standby 20 ip 172.16.20.254
standby 20 priority 80
standby 20 track GigabitEthernet1/0/1
exit

设置生成树工作模式为快速
spanning-tree mode rapid
设置本交换机为vlan10的主要根
spanning-tree vlan 10 root primary
spanning-tree vlan 20 root secondary

ip routing
int g1/0/1
no sw
ip add 192.168.10.1 255.255.255.0
no sh
exit

router ospf 1
net 172.16.10.0 0.0.0.255 a 1
net 172.16.20.0 0.0.0.255 a 1
net 192.168.10.0 0.0.0.255 a 1
exit
int vlan 10
ip helper-add 192.168.200.1
int vlan 20
ip helper-add 192.168.200.1

=========sw4
ena
conf t
hostname sw4
line con 0
exec-t 0 0
exit

vlan 10
vlan 20
exit

ip routing

int ran g1/0/20-24
sw tr en dot1q
sw mo tr
sw tr allo vlan 10,20
exit

int vlan 10
ip add 172.16.10.2 255.255.255.0
no sh
standby 10 ip 172.16.10.254
standby 10 priority 80
standby 10 track GigabitEthernet1/0/1
int vlan 20
ip add 172.16.20.2 255.255.255.0
no sh
standby 20 ip 172.16.20.254
standby 20 priority 120
standby 20 track GigabitEthernet1/0/1
exit

spanning-tree mode rapid
spanning-tree vlan 20 root primary
spanning-tree vlan 10 root secondary

ip routing
int g1/0/1
no sw
ip add 192.168.20.1 255.255.255.0
no sh
exit

int vlan 10
ip helper-add 192.168.200.1
int vlan 20
ip helper-add 192.168.200.1
exit

router ospf 1
net 172.16.10.0 0.0.0.255 a 2
net 172.16.20.0 0.0.0.255 a 2
net 192.168.20.0 0.0.0.255 a 2
exit

=======sw5
ena
conf t
hostname sw5
line con 0
exec-t 0 0
exit

ip routing

spanning-tree mode rapid
spanning-tree vlan 1 root primary

int g1/0/1
no sw
ip add 192.168.11.1 255.255.255.0
no sh
int g1/0/2
no sw
ip add 192.168.100.1 255.255.255.0
no sh
int g1/0/4
no sw
ip add 192.168.10.2 255.255.255.0
no sh
int g1/0/5
no sw
ip add 192.168.20.2 255.255.255.0
no sh
exit

router ospf 1
net 192.168.11.0 0.0.0.255 a 0
net 192.168.100.0 0.0.0.0 a 0
net 192.168.200.0 0.0.0.255 a 0
net 192.168.10.0 0.0.0.255 a 1
net 192.168.20.0 0.0.0.255 a 2
exit
排除一些设备的地址不分配
ip dhcp excluded-address 172.16.10.1 172.16.10.10
ip dhcp excluded-address 172.16.10.250 172.16.10.254
!vlan10地址池
ip dhcp pool net_vlan10
network 172.16.10.0 255.255.255.0
default-router 172.16.10.254
dns-server 8.8.8.8
exit
ip dhcp excluded-address 172.16.20.1 172.16.20.10
ip dhcp excluded-address 172.16.20.250 172.16.10.254
ip dhcp pool net_vlan20
network 172.16.20.0 255.255.255.0
default-router 172.16.20.254
dns-server 114.114.114.114
exit
int lo 0
ip add 192.168.200.1 255.255.255.255
exit

在交换上配置acl,让内网可以访问服务器
ip access-list ext acl_dns
per udp 172.16.10.0 0.0.0.255 host 192.168.100.100 eq 53
per udp 172.16.20.0 0.0.0.255 host 192.168.100.100 eq 53
per tcp 172.16.0.0 0.0.255.255 host 192.168.100.100 eq 80
deny ip any any
exit
int g1/0/2
ip access-g acl_dns out
exit

=========r1
ena
conf t
hostname r1
line con 0
exec-t 0 0
exit

int g0/1
ip add 192.168.11.2 255.255.255.0
ip nat inside
no sh
int g0/0
ip add 12.1.1.1 255.255.255.0
no sh
ip nat out
int g0/2
ip add 13.1.1.1 255.255.255.0
no sh
ip nat out
exit

ip route 0.0.0.0 0.0.0.0 12.1.1.2 40
ip route 0.0.0.0 0.0.0.0 13.1.1.2 50

router ospf 1
net 192.168.11.0 0.0.0.255 a 0
def ori
exit

做nat,内网地址段
ip access-list extended acl_nat1
permit ip 172.16.10.0 0.0.0.255 any
permit ip 172.16.20.0 0.0.0.255 any
exit
ip access-list extended acl_nat2
permit ip 172.16.20.0 0.0.0.255 any
permit ip 172.16.10.0 0.0.0.255 any
exit
做nat ,公网地址池
ip nat pool dianxin 12.1.1.10 12.1.1.15 netmask 255.255.255.0
ip nat pool liantong 13.1.1.10 13.1.1.15 netmask 255.255.255.0
分别将内网对应到相应的外网地址池
ip nat inside source list acl_nat1 pool dianxin overload
ip nat inside source list acl_nat2 pool liantong overload
将两个物理接口映射到内网的web服务器
ip nat inside source static tcp 192.168.100.100 80 12.1.1.1 80
ip nat inside source static tcp 192.168.100.100 80 13.1.1.1 80

====r2
ena
conf t
hostname r2
line con 0
exec-t 0 0
exit

int lo 0
ip add 2.1.1.1 255.255.255.0
int g0/1
ip add 23.1.1.1 255.255.255.0
no sh
int g0/0
ip add 12.1.1.2 255.255.255.0
no sh
exit
router rip
ver 2
net 12.1.1.0
net 13.1.1.0
net 23.1.1.0
net 2.0.0.0

====r3
ena
conf t
hostname r3
line con 0
exec-t 0 0
exit
int lo 0
ip add 3.1.1.1 255.255.255.0
int g0/1
ip add 23.1.1.2 255.255.255.0
no sh
int g0/0
ip add 13.1.1.2 255.255.255.0
no sh
exit
router rip
ver 2
net 12.1.1.0
net 13.1.1.0
net 23.1.1.0
net 3.0.0.0

你可能感兴趣的:(网络技术,网络,cisco,网络协议)