c) 配置策略路由规则:[admin@RouerOS] ip policy-routing rule> add dst-a=0.0.0.0 dst-n=0.0.0.0 src-a=172.16.2.0 src-netmask=255.255.255.0 act=lookup inte=all flow=wt table=wangtong 配置结果示例:
# 除Table main 外,其它路由表中的路由策略必须配置Flow 参数(见上表)。 §策略路由也可用下面的方法配置: ip policy-routing table jitong add dst-address=0.0.0.0/0 gateway=192.168.1.1 preferred-source=0.0.0.0 \ comment="" disabled=no / ip policy-routing table main add dst-address=0.0.0.0/0 gateway=10.255.255.1 preferred-source=0.0.0.0 \ comment="" disabled=no
1. 基于目的地址的策略路由 4. 配置Firewall
建议用GUI 终端配置Firewall 。针对某种应用的更详细的配置参见本手册后面的“防火墙配置”章节。 4.1 防火墙对包的处理方式 / ip firewall set input name="input" policy=accept comment="" set forward name="forward" policy=accept comment="" set output name="output" policy=accept comment=""
4.2 配置mangle(策略路由用到) / ip firewall mangle add src-address=172.16.1.0/24:0-65535 in-interface=all \ dst-address=0.0.0.0/0:0-65535 protocol=all tcp-options=any \ icmp-options=any:any flow="" src-mac-address=00:00:00:00:00:00 \ limit-count=0 limit-burst=0 limit-time=0s action=accept mark-flow=ji \ tcp-mss=dont-change comment="" disabled=no add src-address=172.16.2.0/24:0-65535 in-interface=all \ dst-address=0.0.0.0/0:0-65535 protocol=all tcp-options=any \ icmp-options=any:any flow="" src-mac-address=00:00:00:00:00:00 \ limit-count=0 limit-burst=0 limit-time=0s action=accept mark-flow="" \ tcp-mss=dont-change comment="" disabled=yes 4.3 开放防火墙端口 / ip firewall service-port set ftp ports=21 disabled=no set irc ports=6667 disabled=yes 4.4 配置NAT / ip firewall src-nat add src-address=172.16.1.0/24:0-65535 dst-address=0.0.0.0/0:0-65535 \ out-interface=eth0 protocol=all icmp-options=any:any flow=ji \ limit-count=0 limit-burst=0 limit-time=0s action=masquerade \ to-src-address=172.16.1.3-172.16.1.254 to-src-port=0 comment="" \ disabled=no add src-address=172.16.2.0/24:0-65535 dst-address=0.0.0.0/0:0-65535 \ out-interface=eth1 protocol=all icmp-options=any:any flow="" \ limit-count=0 limit-burst=0 limit-time=0s action=masquerade \ to-src-address=172.16.2.3-172.16.2.254 to-src-port=0 comment="" \ disabled=no §src-nat(原地址转换)是将数据包中的原地址进行转换; §dst-nat(目的地址转换)是将数据包中的目的地址进行转换。它用于让互联网用户访问私网内部的服务器(如WEB server 、FTP server),对私网上的WEB 服务器IP 进行重定向。 §如果action 选择masquerade (地址伪装),则to-src-address 不用设置!该选项是指将用户地址转换为该指定的地址,而不是public 端口的地址。
共3页: 上一页 [1] [2] 3 下一页 |