Code Monkey home page Code Monkey logo

Comments (2)

okastl avatar okastl commented on July 27, 2024

I am not sure yet, how useful it is to disable NAT.

I did some testing, and it is very useful. NAT is fine and easy to use, but it has some disadvantages:
1.) As peers are behind a NAT, they cannot be addressed from your network
2.) You don't know, from which peer a request originates, as the originating IP will always be the one of the LAN adapter, where the wireguard tunnel is running. This makes things simple, but prevents you to make clever access rules. e.g. you have a program, which allows access only from specific IP addresses (a VNC server perhaps?). Such a program will always see a request from the local LAN.

Using Windows' routing instead of NAT is fairly easy, but you need a "not completely cheap" router, which allows you to add a default route to your wireguard network.

First, you need to enable "packet forwarding" in Windows for both "wg_server" interface and your "LAN" interface. There are various methods how to do this, for simple testing this will do it:

netsh interface ipv4 set int "LAN-Connection" forwarding=enabled
netsh interface ipv4 set int "wg_server" forwarding=enabled

If wg_server interface has the correct IP, this is basically all you have to do on the Windows side.
The routing table is set up already to route from / to "wg_server" and "LAN-Connection".

If you have a router with a firewall, you will need to allow access to required services like DNS from the wireguard subnet.
But most important, you need to add a static route in your router acting as the default gateway of your LAN.
This route should specify the machine running the wireguard tunnel as a gateway to the wireguard subnet.
Once this is done, reply packets from your LAN subnet can find a way to the wireguard subnet.

This is a nice solution, especially with NAT being ... "difficult". Why NAT would require Hyper-V to be running really is beyond me. And a "Nat-less" solution simply looks cleaner in my opinion.

from wgserverforwindows.

D3viantS4ge avatar D3viantS4ge commented on July 27, 2024

It seems that there's a bug with the address field not being populated in the config.
If you manually add Address=192.168.170.1/24 under [Interface] to server_wg\wg_server.conf and reinstall the tunnel it should work.

from wgserverforwindows.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.