首页 | 互联网 | IT动态 | Cisco | Windows | Linux | Java | .Net | Oracle | 华为 | 存储世界 | 服务器 | 网络设备 | IDC | 安全 | 求职招聘
IT培训 | 数字网校 | 技术专题 | 电子书下载 | 教学视频 | 网页设计 | 平面设计 | 解决方案 | 直播室 | 虚拟考场 | 搜索 | 博客 | 沙龙 | 论坛
中国IT实验室Linux频道
中国IT教育
首页 新手入门 Linux编程 系统管理 网络管理 Linux认证 Unix/BSD Linux数据库 Linux集群 Linux手册 Linux下载 论坛 专题 RSS
您现在的位置: 中国IT实验室 >> Linux >> 网络管理 >> Linux服务器 >> 文章正文

router os端口映射方法

文章来源ChinaITLab收集整理 作者佚名 更新时间2006-5-16 保存本文保存本文 推荐给好友推荐给好友 收藏本页收藏本页

  参与的routeros是2块网卡,ether1连接adsl,做pppoe client,ether2连接局域网。
  首先按照论坛上置顶的说明正确安装并配置routeros,实现客户机能够正常上网。
  然后terminal routeros

  改变www服务端口为8081:
/ip service set www port=8081

  改变hotspot服务端口为80,为用户登录页面做准备:
/ip service set hotspot port=80


Setup hotspot profile to mark authenticated users with flow name "hs-auth":
/ip hotspot profile set default mark-flow="hs-auth" login-method=enabled-address

  增加一个用户:
/ip hotspot user add name=user1 password=1


  重定向所有未授权用户的tcp请求到hotspot服务
/ip firewall dst-nat add in-interface="ether2" flow="!hs-auth" protocol=tcp action=redirect
to-dst-port=80 comment="redirect unauthorized clients to hotspot service"


允许dns请求、icmp ping ;拒绝其他未经认证的所有请求:
/ip firewall add name=hotspot-temp comment="limit unauthorized hotspot clients"

/ip firewall rule forward add in-interface=ether2 action=jump
jump-target=hotspot-temp comment="limit access for unauthorized hotspot clients"

/ip firewall rule input add in-interface=ether2 dst-port=80 protocol=tcp
action=accept comment="accept requests for hotspot servlet"

/ip firewall rule input add in-interface=ether2 dst-port=67 protocol=udp
action=accept comment="accept requests for local DHCP server"

/ip firewall rule input add in-interface=ether2 action=jump
jump-target=hotspot-temp comment="limit access for unauthorized hotspot clients"
/ip firewall rule hotspot-temp add flow="hs-auth" action=return
comment="return if connection is authorized"

/ip firewall rule hotspot-temp add protocol=icmp action=return
comment="allow ping requests"

/ip firewall rule hotspot-temp add protocol=udp dst-port=53 action=return
comment="allow dns requests"

/ip firewall rule hotspot-temp add action=reject
comment="reject access for unauthorized clients"

创建hotspot通道给认证后的hotspot用户
Create hotspot chain for authorized hotspot clients:
/ip firewall add name=hotspot comment="account authorized hotspot clients"

Pass all through going traffic to hotspot chain:
/ip firewall rule forward add action=jump jump-target=hotspot
comment="account traffic for authorized hotspot clients"

  客户机输入任何网址,都自动跳转到登陆页面,输入账号密码,继续浏览。
如果使用ftp、pop3等,也必须先通过网页登录,才可以使用,当然使用winbox的时候也必须先登录。

【责编:Kittoy】
中国IT教育
相关产品和培训
文章评论
 友情推荐链接
 专题推荐

 ·Linux 安全管理
 ·Linux 下DNS服务器架设攻略
 ·Linux 下的路由的配置与应用
 ·专题:Apache实用手册
 ·全面剖析Linux文件系统
 ·Linux常用命令全集
 ·GRUB 玩转任意操作系统多重启动引导
 ·想传就传 多平台随心所欲架设FTP
 ·网络圈地 建立企业web服务器专题
 ·Linux安装指南专题
 今日更新
 认证培训
 频道精选
 Windows频道导航