Open Angel0726 opened 8 months ago
是的,docker创建网络时不输入IPv6相关配置,或者关闭radvd相关选项均可。
看下我的配置有问题吗
# 开启混杂模式,网卡按实际情况指定
$ ip link set eth0 promisc on
# 启用IPv6内核模块
$ modprobe ip6table_filter #命令报错,只用ipv4是不是不用管
# 网络配置按实际情况指定
docker network create -d macvlan \
--subnet=192.168.124.0/24 --gateway=192.168.124.1 \
-o parent=eth0 macvlan # 在eth0网
docker run --restart always \
--privileged --network macvlan -dt \
--ip 192.168.124.41 \
--name xproxy --hostname xproxy \ # 可选,指定容器名称与主机名
--volume /home/xproxy/:/xproxy/ \
--volume /home/xproxy/naive:/usr/bin/naive \
--volume /etc/timezone:/etc/timezone:ro \ # 以下两句可选,用于映射宿主机时区信息(容器内默认为UTC0时区)
--volume /etc/localtime:/etc/localtime:ro \
dnomd343/xproxy:latest
asset:
update:
cron: "0 5 6 * * *"
proxy: "socks5://127.0.0.1:1080" # 通过代理下载 Github 文件
url:
geoip.dat: "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat"
geosite.dat: "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"
network:
dev: eth0
dns:
- 192.168.124.1
ipv4:
gateway: 192.168.124.1
address: 192.168.124.41/24
bypass:
- 169.254.0.0/16
- 224.0.0.0/3
- fc00::/7
- fe80::/10
- ff00::/8
exclude:
- 192.168.124.1
proxy:
# 以下配置仅为示范
bin: xray
log: info
socks:
proxy4: 1094
direct4: 1084
sniff:
enable: true
redirect: true
# 以下配置仅为示范
dhcp:
ipv4:
enable: false
custom:
pre:
- nohup naive -c config/naive.json >> log/naive.log 2>&1 &
outbound.json文件
{
"outbounds": [
{
"tag": "direct4",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv4"
}
},
{
"tag": "direct6",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIPv6"
}
},
{
"tag": "naive",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 1080
}
]
}
},
{
"tag": "hysreria",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 10086
}
]
}
}
]
}
routing.json
{
"routing": {
"domainStrategy": "IPOnDemand",
"rules": [
{
"type": "field",
"inboundTag": [
"direct4"
],
"outboundTag": "direct4"
},
{
"type": "field",
"inboundTag": [
"proxy4"
],
"domain": [
"geosite:cn"
],
"outboundTag": "direct4"
},
{
"type": "field",
"inboundTag": [
"proxy4"
],
"ip": [
"geoip:cn",
"geoip:private"
],
"outboundTag": "direct4"
},
{
"type": "field",
"inboundTag": [
"proxy4"
],
"outboundTag": "naive"
}
]
}
}
宿主机中使用 docker network macvlan显示的容器ip地址 191.168.124.2
docker中xproxy的地址 191.168.124.41
所以导致这个问题的原因是什么
按照上述配置之后,发现网络无法连接,ping 外网、ping 内网都不行
这个和ping无关,ICMP流量不会被代理。你需要将日志级别调整为 debug
(目前是 info
级别),使用 docker logs -f xproxy
查看代理信息,确认流量是否被成功透明代理。
如果能确认代理成功,再来排查Xray的出站配置,如果没有相关请求信息,则需要排查透明代理配置。
这个和ping无关,ICMP流量不会被代理。你需要将日志级别调整为
debug
(目前是info
级别),使用docker logs -f xproxy
查看代理信息,确认流量是否被成功透明代理。如果能确认代理成功,再来排查Xray的出站配置,如果没有相关请求信息,则需要排查透明代理配置。
有没有代理成功,ping baidu.com应该能ping通吧,ping不通代表网没通
只配置ipv4可以吗?如果可以,是不是直接把教程中ipv6的内容删掉就可以了