找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 2164|回复: 4

iptables mark标记数据包走指定通道没效果,除了和fast patch,还有冲突吗

[复制链接]
发表于 2018-8-12 20:59 | 显示全部楼层 |阅读模式
本帖最后由 muziling 于 2018-8-12 21:01 编辑

内核已关闭 fast patch

已建立一个 v....p.....n通道 tun100 ,执行下面3条命令
echo "200 tinyfecvirtual**" >> /etc/iproute2/rt_tables
ip route add default dev tun100 table 200
ip rule add to 172.217.0.228 table 200

然后
wget www.google.com 能正常打开  (假定 www.google.com对应IP为 172.217.0.228 )

但通过mark标记的方法就不行,对应命令如下:
ip rule del to 172.217.0.228 table 200
ip rule add fwmark 0x1000 table 200
iptables -t mangle -I PREROUTING -d 172.217.0.228 -j MARK --set-mark 0x1000

然后  wget www.google.com 就打不开,用netstat -an看,和 172.217.0.228的连接状态是 SYN_SENT

标记的方法为什么没效果?
我的恩山、我的无线 The best wifi forum is right here.
发表于 2018-8-12 22:42 | 显示全部楼层
检查防火墙配置,tun100是否已设置ip伪装,内网lan是否允许转发到tun100

点评

感觉和tun100 配置没关系,因为前面通过指定ip rule是可以的,只是改成mark方法不行。 通过 iptables -t nat -A PREROUTING -m mark --mark 0x1000 -j LOG --log-level debug --log-prefix "fwmark 0x1000: "  详情 回复 发表于 2018-8-12 23:01
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2018-8-12 23:01 | 显示全部楼层
ekenchan 发表于 2018-8-12 22:42
检查防火墙配置,tun100是否已设置ip伪装,内网lan是否允许转发到tun100

感觉和tun100 配置没关系,因为前面通过指定ip rule是可以的,只是改成mark方法不行。

通过
iptables -t nat -A PREROUTING -m mark --mark 0x1000 -j LOG --log-level debug --log-prefix "fwmark 0x1000: "
看日志,也没看到期望的内容
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2018-8-13 07:24 | 显示全部楼层
你的wget命令是在路由器上运行的?如果是的话mark要加在OUTPUT

点评

根据提示,找了些资料,可以了,谢谢 iptables -t nat -A POSTROUTING -o tun100 -j MASQUERADE iptables -t mangle -I PREROUTING -d 172.217.0.228 -j MARK --set-mark 0x1000 iptables -t mangle -I OUTPUT -  详情 回复 发表于 2018-8-13 09:41
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2018-8-13 09:41 | 显示全部楼层
ekenchan 发表于 2018-8-13 07:24
你的wget命令是在路由器上运行的?如果是的话mark要加在OUTPUT

根据提示,找了些资料,可以了,谢谢
iptables -t nat -A POSTROUTING  -o tun100 -j MASQUERADE
iptables -t mangle -I PREROUTING -d 172.217.0.228 -j MARK --set-mark 0x1000
iptables -t mangle -I OUTPUT -d 172.217.0.228 -j MARK --set-mark 0x1000
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-23 20:40

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表