首頁體育 > 正文

銳捷路由器埠對映設定

2021-09-11由 最新資訊解析 發表于 體育

網咖裡有伺服器採用私網的IP地址,提供WWW、FTP、E-mail等服務,現在想讓公網上的電腦也能夠訪問這臺伺服器,配置如下:

由於路由器的WAN口採用的是公網的IP地址,如果需要區域網的伺服器要提供給公網的電腦訪問的話,那麼採用埠對映的方式,可以實現。由於每種服務的埠都是不一樣的(WWW服務:80埠;FTP服務:21埠),因此將伺服器的各種埠與對映到公網的地址相應的埠上,這樣公網上的電腦訪問路由器的WAN口的地址,即可訪問到區域網的伺服器,下面一個例子進行說明:

銳捷路由器埠對映設定

為了實現這些功能,需要配置NAT靜態對映功能。快速配置功能中不包含該功能的設定,因此需要在第一次啟動路由器後使用“no”放棄快速配置然後進入特權使用者模式進行高階設定:

!進入特權使用者層

Red-Giant>enable

!進入全域性配置層

Red-Giant#config terminal Enter configuration commands, one per line。 End with CNTL/Z。

!進入WAN口配置層

Red-Giant(config)#interface fastethernet 0

!配置WAN口地址

Red-Giant(config-if)#ip address 218。5。19。2 255。255。255。0

!設定WAN口為共享連線的Internet接入口

Red-Giant(config-if)#ip nat outside

!啟用WAN口

Red-Giant(config-if)#no shut

!返回普通使用者層

Red-Giant(config-if)#end

Red-Giant#

!這些是系統提示資訊,系統提示WAN口鏈路處於UP狀態(可通訊狀態)。

%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。

!進入LAN口配置層

Red-Giant(config)#interface fastethernet 1

!配置LAN口地址

Red-Giant(config-if)#ip address 192。168。0。1 255。255。255。0

!設定LAN口為共享連線的Intranet接入口

Red-Giant(config-if)#ip nat inside

!啟用LAN口

%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。

!配置預設路由以訪問Internet

Red-Giant(config)#ip route 0。0。0。0 0。0。0。0 fastethernet 0 218。5。19。1

!配置NAT快轉最佳化

Red-Giant(config)#ip nat optimize

!配置NAT應用的訪問列表

Red-Giant(config)#access-list 1 permit any

!配置連線共享規則

Red-Giant(config)#ip nat inside source list 1 interface fastethernet 0

!配置FTP伺服器的靜態對映

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伺服器的靜態對映

Red-Giant(config)#ip nat inside source static tcp 192.168.0.3 80 218.5.19.2 80

!配置EMAIL伺服器的靜態對映

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

!配置遠端使用者Telnet訪問口令

Red-Giant(config)#line vty 0 4

Red-Giant(config-line)#password remoteuser

Red-Giant(config-line)#end

Red-Giant(config)#enable secret private

!配置路由器名稱

Red-Giant(config)#host NBR

NBR(config)#end

NBR#

!儲存配置

NBR#write

Building configuration。。。

[OK]

透過以上配置,公網上的電腦即可透過訪問WAN口IP地址來達到訪問區域網伺服器的目的

頂部