WgServerforWindows icon indicating copy to clipboard operation
WgServerforWindows copied to clipboard

Autoconfiguration ipv4 on wg server networkcard its getting random ip addres not gatway of the range of ip i set up

Open gbtech-org opened this issue 1 year ago • 6 comments

gbtech-org avatar May 25 '23 10:05 gbtech-org

Hi @gbtech-org,

Just to make sure I understand the problem, are you using NAT Routing? And are you saying that the IP address assigned to the wg_server interface is not the first address in the server address range?

image

image

micahmo avatar May 25 '23 11:05 micahmo

Yes i have set up correctly but i dont know why the wg-server get an random ip apipa

gbtech-org avatar May 25 '23 11:05 gbtech-org

Can you run these commands in PowerShell to see if it helps?

Remove-NetIPAddress -Confirm:$false -InterfaceIndex (Get-NetIPInterface -InterfaceAlias wg_server)[0].ifIndex
New-NetIPAddress -IPAddress 10.253.0.1 -PrefixLength 24 -InterfaceIndex (Get-NetIPInterface -InterfaceAlias wg_server)[0].ifIndex

Of course you can change the IPAddress as needed

micahmo avatar May 25 '23 12:05 micahmo

Yes it works thank you

gbtech-org avatar May 25 '23 17:05 gbtech-org

You're welcome. Those should be the exact commands that WS4W runs. You can see the code.

https://github.com/micahmo/WgServerforWindows/blob/913f6a298f5d285a5bc62ec728a18116c987c648/WgServerforWindows/Models/NewNetNatPrerequisite.cs#L88

https://github.com/micahmo/WgServerforWindows/blob/913f6a298f5d285a5bc62ec728a18116c987c648/WgServerforWindows/Models/NewNetNatPrerequisite.cs#L94

micahmo avatar May 25 '23 17:05 micahmo

I have a similar Problem. NAT is disabled and I get a 169... IP Adress on the WireGuard Adapter.. Then I manually change it to 10.253.0.1 but after Restart (guess the Interface is removed and created again each reboot) I have the same problem.. I don't want Clients to have Network and Internet Access, they should only have access to the WireGuard Server Computer..

glockmane avatar Nov 27 '23 14:11 glockmane