Wireguard a IP forwarding

noob

Wireguard a IP forwarding
« kdy: 05. 04. 2020, 16:53:40 »
Dobrý den vespolek.

Nemáte někdo představu, co si myslet o této chybě v debug logu wireguardu?

Kód: [Vybrat]
wireguard: wg0: Failed to give packet to userspace from peer 24 (82.113.xxx.xxx:63783)
Wireguard mám rozchozený na Debianu 10 a mezi peery funguje dobře. Ovšem nefunguje IP forwarding od klientů do internetu.

Konfigurační soubor WG vypadá takto:

Kód: [Vybrat]
[Interface]
Address = 10.0.99.1
PrivateKey = 4HJnsdXXXXXXPsd3BnwVs=
ListenPort = 51820

[Peer]
PublicKey = WjcVA/jDpfbhJyXXXXXXuhHW8rJivQtnk=
AllowedIPs = 10.0.99.2/24

Konfigurace iptables je IMHO správná - rozsah 10.0.88.0/24 používá strongswan a tam přístup internetu funguje bez chyb:

Kód: [Vybrat]
#iptables -L

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     udp  --  anywhere             anywhere             udp dpt:isakmp
ACCEPT     udp  --  anywhere             anywhere             udp dpt:ipsec-nat-t
ACCEPT     udp  --  anywhere             anywhere             udp dpt:51820
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

#iptables -L -t nat

Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  10.0.0.0/16          anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Nějaký nápad?


Michal Stulík

  • *
  • 10
  • Mezi klávesnicí a židlí.
    • Zobrazit profil
    • Meziblog
Re:Wireguard a IP forwarding
« Odpověď #1 kdy: 05. 04. 2020, 18:48:56 »
Myslím že chybí FORWARD pravidlo, které povolí nová spojení z wireguardu do wan rozhraní.
Něco jako tohle:
Kód: [Vybrat]
iptables -A FORWARD -i wg0 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o wg0 -m state --state RELATED,ESTABLISHED -j ACCEPT

noob

Re:Wireguard a IP forwarding
« Odpověď #2 kdy: 05. 04. 2020, 19:11:02 »
Díky! To bylo přesně ono :)