24小时服务热线: 入驻家修

路由器端口映射设置方法(锐捷路由器的端口映射设置)

来源:啄木鸟家庭维修 时间:2023-02-06 浏览: 562

网吧里有服务器采用私网的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口

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.

!配置默认路由以访问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

Red-Giant#

Red-Giant#config terminal

Enter configuration commands, one per line. End with CNTL/Z.

!配置远程用户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#

通过以上配置,公网上的电脑即可通过访问WAN口IP地址来达到访问局域网服务器的目的

免责声明:本网站转载内容均注明出处,转载是出于传递更多信息之目的,并不意味赞成其观点或证实其内容真实性。转载稿涉及版权等问题,请立即联系网站编辑,我们会予以更改或删除相关文章,保证您的权利。
上一篇: 电脑任务栏在哪里点进去(电脑菜单任务栏不见了图解) 下一篇: 电脑属性打不开怎么办(此电脑属性打不开怎么解决)
扫码享福利
立即咨询 电话咨询 立即预约 weixiu3721.com 登录