Username: Password:

电信,网通双线实战
来源:Blog.ChinaUnix.net作者:Blog.ChinaUnix.net 发布时间:2008-04-07 05:17:41

讨论过程很出色.最后得出的结论. platinum 的总结...

转platinum 的总结:http://blog.platinum.net.cn/index.php?op=ViewArticle&articleId=59&blogId=1

分析过程见地址

http://bbs.chinaunix.net/forum/viewtopic.php?show_type=new&p=3547010#3547010


# echo "200    DIANXIN" >> /etc/iproute2/rt_table(这个是添加到文档,执行一次即可)
# ip route replace default via 222.168.1.2 table DIANXIN(replace用来替换默认路由,而不是添加)
# ip rule add fwmark 1 table DIANXIN(这个注意顺序,用ip rule能够查看)
# iptables -t nat -F
# iptables -t mangle -F
# iptables -t mangle -A PREROUTING -i eth0 -s 192.168.0.0/24 -d 222.222.5.0/15 -j MARK --set-mark 1
# iptables -t mangle -A PREROUTING -i eth0 -s 192.168.0.0/24 -d 222.240.0.0/13 -j MARK --set-mark 1
# iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -d 222.222.5.0/15 -j SNAT --to $DIANXIN
# iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -d 222.240.0.0/13 -j SNAT --to $DIANXIN
# iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to $接网通线路网卡的地址
# ip route flush cache

这样的结果,是访问222.222.5.0/15和222.240.0.0/13走电信网卡、电信路由,伪装成电信出口地址,其他默认网通

参考文档:
http://iptables-tutorial.frozentux.net/cn/iptables-tutorial-cn-1.1.19.html
http://www.linuxaid.com.cn/engineer/ideal/article/policy_pouting.htm
http://bbs.chinaunix.net/forum/viewtopic.php?t=304033&highlight=platinum

喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅