銳捷路由器端口映射設(shè)置-如何設(shè)置路由器映射端口
網(wǎng)吧里有服務(wù)器采用私網(wǎng)的IP地址,提供WWW、FTP、E-mail等服務(wù),現(xiàn)在想讓公網(wǎng)上的電腦也能夠訪問這臺(tái)服務(wù)器,配置如下:
由于路由器的WAN口采用的是公網(wǎng)的IP地址,如果需要局域網(wǎng)的服務(wù)器要提供給公網(wǎng)的電腦訪問的話,那么采用端口映射的方式,可以實(shí)現(xiàn)。由于每種服務(wù)的端口都是不一樣的(WWW服務(wù):80端口;FTP服務(wù):21端口),因此將服務(wù)器的各種端口與映射到公網(wǎng)的地址相應(yīng)的端口上,這樣公網(wǎng)上的電腦訪問路由器的WAN口的地址,即可訪問到局域網(wǎng)的服務(wù)器,下面一個(gè)例子進(jìn)行說明:
為了實(shí)現(xiàn)這些功能,需要配置NAT靜態(tài)映射功能??焖倥渲霉δ苤胁话摴δ艿脑O(shè)置,因此需要在第一次啟動(dòng)路由器后使用“no”放棄快速配置然后進(jìn)入特權(quán)用戶模式進(jìn)行高級(jí)設(shè)置:
!進(jìn)入特權(quán)用戶層
Red-Giant>enable
!進(jìn)入全局配置層
Red-Giant#config terminal Enter configuration commands, one per line. End with CNTL/Z.
!進(jìn)入WAN口配置層
Red-Giant(config)#interface fastethernet 0
!配置WAN口地址
Red-Giant(config-if)#ip address 218.5.19.2 255.255.255.0
!設(shè)置WAN口為共享連接的Internet接入口
Red-Giant(config-if)#ip nat outside
!啟用WAN口
Red-Giant(config-if)#no shut
!返回普通用戶層
Red-Giant(config-if)#end
Red-Giant#
!這些是系統(tǒng)提示信息,系統(tǒng)提示W(wǎng)AN口鏈路處于UP狀態(tài)(可通訊狀態(tài)).
%UPDOWN: Line protocol on Interface FastEthernet0, changed state to up %UPDOWN: Interface FastEthernet0, changed state to up Red-Giant#config terminal Enter configuration commands, one per line. End with CNTL/Z.
!進(jìn)入LAN口配置層
Red-Giant(config)#interface fastethernet 1
!配置LAN口地址
Red-Giant(config-if)#ip address 192.168.0.1 255.255.255.0
!設(shè)置LAN口為共享連接的Intranet接入口
Red-Giant(config-if)#ip nat inside
!啟用LAN口
Red-Giant(config-if)#no shut
Red-Giant(config-if)#end
Red-Giant#
%UPDOWN: Line protocol on Interface FastEthernet1, changed state to up
%UPDOWN: Interface FastEthernet1, changed state to up
Red-Giant#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
!配置默認(rèn)路由以訪問Internet
Red-Giant(config)#ip route 0.0.0.0 0.0.0.0 fastethernet 0 218.5.19.1
!配置NAT快轉(zhuǎn)優(yōu)化
Red-Giant(config)#ip nat optimize
!配置NAT應(yīng)用的訪問列表
Red-Giant(config)#access-list 1 permit any
!配置連接共享規(guī)則
Red-Giant(config)#ip nat inside source list 1 interface fastethernet 0
!配置FTP服務(wù)器的靜態(tài)映射 Red-Giant(config)#ip nat inside source static tcp 192.168.0.2 20 218.5.19.2 20
Red-Giant(config)#ip nat inside source static tcp 192.168.0.2 21 218.5.19.2 21
!配置WEB服務(wù)器的靜態(tài)映射
Red-Giant(config)#ip nat inside source static tcp 192.168.0.3 80 218.5.19.2 80
!配置EMAIL服務(wù)器的靜態(tài)映射
Red-Giant(config)#ip nat inside source static tcp 192.168.0.4 25 218.5.19.2 25
Red-Giant(config)#ip nat inside source static tcp 192.168.0.4 110 218.5.19.2 110
Red-Giant(config)#end
Red-Giant#
Red-Giant#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
!配置遠(yuǎn)程用戶Telnet訪問口令
Red-Giant(config)#line vty 0 4
Red-Giant(config-line)#password remoteuser
Red-Giant(config-line)#end
Red-Giant#
Red-Giant#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Red-Giant(config)#enable secret private
!配置路由器名稱
Red-Giant(config)#host NBR
NBR(config)#end
NBR#
!保存配置
NBR#write
Building configuration...
[OK]
NBR#
通過以上配置,公網(wǎng)上的電腦即可通過訪問WAN口IP地址來達(dá)到訪問局域網(wǎng)服務(wù)器的目的