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

feature request: multiple simultaneous tunnels #7

Open
timurlatipov opened this issue Aug 22, 2024 · 8 comments
Open

feature request: multiple simultaneous tunnels #7

timurlatipov opened this issue Aug 22, 2024 · 8 comments

Comments

@timurlatipov
Copy link

timurlatipov commented Aug 22, 2024

Original Windows WireGuard application allows running several tunnels simultaneously as long as the AllowedIPs of those tunnels do not overlap. AmneziaWG doesn't seem to be able to do so. Are there any plans to re-introduce this feature?

It is one of the features we love Wireguard for. Say I have to configs, one for work vpn, the other is personal

  1. Work config tunnels a single /8 subnet via its own server:
    AllowedIPs = 10.0.0.0/8

  2. And personal config would tunnel all of the rest through another vpn server:
    AllowedIPs = 0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/2, 128.0.0.0/1

Such two tunnels will work simultaneously in original client, but AnmeziaWG cannot do this
If it is possible. please add this functionality to AnmeziaWG

@VasiliyMooduckovich
Copy link

VasiliyMooduckovich commented Aug 26, 2024

im also curious about that feature, 'cause in original client you can just add specific registry key and u good to go

https://rair.dev/wireguard-windows-multiple-simultaneous-tunnels/
https://git.zx2c4.com/wireguard-windows/about/docs/adminregistry.md

upd
i've read the docs im gonna try this out

@grandsilence
Copy link

I tried both options for the MultipleSimultaneousTunnels key and had no positive effect:

reg add HKLM\Software\AmneziaWG /v MultipleSimultaneousTunnels /t REG_DWORD /d 1 /f
reg add HKLM\Software\Wireguard /v MultipleSimultaneousTunnels /t REG_DWORD /d 1 /f

@Verity-Freedom
Copy link

Amnezia VPN already has split tunnels for AmneziaWG so it makes the AmneziaWG outdated, please update the application.

@timurlatipov
Copy link
Author

Amnezia VPN already has split tunnels for AmneziaWG so it makes the AmneziaWG outdated, please update the application

Amnezia VPN doesn't allow running two tunnels simultaneously, does it?

@Verity-Freedom
Copy link

Amnezia VPN already has split tunnels for AmneziaWG so it makes the AmneziaWG outdated, please update the application

Amnezia VPN doesn't allow running two tunnels simultaneously, does it?

Idk I need splitting tunnels.

@Trogvars
Copy link

Trogvars commented Nov 22, 2024

Need this feature too! Please add.

@Trogvars
Copy link

Check commit on issue.
Just uncomment tunnel intersection check in ipc_server.go and everything start to work as expected!

@breBHo
Copy link

breBHo commented Dec 13, 2024

Check commit on issue. Just uncomment tunnel intersection check in ipc_server.go and everything start to work as expected!

Thank you very much for your help. I had been searching for a way to connect to multiple Amnezia VPNs or other unblockable protocols simultaneously for quite some time, but everywhere I tried, I encountered failure.

And then your advice to uncomment the tunnel intersection check in ipc_server.go helped me, though I ran into issues during the build process, which I managed to resolve.

Please don't be too critical of my guide; I haven't written many of them and it's been a long time since I last did.

So, for those who might also need to use multiple Amnezia VPN tunnels, here's what to do:

  1. Download the archive with the AmneziaWG source files and extract it somewhere.
  2. Navigate to: "amneziawg-windows-client-1.0.0" – manager – ipc_server.go.
  3. Find this section of the code and uncomment it:
c2, err := conf.LoadFromName(t)
       if err != nil || !c.IntersectsWith(c2) {
           // If we can't get the config, assume it doesn't intersect.
           continue
       }
       tt = append(tt, t)
       if len(t) > 0 && (state == TunnelStarting || state == TunnelUnknown) {
           inTransition = t
           break
       }
  1. After that, run the build.bat file as an administrator.
  2. Then run the quickinstall.bat file as an administrator and wait.
  3. In the end, you’ll find a folder (amd64/x86/arm64) in the root directory, containing the resulting .exe file.
  4. For a simpler installation, you can just download version 1.0.0 (already compiled) and replace the .exe file with the new one.

However, I encountered an issue where only the x86 version was being created. I had to tinker with the MakeFile to remove x86 support. Here's what I did:

  • Delete and modify these sections in the MakeFile:

    x86/amneziawg.exe: export GOARCH := 386
    x86/amneziawg.exe: x86/wintun.dll resources_386.syso $(SOURCE_FILES)
        go build $(GOFLAGS) -o $@
    x86/wintun.dll:
        cp .deps/wintun/bin/x86/wintun.dll $@
    1. Change:
    all: amd64/amneziawg.exe x86/amneziawg.exe

    To:

    all: amd64/amneziawg.exe
    1. In the clean section, remove references to x86 to make it look like this:
    clean:
        rm -rf *.syso ui/icon/*.ico amd64/ arm64/ .deps
  • After that, I needed to edit build.bat:

    • Steps to edit build.bat:

      1. Remove the x86 build call:
        In the :build section, find this line:

        call :build_plat x86 i686 386 || goto :error

        And delete it completely, leaving only:

        call :build_plat amd64 x86_64 amd64 || goto :error
        call :build_plat arm64 aarch64 arm64 || goto :error
      2. Remove x86 signature builds:
        In the :sign section, find the line referencing x86\amneziawg.exe and delete it:

        signtool sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d WireGuard x86\amneziawg.exe x86\awg.exe amd64\amneziawg.exe amd64\awg.exe arm64\amneziawg.exe arm64\awg.exe || goto :error

        Replace it with:

        signtool sign /sha1 "%SigningCertificate%" /fd sha256 /tr "%TimestampServer%" /td sha256 /d WireGuard amd64\amneziawg.exe amd64\awg.exe arm64\amneziawg.exe arm64\awg.exe || goto :error
      3. Remove x86 dependencies and resources:
        In the :build_plat section, replace:

        copy /Y ".deps\wintun\bin\%~1\wintun.dll" "%~1\wintun.dll" > NUL || exit /b 1

        With:

        if not "%~3"=="386" (
            copy /Y ".deps\wintun\bin\%~1\wintun.dll" "%~1\wintun.dll" > NUL || exit /b 1
        )

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

6 participants