赞
踩
目录
表1.2 VLAN划分表
描述 | VLAN | VLNA名 | IP范围 | IP地址段/掩码长度 | 网关地址 |
信息学院 | 10 | xinxi | 192.168.10.1-251 | 192.168.10.0/24 | 192.168.10.254 |
电气学院 | 20 | dianqi | 192.168.20.1-251 | 192.168.20.0/24 | 192.168.20.254 |
机械学院 | 30 | jixie | 192.168.30.1-251 | 192.168.30.0/24 | 192.168.30.254 |
图书馆 | 40 | tushuguan | 192.168.40.1-251 | 192.168.40.0/24 | 192.168.40.254 |
教职工宿舍 | 50 | sushe | 192.168.50.1-251 | 192.168.50.0/24 | 192.168.50.245 |
表1.2 网络设备互联IP地址规划表
描述 | 端口号 | IP地址 | 子网掩码 |
MuSW0 | G0/1 | 10.0.10.2 | 255.255.255.0 |
vlan 10 | 192.168.10.252 | 255.255.255.0 | |
vlan 20 | 192.168.20.252 | 255.255.255.0 | |
vlan 30 | 192.168.30.252 | 255.255.255.0 | |
vlan 40 | 192.168.40.252 | 255.255.255.0 | |
vlan 50 | 192.168.50.252 | 255.255.255.0 | |
MuSW1 | G0/1 | 10.0.20.2 | 255.255.255.0 |
vlan 10 | 192.168.10.253 | 255.255.255.0 | |
vlan 20 | 192.168.20.253 | 255.255.255.0 | |
vlan 30 | 192.168.30.253 | 255.255.255.0 | |
vlan 40 | 192.168.40.253 | 255.255.255.0 | |
vlan 50 | 192.168.50.253 | 255.255.255.0 | |
Router0 | G0/0 | 10.0.10.1 | 255.255.255.0 |
G0/1 | 10.0.20.1 | 255.255.255.0 | |
G0/2 | 172.19.68.1 | 255.255.255.248 | |
Se0/3/1 | 25.25.25.1 | 255.255.255.0 | |
Router1 | Se0/3/0 | 25.25.25.2 | 255.255.255.0 |
G0/0 | 10.155.158.1 | 255.255.255.0 | |
www服务器 | Fa0 | 172.19.68.2 | 255.255.255.248 |
ftp服务器 | Fa0 | 172.19.68.3 | 255.255.255.248 |
web服务器 | Fa0 | 172.19.68.4 | 255.255.255.248 |
对整个网络采取接入层、汇聚层和核心层三层架构模式进行网络部署,所有学校人员连接互联网时都需要进行NAT转换才能连接外网,保证接入到外网的安全性。学校内部网络采取DHCP动态分配地址方便网络维护和防止手动设置导致网络IP地址冲突。学校设置服务器区,需对服务器区业务有严格的管理措施保证服务器在整个网络中的安全运行。使用HSRP,提高网络可靠性,避免出现单点故障而使整个网络瘫痪,为网络工程提供了冗余性。
接入switch0配置,需要进行VLAN划分、设置端口类型。
- en //进入特权模式
- conf t //进入全局配置模式
- hostname switch0 //设备改名
- vlan 10 //创建VLAN
- name xinxi
- exit
- int range f0/3-24 //创建组进行批量操作
- switchport mode access //将接口模式设为access
- switchport access vlan 10 //将接口划分到vlan30
- exit
- int range f0/1-2
- switchport mode trunk //将接口模式设为trunk
- exit
汇聚层SW0配置
- en
- conf t
- hostname MuSw0
- enable password cisco //进入特权模式密码
- line vty 0 4 //设置远程登录最多允许5个用户登录
- password cisco //远程登录密码
- login //启用
- exit
- ip routing //开启三层交换机的路由功能
- vlan 10
- name xinxi //给vlan命名
- vlan 20
- name dianqi
- vlan 30
- name jixie
- vlan 40
- name tushuguan
- vlan 50
- name sushe
- exit
- int range f0/1-5
- switchport trunk encapsulation dot1q //三层交换机设trunk模式需先封装dot1q协议
- switchport mode trunk
- int range f0/23-24
- switchport trunk encapsulation dot1q
- switchport mode trunk
- interface g0/1
- no switchport //将二层接口转换为三层接口
- ip address 10.0.10.2 255.255.255.0
- exit
-
- int vlan 10
- ip add 192.168.10.252 255.255.255.0
- standby 1 ip 192.168.10.254 //创建VRRP虚拟路由器的标识vrid为1,并配置vrid 1的虚拟IP
- //地址为192.168.10.254
- standby 1 priority 120 //优先级
- standby 1 preempt //允许抢占
- standby 1 track G0/1 //跟踪上行接口g0/1的状态,如端口故障则优先级降低10
- no shutdown
- exit
- int vlan 20
- ip add 192.168.20.252 255.255.255.0
- standby 2 ip 192.168.20.254
- standby 2 priority 120
- standby 2 preempt
- standby 2 track G0/1
- no shutdown
- exit
- int vlan 30
- ip add 192.168.30.252 255.255.255.0
- standby 3 ip 192.168.30.254
- standby 3 priority 120
- standby 3 preempt
- standby 3 track G0/1
- no shutdown
- exit
- int vlan 40
- ip add 192.168.40.252 255.255.255.0
- standby 4 ip 192.168.40.254
- standby 4 priority 115
- standby 4 preempt
- no shutdown
- exit
- int vlan 50
- ip add 192.168.50.252 255.255.255.0
- standby 5 ip 192.168.50.254
- standby 5 priority 115
- standby 5 preempt
- no shutdown
- exit
-
-
- ip dhcp pool vlan10 //创建一个名为vlan10的地址池
- network 192.168.10.0 255.255.255.0 //分配192.168.10.0/24这个网段的地址
- default-router 192.168.10.254 //默认网关
- exit
- ip dhcp pool vlan20
- network 192.168.20.0 255.255.255.0
- default-router 192.168.20.254
- exit
- ip dhcp pool vlan30
- network 192.168.30.0 255.255.255.0
- default-router 192.168.30.254
- exit
- ip dhcp pool vlan40
- network 192.168.40.0 255.255.255.0
- default-router 192.168.40.254
- exit
- ip dhcp pool vlan50
- network 192.168.50.0 255.255.255.0
- default-router 192.168.50.254
- exit
-
- router ospf 2
- network 192.168.10.0 0.0.0.255 area 0 //在区域0宣告直连网段
- network 192.168.20.0 0.0.0.255 area 0
- network 192.168.30.0 0.0.0.255 area 0
- network 192.168.40.0 0.0.0.255 area 0
- network 192.168.50.0 0.0.0.255 area 0
- network 10.0.10.0 0.0.0.255 area 0
- exit
- spanning-tree mode rapid-pvst
- spanning-tree vlan 10 root primary
- spanning-tree vlan 20 root primary
- spanning-tree vlan 30 root primary
- spanning-tree vlan 40 root secondary
- spanning-tree vlan 50 root secondary //设为vlan10、20、30的根桥,vlan40、50的备份根桥
- int fa0/6 //设置心跳线
- switchport trunk encapsulation dot1q
- switchport mode trunk
- switchport trunk allowed vlan all //允许所有vlan通过
- exit
-
- ip route 0.0.0.0 0.0.0.0 10.0.10.1 //默认路由
Router0配置
- en
- conf t
- hostname Router0
- enable password cisco
- line vty 0 4
- password cisco
- login
- exit
- int g0/0
- ip add 10.0.10.1 255.255.255.0
- no shut
- exit
- int g0/1
- ip add 10.0.20.1 255.255.255.0
- no shut
- exit
- interface g0/2
- ip address 172.19.68.1 255.255.255.248
- no shutdown
- exit
- int se0/3/1
- ip add 25.25.25.1 255.255.255.0
- no shut
- exit
-
- ip route 0.0.0.0 0.0.0.0 25.25.25.2
-
- router ospf 2
- network 172.19.68.0 0.0.0.7 area 0
- network 10.0.10.0 0.0.0.255 area 0
- network 10.0.20.0 0.0.0.255 area 0
- exit
-
- ip nat inside source static 172.19.68.3 25.25.25.1 //服务器地址映射
- int se0/3/1
- ip nat outside //设置s0/3/0为出口
- exit
- int g0/0
- ip nat inside
- exit
- int g0/1
- ip nat inside
- int g0/2
- ip nat inside
- exit
- access-list 10 permit 192.168.10.0 0.0.0.255 //允许192.168.10.0网段
- access-list 10 permit 192.168.20.0 0.0.0.255
- access-list 10 permit 192.168.30.0 0.0.0.255
- access-list 10 permit 192.168.40.0 0.0.0.255
- access-list 10 permit 192.168.50.0 0.0.0.255
- ip nat pool lin 25.25.25.3 25.25.25.10 netmask 255.255.255.0 //设置地址池
- ip nat inside source list 10 pool lin overload //地址池与acl绑定,并使用napt模式
- en
- conf t
- enable password cisco
- line vty 0 4
- password cisco
- login
- exit
- int se0/3/0
- ip add 25.25.25.2 255.255.255.0
- no shut
- exit
-
- int g0/0
- ip add 10.155.158.1 255.255.255.0
- no shut
- ip route 0.0.0.0 0.0.0.0 25.25.25.1
测试终端用户能否通过DHCP自动获取地址,如图1所示
图1信息学院pc0自动获取IP地址
进行设备配置后,网络为连通状态,通过ping命令在学院之间进行互通性检测,结果如图2、图3所示:
图2 信息学院与电气学院之间的连通性测试
图3 信息学院与ISP之间的连通性测试
图4 汇聚层交换机MuSW0生成树状态图
通过上图可以看出,MuSW0为vlan10、20、30的根桥,vlan40、50的备份根桥,MuSW1则相反。
测试汇聚层HSRP状态是否正常,查看HSRP组主备状态
图5 MuSW0状态
图6 MuSW1状态
在 MuSW0和MuSW1 上查看可以发现,SW10是 VLAN10、VLAN20、VLAN30的实际网关;VLAN40、VLAN50的备份网关。SW2则正好相反。
测试内网用户有没有通过NAPT转换访问公网,下面以信息学院pc0进行访问测试为例。
图7 信息学院pc0 ping ISP
图8 在Router0上查看NAT转换条目
通过转换条目发现已成功将内网地址192.168.10.1转换为地址池里的地址25.25.25.3
测试公网用户能不能通过公网映射地址访问web服务器
图9 公网设备通过映射访问web服务器
图10 Nat映射条目
通过映射条目可以看出,已成功将服务器地址172.19.68.3映射到公网地址25.25.25.1上
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。