栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

利用Cisco软件模拟校园局域网搭建及连入互联网

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

利用Cisco软件模拟校园局域网搭建及连入互联网

目录

一、搭建拓扑结构

二、完成内网搭建

1.完成机房区域组建(vlan划分,主干链路的设置)

2.完成服务器区域组建(vlan划分、固定IP地址)

3.汇聚层设置(三层交换机),实现学校内网互联(主干链路设置、svi接口设置)

4.设置DHCP服务器和学校内部网站,实现校园网联通(自动分配ip地址)

5.实现校园网组网的完成(目标:能够ping通路由器的lan口)

6.对学校网站服务器进行设置

三、实现内外网互联

四、完成外网搭建

一、搭建拓扑结构

拓扑结构及接口设计如下

 

其中,NAT服务器以左为内网,以右为外网部分服务器。

二、完成校园网搭建

1.完成机房区域组建

点击Switch0,进入CLI,对Switch0做出如下更改:(switch1代码一致,不再赘述) 

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname Switch0
Switch0(config)#vlan 33
Switch0(config-vlan)#vlan 37
Switch0(config-vlan)#int range fa0/1-10
Switch0(config-if-range)#switchport access vlan 37      //将fa0/1-10划分给vlan37
Switch0(config-if-range)#int range fa0/11-20
Switch0(config-if-range)#switchport access vlan 33      //将fa0/11-20划分给vlan33
Switch0(config-if-range)#exit
Switch0(config)#int fa0/24
Switch0(config-if)#switchport mode trunk

Switch0(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
end
Switch0#
%SYS-5-CONFIG_I: Configured from console by console

划分完的vlan可用show vlan命令查看

2.完成服务器区域组建(划分vlan)

点击Switch3,进入CLI,对Switch3做出如下更改:

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 99
Switch(config-vlan)#int range fa0/1-20
Switch(config-if-range)#switchport access vlan 99
Switch(config-if-range)#int fa0/24
Switch(config-if)#switchport mode trunk     //将端口设置为trunk模式

结果如下所示:

3.学校内网互联

三层交换机:

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 33
Switch(config-vlan)#vlan 37
Switch(config-vlan)#vlan 99
Switch(config-vlan)#int range fa0/1-3
Switch(config-if-range)#switchport trunk encapsulation dot1q     //IEEE 802.1Q协议,vlan一种封装方式
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#int vlan 33
Switch(config-if)#
%link-5-CHANGED: Interface Vlan33, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan33, changed state to up

Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#int vlan 37
Switch(config-if)#
%link-5-CHANGED: Interface Vlan37, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan37, changed state to up
Switch(config-if)#ip address 192.168.0.1 255.255.255.0
Switch(config-if)#ip routing          //启用IP路由功能
Switch(config)#end

4.设置DHCP服务器和学校内部网站

对ico-DHCP设置如下:

对三层交换机设置如下:

Switch(config)#int vlan 99//配置vlan99的ip地址
Switch(config-if)#
%link-5-CHANGED: Interface Vlan99, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan99, changed state to up
Switch(config-if)#ip address 172.16.1.254 255.255.255.0
Switch(config-if)#end
//打开dhcp协议
Switch(config)#service dhcp
Switch(config)#int vlan 33
Switch(config-if)#ip helper-address 172.16.1.10
Switch(config-if)#int vlan 37
Switch(config-if)#ip helper-address 172.16.1.10
Switch(config-if)#end
Switch#

5.实现校园网组网的完成(目标:能够ping通路由器的lan口)

对三层交换机设置如下:

Switch(config)#int fa0/4
Switch(config-if)#no switchport
Switch(config-if)#ip address 10.0.0.1 255.255.255.252


Switch(config)#router rip
Switch(config-router)#version 2
Switch(config-router)#no auto
Switch(config-router)#net 10.0.0.0
Switch(config-router)#net 192.168.0.0
Switch(config-router)#net 192.168.1.0
Switch(config-router)#no network 172.16.1.0

NAT路由器设置如下:

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#ip address 10.0.0.2 255.255.255.252//用的是子网掩码的反码
Router(config-if)#no shut
Router(config-if)#end
Router#conf
Router(config)#router rip
Router(config-router)#version 2
Router(config-router)#no auto
Router(config-router)#net 10.0.0.0
Router(config-router)#net 220.220.220.0

//配置内外网
Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/1
Router(config-if)#ip address 220.220.220.220 255.255.255.240
Router(config-if)#no shut

Router(config-if)#
%link-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#int fa0/0
Router(config-if)#ip nat inside
Router(config-if)#int fa0/1
Router(config-if)#ip nat outside
Router(config-if)#exit
Router(config)#ip route 0.0.0.0 0.0.0.0 fa0/1  //默认路由
是对IP数据包中的目的地址找不到存在的其他路由时,路由器所选择的路由。
Router(config)#access 1 permit 172.16.1.0 0.0.0.255//0.0.0.255为子网掩码的反码
Router(config)#access 1 permit 192.168.0.0 0.0.0.255
Router(config)#access 1 permit 192.168.1.0 0.0.0.255
Router(config)#ip nat inside source list 1 interface fa0/1 overload
//overload在同一时刻内大家都能使用公网wan口
Router(config)#end

可查看IP转换情况:

6.对学校网站服务器进行设置

测试如下:

至此,学校内网搭建完成。

三、实现内外网互联

对NAT服务器设置如下:

Router(config)#ip nat inside source static 172.16.1.221 220.220.220.209
//ico-DNS转换为公网IP220.220.220.209
Router(config)#ip nat inside source static 172.16.1.222 220.220.220.210
//Web服务器转换为公网220.220.220.210

四、完成外网搭建

对router4设置如下:

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#ip address 220.220.220.222 255.255.255.240
Router(config-if)#no shut
Router(config)#int fa1/0
Router(config-if)#ip address 20.0.0.1 255.0.0.0
Router(config-if)#no shut
Router(config-if)#int fa0/1
Router(config-if)#ip address 200.200.200.2 255.255.255.0
Router(config-if)#no shut
Router(config-if)#router rip
Router(config-router)#version 2
Router(config-router)#net 220.220.220.0
Router(config-router)#no auto
Router(config-router)#net 200.200.200.0
Router(config-router)#net 20.0.0.0
Router(config-router)#exit

对router6设置如下:

Router>en
Router#conf
Configuring from terminal, memory, or network [terminal]? 
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#ip address 200.200.200.1 255.255.255.0
Router(config-if)#no shut

Router(config-if)#
%link-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

Router(config-if)#int fa0/1
Router(config-if)#ip address 201.200.200.254 255.255.255.0
Router(config-if)#no shut

Router(config-if)#
%link-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Router(config-if)#router rip
Router(config-router)#version 2
Router(config-router)#no auto
Router(config-router)#net 200.200.200.0
Router(config-router)#net 201.200.200.0
Router(config-router)#end

对各dns设置如下:

测试如下:


 如果想设置公网可自行搭建。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/718220.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号