linux 双线 路由器服务
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux 双线 路由器服务相关的知识,希望对你有一定的参考价值。
#Set ip.
ifconfig ${nic} 192.168.2.254/24 up
ifconfig ${nic}:0 192.168.22.254/24 up
ifconfig ${nic}:1 124.133.33.114/30 up
ifconfig ${nic}:2 58.58.27.223/24 up
ifconfig ${nic}:3 192.168.2.2/24 up
ifconfig ${nic}:4 100.100.100.100/24 up
#Conf Main Table.
ip route add 192.168.1.0/24 via 192.168.2.250
ip route add 192.168.3.0/24 via 192.168.2.250
ip route add 192.168.4.0/24 via 192.168.2.250
ip route add 192.168.5.0/24 via 192.168.2.250
ip route add 192.168.6.0/24 via 192.168.2.250
#Turn on forwarding.
echo 1 >/proc/sys/net/ipv4/ip_forward
#mondify the file "/etc/iproutes/rt_tables"
echo -e ‘100 tel\n200 cnc‘ >>.rt_tables.tmp
#Config rule and routing tables.
ip route replace default via 58.58.27.1
ip rule add from 124.133.33.114 table tel
ip route flush table tel >/dev/null 2>&1
ip route add 124.133.33.112/30 src 124.133.33.114 dev ${nic}:1 table tel
ip route add 192.168.4.0/24 via 192.168.2.250 table tel
ip route add 192.168.5.0/24 via 192.168.2.250 table tel
ip route add default via 124.133.33.113 table tel
ip rule add from 58.58.27.223 table cnc
ip route flush table cnc >/dev/null 2>&1
ip route add 58.58.27.0/24 src 58.58.27.223 dev ${nic}:2 table cnc
ip route add default via 58.58.27.1 table cnc
ip rule add fwmark 22 table tel
iptables -t mangle -F
iptables -t mangle -A PREROUTING -s 192.168.22.0/24 -j MARK --set-mark 22
iptables -t nat -F
#Config Fire Wall.[SNAT]
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j MASQUERADE
#Config Fire Wall.[DNAT]
以上是关于linux 双线 路由器服务的主要内容,如果未能解决你的问题,请参考以下文章
思科路由器PBR(策略路由)结合IP SLA实现双线备份和负载均衡
我想借网吧的线 在家里上网 网吧是双线 路由器是软路由 ROS 2.8 的 。怎么设置 ROS VPN 借线 。请教高手