0

The VPN client just should have a connection to my server with ip address 192.144.12.42 and all another internet requests shouldn't go through the VPN connection. So only the IP address 192.144.12.42 can be called. So I install a VPN server with the IPTables rules:

iptables -t nat -A POSTROUTING -s 10.100.170.0/24 -d 192.144.12.42 -j MASQUERADE

It means, the VPN IP address 10.100.170.0/24 just can call 192.144.12.42. So the other requests like google.de doesn't work anymore after the VPN connection of course. Thats why I want make a VPN splitting. So I changed my VPN client configuration:

[Interface]
PrivateKey = ???????????=
Address = 10.100.170.9/24,???:???:???:???::4/64
DNS = 9.9.9.9, 149.112.112.112

[Peer]
PublicKey = ?????????=
PresharedKey = U????????=0=
Endpoint = im.secret.domain:51820
AllowedIPs = 192.144.12.42/32

But only my IP address 192.144.12.42 is available but the other pages not (like google.com). Do you know why?

Summary:

enter image description here

Requirement: Add: The PC is in a different network no 192.144.12, the PC has internet via LTE for example or this is in a hotel network. I want the user of the PC is able to connect to the Wireguard VPN server (Raspberry Pi2), he enter the address 192.144.12.42 into the browser and the Http server from the Raspberry PI 2 response (On the Raspberry Pi2 the VPN Wireguard server and an HTTP server are installed). If the user of PC enters google.com in the browser, then the VPN connection should not be used (i.e. a split connection). If the user enters 192.144.12.23 from the PC in the browser, then nothing should shown (so the Raspberry Pi1 should not response).

What was successfully implemented: The PC user can connect to the Wireguard VPN server. If the user of the PC enters 192.144.12.42 in the browser, then the HTTP server is reachable (on the Raspberry Pi2), if the user of the PC enters 192.144.12.23 in the browser, then nothing will shown (So Raspberry PI1 doesn't response).

Which does not work: If the user of the PC wants to call up google.com in the browser, then nothing appears because the call is made via the VPN connection and he cannot resolve the domain google.com . If I disconnect the VPN connection, the user via PC can open the page google.com

9
  • To clarify, you have the client, you have the wireguard peer it connects to (im.secret.domain) and you have "server with ip address 192.144.12.42" - three different machines? and it's the client that can only connect to 192.144.12.42 once you start wireguard? Jul 5, 2023 at 0:27
  • @JaromandaX Thank you for the response. I add the picture to make the current situation more clearly. The VPN client has the IP address 10.100.170.2 and the VPN server has the internal IP address 192.144.12.42, but the server is available via domain im.secret.domain. The connection to the server works, also the call to the server via address 192.144.12.42, but the client just can call this address nothing more.
    – Qeychon
    Jul 5, 2023 at 6:33
  • so, your wireguard vpn client is also your gateway to the internet? and you're using a fritz just for wireguard? why is the connection from the wg client to fritz labeled as "internet" Jul 5, 2023 at 7:07
  • 1
    I'm sorry but this really isn't clear at all, Qeychon. Please would you edit your post to explain what you want to achieve. Then explain how you're doing it. And finally include this existing description of what's not working. Use specific IP addresses and names (except your public one, if you like). Make sure your description is absolutely clear with regard to what IP address belongs to a client or the server Jul 5, 2023 at 8:06
  • @JaromandaX I change the description and the picture, to make it more clear (I hope), sry for that.
    – Qeychon
    Jul 5, 2023 at 10:19

1 Answer 1

2

Remove this line from the client's WireGuard config:

DNS = 9.9.9.9, 149.112.112.112

Usually you should include DNS settings in a WireGuard config file only when you need to access a DNS server through WireGuard itself.

The hotel network is probably blocking DNS resolvers other than its own, so if you want to use DNS over the hotel network, you probably have to use whatever DNS resolver it provides via DHCP.

1
  • Thank you so much, I will try it if it works.
    – Qeychon
    Jul 9, 2023 at 11:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .