Colleagues, tell me why I can't route another subnet through the wireguard?
I have two computers, one is a router and the other is a client.
The router has an interface with the address 172.16.0.1/24 and a wireguard interface with the address 10.20.0.1/24.
The client has an interface with the address 192.168.1.1/24 and a wireguard interface with the address 10.20.0.2/24.
Here is the router config:
Here is the client config:
Network 10.20.0.0/24 works without problems. Ping and ssh in both directions pass normally. Tcpdumps of both sides shows the passage of the respective packets.
Then I give the command on the client:
After that, as it should be, a route entry appears:
In theory, now if I start pinging the address 172.16.0.1, then ICMP packets will go to the wg0 interface on the client and exit the response interface on the router.
Unfortunately, this only happens halfway. On the client's interface wg0 the packets leave, but on the router's wg0 they do not appear.
Colleagues, tell me please, what is my problem? What am I doing wrong?
Grateful for help,
Ogogon.
I have two computers, one is a router and the other is a client.
The router has an interface with the address 172.16.0.1/24 and a wireguard interface with the address 10.20.0.1/24.
The client has an interface with the address 192.168.1.1/24 and a wireguard interface with the address 10.20.0.2/24.
Here is the router config:
Code:
[Interface]
Address = 10.20.0.1
PrivateKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
ListenPort = 51820
[Peer]
PublicKey = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=
AllowedIPs = 10.20.0.2/32
Code:
[Interface]
Address = 10.20.0.2/32
PrivateKey = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
[Peer]
PublicKey = BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB=
AllowedIPs = 10.20.0.0/24
Endpoint = my.gw.ip.addr:51820
Then I give the command on the client:
route add -network 172.16.0.0/24 -interface wg0
After that, as it should be, a route entry appears:
Code:
Destination Gateway Flags Netif Expire
...
172.16.0.0/24 wg0 US wg0
...
In theory, now if I start pinging the address 172.16.0.1, then ICMP packets will go to the wg0 interface on the client and exit the response interface on the router.
Unfortunately, this only happens halfway. On the client's interface wg0 the packets leave, but on the router's wg0 they do not appear.
Colleagues, tell me please, what is my problem? What am I doing wrong?
Grateful for help,
Ogogon.