Comments (6)
没有特意去掉此功能,如果确实无效,将会修复
from xray-core.
根据 v2ray 官方文档设置透明代理,给每个 Outbound 打标记
"streamSettings": {
"network": "tcp",
"sockopt": {
"mark": 255
},iptables -t nat -A OUTPUT -p tcp -m mark --mark 0xff -j RETURN
同样的配置,在 v2ray v4.33 版本下正常,通过 iptables 能看到捕获的数据包数量
而在 xray 下看不到捕获的数据数量
v2ray这个给outbound打mark意思是这个包是由V2ray发出,不应该再有iptables重定向至dokodemo door,否则就容易产生回环,所以之前看到了是属于形成了回环?
另外之前官方教程的透明代理好像有问题,你试试用mangle表呢,以下是我自测没问题的:
# 设置策略路由
ip route add local default dev lo table 100
ip rule add fwmark 1 lookup 100
# 代理局域网设备
iptables -t mangle -N V2RAY
iptables -t mangle -A V2RAY -d ${VPS的IP}/32 -j RETURN # 配合V2ray中把outbound的address直接设为IP,防止DNS解析失败出幺蛾子
iptables -t mangle -A V2RAY -d 0.0.0.0/8 -j RETURN
iptables -t mangle -A V2RAY -d 10.0.0.0/8 -j RETURN
iptables -t mangle -A V2RAY -d 127.0.0.0/8 -j RETURN
iptables -t mangle -A V2RAY -d 169.254.0.0/16 -j RETURN
iptables -t mangle -A V2RAY -d 172.16.0.0/12 -j RETURN
iptables -t mangle -A V2RAY -d 224.0.0.0/4 -j RETURN
iptables -t mangle -A V2RAY -d 240.0.0.0/4 -j RETURN
iptables -t mangle -A V2RAY -d 192.168.0.0/16 -p tcp -j RETURN # 直连局域网,避免 V2Ray 无法启动时无法连网关的 SSH,如果你配置的是其他网段(如 10.x.x.x 等),则修改成自己的
iptables -t mangle -A V2RAY -d 192.168.0.0/16 -p udp ! --dport 53 -j RETURN # 直连局域网,53 端口除外(因为要使用 V2Ray 的
iptables -t mangle -A V2RAY -m mark --mark 0xff -j RETURN
iptables -t mangle -A V2RAY -p udp -j TPROXY --on-port 12345 --tproxy-mark 1 # 给 UDP 打标记 1,转发至 12345 端口
iptables -t mangle -A V2RAY -p tcp -j TPROXY --on-port 12345 --tproxy-mark 1 # 给 TCP 打标记 1,转发至 12345 端口
iptables -t mangle -A PREROUTING -j V2RAY # 应用规则
from xray-core.
我试了mangle表,也没问题
from xray-core.
没有特意去掉此功能,如果确实无效,将会修复
谢谢大神解答,我已经知道是什么原因了。
我是在 openwrt x64 下,使用 nobody 用户运行,会出现权限问题,使用 root 用户运行就可以了。
以下是使用 nobody 用户的提示:
github.com/xtls/xray-core/v1/transport/internet: failed to apply socket options > github.com/xtls/xray-core/v1/transport/i
nternet: failed to set SO_MARK > operation not permitted
from xray-core.
可以在xray.service文件里加上AmbientCapabilities=CAP_NET_ADMIN
解决
from xray-core.
没有特意去掉此功能,如果确实无效,将会修复
谢谢大神解答,我已经知道是什么原因了。
我是在 openwrt x64 下,使用 nobody 用户运行,会出现权限问题,使用 root 用户运行就可以了。
以下是使用 nobody 用户的提示:
github.com/xtls/xray-core/v1/transport/internet: failed to apply socket options > github.com/xtls/xray-core/v1/transport/i
nternet: failed to set SO_MARK > operation not permitted
nobody 啓動xray 帶iptables 還需要 PermissionsStartOnly=true
from xray-core.
Related Issues (20)
- I need help for making Vmess(tcp-tls) iOS Client. HOT 1
- cca3d0efb711bcf7f736c042eead5a30f455f784
- override dest address & port in Xray-core HOT 1
- 1.8.11macos版本zip文件中没有执行文件 HOT 17
- 请问httpupgrade可以直连吗?还是必须得过一下nginx或cdn? HOT 7
- [Feature Request] 可否新增一个子命令用于输出或检测一个域名或 IP 的最终分流结果 HOT 7
- 有没有办法代理指定进程 HOT 1
- TLS handshake error HOT 5
- Enhance log output HOT 4
- Cannot build version 1.8.11 from source code HOT 3
- tls: bad record MAC HOT 11
- Setting net.ipv4.conf.all.src_valid_mark=1 and enabling xray-core will cause a crash HOT 1
- 有没有大佬帮助一下配置文件问题,只代理指定的域名,其他的全部直连 / Does anyone have any help with the configuration file problem, only proxy specified domains, all other direct connection HOT 1
- 使用ss2022+httpupgrade出现时而通,时而不通的情况 HOT 4
- Feature request: alive-only random/round-robin strategy HOT 4
- Server side: blok by domain name doesn't work HOT 2
- 关于流量走指定网卡的问题 HOT 12
- Selin HOT 2
- [Potential new transport] Streamed xSSE Meek (HTTP/1.1) HOT 6
- Omid78 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xray-core.