如何做到这一点:

有:
需要:
我尝试做这个,但直到最后还是不明白如何做到这一点:
echo 2 ppp0_OUT >> /etc/iproute2/rt_tables ip route add default via 95.95.95.95 dev ppp0 table ppp0_OUT iptables -A PREROUTING -i ppp0 -t mangle -j MARK --set-mark 2 ip rule add fwmark 2 table ppp0_OUT ip route flush cache sysctl -w net.ipv4.conf.eth0.rp_filter=0 sysctl -w net.ipv4.conf.ppp0.rp_filter=0
题:
1)如何使客户端PC可以通过eth1和ppp0同时访问服务器
2)客户端PC必须通过ppp0访问DNS,通过eth0访问HTTP
这是很简单的回答:)
只需要:
回答:WAN1有选项DEFROUTE =是 ,当WAN1启动时他是:
# ip route .... default via 44.44.44.44 dev eth0 proto static
WAN2 没有默认路由! 我们需要为WAN2创build默认路由,简单的脚本就可以做到这一点:
#!/bin/bash ### # echo 202 out_ppp0 >> /etc/iproute2/rt_tables ip route flush table out_ppp0 ip rule del table out_ppp0 IP_ppp0=$(/sbin/ifconfig ppp0 | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}') ip rule add from $IP_ppp0 table out_ppp0 ip route add default via $IP_ppp0 dev ppp0 table out_ppp0