Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

只配置ipv4可以吗? #10

Open
Angel0726 opened this issue Feb 7, 2024 · 9 comments
Open

只配置ipv4可以吗? #10

Angel0726 opened this issue Feb 7, 2024 · 9 comments

Comments

@Angel0726
Copy link

只配置ipv4可以吗?如果可以,是不是直接把教程中ipv6的内容删掉就可以了

@dnomd343
Copy link
Owner

dnomd343 commented Feb 7, 2024

是的,docker创建网络时不输入IPv6相关配置,或者关闭radvd相关选项均可。

@Angel0726
Copy link
Author

Angel0726 commented Feb 7, 2024

看下我的配置有问题吗

# 开启混杂模式,网卡按实际情况指定
$ 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

@Angel0726
Copy link
Author

Angel0726 commented Feb 7, 2024

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 &

@Angel0726
Copy link
Author

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
                    }
                ]
            }
        }
    ]
}

@Angel0726
Copy link
Author

Angel0726 commented Feb 7, 2024

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"
            }
        ]
    }
}

@Angel0726

This comment was marked as off-topic.

@Angel0726
Copy link
Author

Angel0726 commented Feb 7, 2024

按照上述配置之后,发现网络无法连接,ping 外网、ping 内网都不行

@dnomd343
Copy link
Owner

这个和ping无关,ICMP流量不会被代理。你需要将日志级别调整为 debug (目前是 info 级别),使用 docker logs -f xproxy 查看代理信息,确认流量是否被成功透明代理。

如果能确认代理成功,再来排查Xray的出站配置,如果没有相关请求信息,则需要排查透明代理配置。

@Angel0726
Copy link
Author

这个和ping无关,ICMP流量不会被代理。你需要将日志级别调整为 debug (目前是 info 级别),使用 docker logs -f xproxy 查看代理信息,确认流量是否被成功透明代理。

如果能确认代理成功,再来排查Xray的出站配置,如果没有相关请求信息,则需要排查透明代理配置。

有没有代理成功,ping baidu.com应该能ping通吧,ping不通代表网没通

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants