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

如何设置vps中不同网站出口对应不同的网卡 #1031

Open
cloveric opened this issue Apr 10, 2024 · 7 comments
Open

如何设置vps中不同网站出口对应不同的网卡 #1031

cloveric opened this issue Apr 10, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@cloveric
Copy link

cloveric commented Apr 10, 2024

套warp后,确实可以通过socks5的形式,比如正常网站通过直连走,netflix通过socks5方式走,例如这样:

outbounds:
  - name: v4
    type: direct
    direct:
      mode: 4
  - name: warp
    type: socks5
    socks5:
      addr: 127.0.0.1:40000

acl:
  geosite: geosite.dat
  inline:
    - warp(geosite:netflix)

但是这种方式看netflix,需要对dns进行些设置,比如手机端使用的时候,用nekobox的话就要把fakedns打开。如果通过路由(梅林)前置翻墙的话,电视端上面还是只能看netflix自制剧。

如果warp全局的话,上面socks5的小问题就不会存在了,但是会影响整体速度。

然后warp是可以非全局模式的,warp相当于一块网卡,我的思路是普通网站通过vps的自己网卡去访问,netfilx通过warp的网卡访问,但是看了一圈官方文档,以及issue都没有提到。所以想求助一下这块yaml怎么写,我在之前的issue看到hysteria已经支持多网卡。

@cloveric cloveric added the enhancement New feature or request label Apr 10, 2024
@haruue
Copy link
Collaborator

haruue commented Apr 10, 2024

用这里的 bindDevice 可以吗?
https://hysteria.network/docs/advanced/Full-Server-Config/#customizing-direct-outbound

假设你的 warp 网卡叫做 cfwarpwg0

outbounds:
  - name: v4
    type: direct
    direct:
      mode: 4
  - name: warp
    type: direct
    direct:
      mode: auto
      bindDevice: cfwarpwg0

acl:
  geosite: geosite.dat
  inline:
    - warp(geosite:netflix)

@cloveric
Copy link
Author

cloveric commented Apr 10, 2024

用这里的 bindDevice 可以吗? https://hysteria.network/docs/advanced/Full-Server-Config/#customizing-direct-outbound

假设你的 warp 网卡叫做 cfwarpwg0

outbounds:
  - name: v4
    type: direct
    direct:
      mode: 4
  - name: warp
    type: direct
    direct:
      mode: auto
      bindDevice: cfwarpwg0

acl:
  geosite: geosite.dat
  inline:
    - warp(geosite:netflix)

感谢指导,我本来以为这样是可以的,但是这么写了之后就连不上了。逐段试了下,发行问题就出现在
- warp(geosite:netflix)
这里。

但是我去vps中curl两块网卡,都可以curl的出来:

root@XXX-d0fec9:# curl --interface eth0 ip.gs 这个是vps网卡,可以返回本机IP结果
107.XXX.XXX.XXX
root@XXX-d0fec9:
# curl --interface warp ip.gs 这个是warp网卡,可以返回warp后的ip结果
104.XXX.XXX.XXX

所以理论上“ - warp(geosite:netflix)”这个也没有错,不知道为什么整个hysteria都连不上了

@cloveric
Copy link
Author

cloveric commented Apr 10, 2024

acl不用 geosite,改成 suffix就正常了,但是这个感觉也不是办法,比较奇怪

acl:
inline:
- warp(suffix:netflix.com)

使用上面这个就可以,但是

acl:
geosite: geosite.dat
inline:
- warp(geosite:netflix)

这个就不行。。。太诡异了,用socks5的时候就可以。

@haruue
Copy link
Collaborator

haruue commented Apr 10, 2024

服务端有报错吗? 会不会是服务本身启动失败了?
试试看如果直接把 geosite: geosite.dat 这一行删掉让 Hysteria 自己去下载这个文件会怎么样?

@cloveric
Copy link
Author

cloveric commented Apr 10, 2024

服务端有报错吗? 会不会是服务本身启动失败了? 试试看如果直接把 geosite: geosite.dat 这一行删掉让 Hysteria 自己去下载这个文件会怎么样?

感谢大神,我这个服务端不知道为什么不会下载geosite.dat,我自己回家又弄了下,服务端是连上了,配置如下:

outbounds:
  - name: v4
    type: direct
    direct:
      mode: 4
      bindDevice: eth0
  - name: warp
    type: direct
    direct:
      mode: 4
      bindDevice: warp

acl:
  geosite: geosite.dat
  inline:
    - warp(geosite:netflix)
    - direct(all)

但是我发现虽然连上,但是分流不了。。。warp非全局的时候走的是我eth0网卡,全局的时候走访的是warp的网卡。哭

@haruue
Copy link
Collaborator

haruue commented Apr 10, 2024

重新看了下这个 issue

但是这种方式看netflix,需要对dns进行些设置,比如手机端使用的时候,用nekobox的话就要把fakedns打开。如果通过路由(梅林)前置翻墙的话,电视端上面还是只能看netflix自制剧。

即使换了 bindDevice, 也还是需要使用别的工具开启 fakedns 或者 sniffer。 这是因为 hysteria 目前没有内置 sniffing 功能, 如果通过透明代理方式(TUN、 TPROXY, REDIRECT)访问, 那么由于服务端收到的请求是 IP 而不是域名, 这种情况下域名规则是不会生效的。

我们在考虑后续内置 sniffing 功能, 但是目前还没有设计好。

@egg1234
Copy link

egg1234 commented Apr 11, 2024

@cloveric 临时的解决方案可以用hysteria端口转发xray或v2fly或sing-box的vmess纯tcp连接,如果家里是通过路由(梅林)前置,那么由于服务器端及客户端都是xray或v2fly或sing-box,所以sniffer及分流都肯定没有问题的,因为hysteria只是提供了一个tcp端口转发的加速通道,实际的分流都由服务器端的xray或v2fly或sing-box完成

手机的话相对麻烦一些,需要配置nekobox的链式代理(或叫套筒代理),外层是hysteria的加速,内层传输vmess协议连接vps的xray或v2fly或sing-box服务器端,这样分流应该也是肯定没有问题的

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

No branches or pull requests

3 participants