Chinaunix首页 | 论坛 | 博客
  • 博客访问: 610374
  • 博文数量: 132
  • 博客积分: 6010
  • 博客等级: 准将
  • 技术积分: 1520
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-13 17:00
文章分类

全部博文(132)

文章存档

2017年(1)

2014年(1)

2011年(1)

2009年(1)

2008年(3)

2007年(1)

2006年(1)

2005年(123)

我的朋友

分类: LINUX

2005-05-05 17:00:23

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

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

分析过程见地址


# 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走电信网卡、电信路由,伪装成电信出口地址,其他默认网通

参考文档:


阅读(1522) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~