WireGuard Archive on lore.kernel.org
 help / color / Atom feed
From: "Adrián Mihálko" <adriankoooo@gmail.com>
To: wireguard@lists.zx2c4.com
Subject: Routing between multiple wg interfaces
Date: Thu, 12 Sep 2019 21:27:35 +0200
Message-ID: <CA+Hw3ebSHKAa_WaOsXYezP_n3o2rQfbLvaRoGYH8SpF92=7fBg@mail.gmail.com> (raw)

[-- Attachment #1.1: Type: text/plain, Size: 1562 bytes --]

I am trying to route between multiple WG interfaces.

On my primary server:

wg0.conf:

[Interface]
Address = 192.168.6.4/24
ListenPort = 51820
PrivateKey =
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j
ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i
-j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
PublicKey =
AllowedIPs = 192.168.6.1/32, 192.168.1.0/24
Endpoint = xy.com:51820

wg1.conf:

[Interface]
Address = 192.168.9.1/24
ListenPort = 51821
PrivateKey =

PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j
ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i
-j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
PublicKey =
AllowedIPs = 192.168.9.3/32

---

With wg0 I am connecting to an other server (xy.com:51820). On wg1 I am
accepting client connections.

On this server I can ping everything, so connection is working well.

ping 192.168.6.1 - works
ping 192.168.1.xxx - works

ping 192.168.9.3 - works

---

Now I am connecting my client to this server (client 192.168.9.3):

[Interface]
PrivateKey =
Address = 192.168.9.3/24
DNS = 192.168.9.1

[Peer]
PublicKey =
AllowedIPs = 192.168.9.1/32, 192.168.1.0/24
Endpoint = primaryserver:51821


I can ping server 192.168.9.1 as expected, but I am unable to ping any of
my devices in 192.168.1.0/24.

Anyone knows what's the problem here?

[-- Attachment #1.2: Type: text/html, Size: 2714 bytes --]

<div dir="ltr"><div dir="ltr"><div>I am trying to route between multiple WG interfaces. <br></div><div><br></div><div>On my primary server:</div><div><br></div><div>wg0.conf:</div><div><br></div><div>[Interface]</div><div>Address = <a href="http://192.168.6.4/24">192.168.6.4/24</a></div><div>ListenPort = 51820</div><div>PrivateKey = </div><div>PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE</div><div>PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE</div><div><br></div><div>[Peer]</div><div>PublicKey = </div><div>AllowedIPs = <a href="http://192.168.6.1/32">192.168.6.1/32</a>, <a href="http://192.168.1.0/24">192.168.1.0/24</a></div><div>Endpoint = <a href="http://xy.com:51820">xy.com:51820</a></div><div><br></div><div>wg1.conf:</div><div><br></div><div>[Interface]</div><div>Address = <a href="http://192.168.9.1/24">192.168.9.1/24</a></div><div>ListenPort = 51821</div><div>PrivateKey = </div><div><br></div><div>PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE</div><div>PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE</div><div><br></div><div>[Peer]</div><div>PublicKey = </div><div>AllowedIPs = <a href="http://192.168.9.3/32">192.168.9.3/32</a></div><div><br></div><div>---</div><div><br></div><div>With wg0 I am connecting to an other server (<a href="http://xy.com:51820">xy.com:51820</a>). On wg1 I am accepting client connections.</div><div><br></div><div>On this server I can ping everything, so connection is working well. </div><div><br></div><div>ping 192.168.6.1 - works</div><div>ping 192.168.1.xxx - works</div><div><br></div><div>ping 192.168.9.3 - works</div><div><br></div><div>---</div><div><br></div><div>Now I am connecting my client to this server (client 192.168.9.3):</div><div><br></div><div>[Interface]</div><div>PrivateKey = </div><div>Address = <a href="http://192.168.9.3/24">192.168.9.3/24</a></div><div>DNS = 192.168.9.1</div><div><br></div><div>[Peer]</div><div>PublicKey = </div><div>AllowedIPs = <a href="http://192.168.9.1/32">192.168.9.1/32</a>, <a href="http://192.168.1.0/24">192.168.1.0/24</a></div><div>Endpoint = primaryserver:51821</div><div><br></div><div><br></div><div>I can ping server 192.168.9.1 as expected, but I am unable to ping any of my devices in <a href="http://192.168.1.0/24">192.168.1.0/24</a>. </div><div><br></div><div>Anyone knows what&#39;s the problem here?</div></div></div>

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

             reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 19:27 Adrián Mihálko [this message]
2019-09-12 20:35 ` Michael B. Williams

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+Hw3ebSHKAa_WaOsXYezP_n3o2rQfbLvaRoGYH8SpF92=7fBg@mail.gmail.com' \
    --to=adriankoooo@gmail.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

WireGuard Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ https://lore.kernel.org/wireguard \
		wireguard@lists.zx2c4.com zx2c4-wireguard@archiver.kernel.org
	public-inbox-index wireguard


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.zx2c4.lists.wireguard


AGPL code for this site: git clone https://public-inbox.org/ public-inbox