利用Cisco软件模拟校园局域网搭建及连入互联网
目錄
一、搭建拓撲結構
二、完成內網搭建
1.完成機房區域組建(vlan劃分,主干鏈路的設置)
2.完成服務器區域組建(vlan劃分、固定IP地址)
3.匯聚層設置(三層交換機),實現學校內網互聯(主干鏈路設置、svi接口設置)
4.設置DHCP服務器和學校內部網站,實現校園網聯通(自動分配ip地址)
5.實現校園網組網的完成(目標:能夠ping通路由器的lan口)
6.對學校網站服務器進行設置
三、實現內外網互聯
四、完成外網搭建
一、搭建拓撲結構
拓撲結構及接口設計如下(搭建時建議將IP地址設置完成,如不特殊說明,子網掩碼均為255.255.255.0,網關為交換機連接路由器那根線上顯示的IP地址,特殊說明時,IP地址/24的24代表子網掩碼中1的個數或者根據自己需要動態調整IP地址)
?
其中,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 trunkSwitch0(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 upSwitch(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)#end4.設置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.252Switch(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.0NAT路由器設置如下:
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 shutRouter(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 shutRouter(config-if)# %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upRouter(config-if)#int fa0/1 Router(config-if)#ip address 201.200.200.254 255.255.255.0 Router(config-if)#no shutRouter(config-if)# %LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upRouter(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設置如下:
測試如下:
?如果想設置公網可自行搭建。
總結
以上是生活随笔為你收集整理的利用Cisco软件模拟校园局域网搭建及连入互联网的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 分词问题处理
- 下一篇: DXF转DWG怎么转?三招轻松实现DXF