Chinaunix首页 | 论坛 | 博客
  • 博客访问: 743933
  • 博文数量: 280
  • 博客积分: 10106
  • 博客等级: 上将
  • 技术积分: 3052
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-31 17:10
文章分类

全部博文(280)

文章存档

2011年(2)

2010年(4)

2009年(4)

2008年(62)

2007年(208)

我的朋友

分类: 系统运维

2008-03-05 15:57:47

ROS 命令集
/system license 查看ros级别
--------------------------------------------------------------------------------------------
一:正常开机后接下来需要登录,用户名:admin ,密码为空,成功登录后提示符是这样子:
[admin@MikroTik]>
后面可以输入一些命令,知道命令的话可以输入 ?察看当前可以使用的命令。
此时需要做的是输入:
[admin@MikroTik]> int (回车 注意:括号内是注释,下同)
[admin@MikroTik] interface>pri (回车 用于查看网卡编号,名字,还有激活状态。默认的没有激活,激活后为R)
[admin@MikroTik] interface>enable 1 (表示激活编号为1的网卡 enable 2同理)
[admin@MikroTik] interface>pri (回车 激活后的网卡 状态为R)

为了方便给网卡改名字
[admin@MikroTik] interface>set 1 name=LAN (内网)
[admin@MikroTik] interface>set 2 name=WAN (外网)

设置网卡IP
[admin@MikroTik] interface>/ (退到[admin@MikroTik]>)
[admin@MikroTik]>/ip add (回车)
[admin@MikroTik] ip address>add address 192.168.10.1/24 interface LAN (设置内网网卡IP)

到这里ROS环境下的设置完成 接下来可以用winbox设置了(你要用ROS环境我也没办法:)
二:在一台装了win系统的计算机上安装好网卡
把网卡的IP地址设置为:ip地址:192.168.10.10(和ROS一个网段就可以了),子网掩码:255.255.255.0,网关:192.168.10.1,
然后把路由的内网网卡和win系统的网卡连通。然后在win系统的IE里输入192.168.10.1 系统打开一个网页。按照提示。选那个downl....下载winbox。保存到硬盘里。
运行winbox。Connect T输入192.168.10.1、Login:输入 admin、password:空白,点击Connect,登录后打开一个新的窗口,这就是winbox的管理界面。
进入WinBOX后,点击InterFaces,选择跟ADSL链的网卡的接口,我一般把外网接口改为WAN,内网当然是LAN了(只要为了方便清楚,可以不改)。
选择WAN,点红色+号键,选择PPPOE CLIENT,在Service中输入注释,user输入ADSL用户名,Password就是密码了。并对选项框打勾(保存ADSL密码)-->APPLY.如果需要设置按需拔号,就勾上 Dial On Demand就可以了。
ADSL设置完成,明白了吗?
设置NAT共享上网: ip --》firewall -source nat ,选择 + 号,选择action,action里面选择 masquerade ,其余选择默认即可
至此,共享上网就完成了.

接下来,需要增加设置 防火墙规则,否则,安全没有保障

ip -》firewall -》filter fules ,选择 + 号,in interface 选择内网网卡(LAN),其他默认
这条路由允许来自内网的连接,如果有限制,可以修改 src address 的ip段,或者content 内容过滤
ip -》firewall -》filter chains 选中 input ,选择 drop
这条规则禁止所有的外部连接
以上两条规则,屏蔽来自外网的所有连接,还要注意,顺序不要弄错,不然,你也连接不上路由了,即:允许来自内网的连接的规则在前,拒绝所有的连接的规则在后。
如果出现规则设错,不能登陆了,可以从路由上直接登陆,然后手工删除错误的规则,或者,使用system 里面的reset 复位路由(会删除所有规则)
至此ADSL共享上网的简单设置已经完成。网络可以正常使用了。
宽带和ADSL(PPPoE)不一样。

宽带:单击IP,DHCP Clients,Enable,Add Default Route,Interface 选择ether2,hostname为Client1,OK。再次打开DHCP Clients,查看Status页看是否获取IP地址,如果获取了就完工了。
ADSL拨号设置如下:
在WINBOX中,点interfaces-->增加(+)-->pppoe clients-->dial out
在user框输入adsl拨号用户名,在password框输入密码,并对选项框打勾(保存ADSL密码)-->APPLY.
设置NAT共享上网ip --》firewall -source nat ,选择 + 号,选择action,action里面选择 masquerade
/ip firewall mangle add protocol tcp tcp-options syn-only tcp-mss 1448
===========================================================================
设置hotspot这张网卡
CODE
[admin@MikroTik] ip> hotspot
[admin@MikroTik] ip hotspot> setup
Select interface on which to run HotSpot
Hotspot interface: hotspot
Enable universal client configuration?
Enable universal client: yes

这个功能是允许远程机器连接到即使他们使用完全不同的网络设置
CODE
Local address of hotspot network gateway: 10.5.50.1/24
Masquerade hotspot network: yes
Address pool of hotspot network will be: 10.5.50.2-10.5.50.254
ip address of smtp server: 192.168.1.3

如果需要上网时输入密码认证才可以上网的,
可以启用hotspot(注意,不是那种isp认证,是通过这个
路由器的客户机上网时,会出现登陆提示,必须输入密码后,才有权上网)
我的routeros是2块网卡,WAN连接adsl,做pppoe client,LAN连接局域网。
首先按照论坛上置顶的说明正确安装并配置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的时候也必须先登录。
关于防火墙的详细设置这里不讨论了。
首先进行NAT映射先.保证映射成功.
ip->Firewall-> Destination NAT -> +
General
Src. address 0.0.0.0/0
src. port
interfalce pppoe-out1(你的ADSL拨号连接名字)
Dst.address 0.0.0.0/0
Dst.port 8080 (映射的端口)
protocol tcp (协议)
ACTION :
Action nat
to Dst.address 192.168.0.3-192.168.0.3 (映射的IP)
to Dst.port 8080 (映射的端口)
接着就设置环回的两个步骤.
ip->Firewall-> Source NAT -> +
General 页:
src.address 内网映射IP /32
src.port
Dst.address 内网映射IP网段 /24 (如果你的映射IP为192.168.1.1,那么这里你应该填上 192.168.1.0
/24)
Dst port 映射端口
out.interface all
protocol tcp
ACTION页:
Action nat
to src.address 0.0.0.0 - 0
阅读(1606) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~