ROS多线不同网关分流图解教程目的两条电信不同网关线路,把内网的机器分成两部分,分别走一条,某一条断线时候会自动切换到另外一条,线路ok后,又切换回来。首先添加双线IP地址,我这里分别是:第一条192.168.10.2/24网关192.168.10.1[公网]第二条192.168.20.2/24网关192.168.20.1[公网]内网ROSIP地址为192.168.30.1[内网][admin@lan]ipadpriFlags:X-disabled,I-invalid,D-dynamic#ADDRESSNETWORKBROADCASTINTERFACE0192.168.30.1/24192.168.30.0192.168.30.255lan1192.168.10.2/24192.168.10.0192.168.10.255NO.12192.168.20.2/24192.168.20.0192.168.20.255NO.2添加好IP地址后,在ipfirewallmangle添加路由标记。注意其中的斜体部分是你内网分流的目标地址,红色字体为自己命的名字,后面只要对照上就可以了。[admin@lan]ipfirewallmanglepriFlags:X-disabled,I-invalid,D-dynamic0chain=preroutingsrc-address=192.168.30.2-192.168.30.127action=mark-routingnew-routing-mark=10passthrough=yes1chain=preroutingsrc-address=192.168.30.128-192.168.30.254action=mark-routingnew-routing-mark=20passthrough=yes做一个ip伪装/ipfirewallnataddchain=srcnataction=masquerade现在要在iproute中添加两条网关信息。下面的routing-mark=20就是上面所说的自己命名的对应值,此处绿色的注释也可随便改,但是下面要对上命令如下[admin@lan]/iprouteaddgateway=192.168.20.1routing-mark=20comment=link2[admin@lan]/iprouteaddgateway=192.168.10.1routing-mark=10comment=link1到这里为止已经作完成了,可以上网下面做个脚本监测某条公网线路down掉后,自动切换到另外一条创建四个脚本,如下(这个是在图形界面下的systemscript后点+号添加)link1up/iproutesetlink1gateway=192.168.10.1link1down/iproutesetlink1gateway=192.168.20.1link2down/iproutesetlink2gateway=192.168.10.1link2up/iproutesetlink2gateway=192.168.20.1命令如下/systemscriptaddname=link1downsource=/iproutesetlink1gateway=192.168.20.1\policy=ftp,reboot,read,write,policy,test,winbox,passwordaddname=link1upsource=/iproutesetlink1gateway=192.168.10.1\policy=ftp,reboot,read,write,policy,test,winbox,passwordaddname=link2upsource=/iproutesetlink2gateway=192.168.20.1\policy=ftp,reboot,read,write,policy,test,winbox,passwordaddname=link2downsource=/iproutesetlink2gateway=192.168.10.1\然后设置网络连接监测(此处的蓝色关系到脚本名字,上面蓝色处)/toolnetwatchaddhost=192.168.10.1timeout=30msinterval=1sup-script=link1up\down-script=link1downcomment=disabled=noaddhost=192.168.20.1timeout=30msinterval=1sup-script=link2up\down-script=link2downcomment=disabled=no双线不同网关分流教程.rar