Not really a switch, but similar. If you want to exchange data from two network using a host on Internet, this post helps.

In this case, Router 1 want to use Router 2 as gateway for some destinations. All 3 Nodes here have Internet public IP address.
I set-up a network, 192.168.20.0/24, using WireGuard. Our work are all on the Server in the middle.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[Interface] Address = 192.168.20.100/24 PrivateKey = KEY ListenPort = 51820 [Peer] PublicKey = RT1PUBKEY AllowedIPs = 192.168.20.200/32,192.168.10.0/24 Endpoint = RT1:51820 [Peer] PublicKey = RT2PUBKEY AllowedIPs = 0.0.0.0/0 Endpoint = RT2:51820 |
If I put such config to /etc/wireguard/wg0.conf and run wg-quick up wg0, then I may lost connection to the server, because of the default route.
Now, add a route table to your system and change wg0.conf, let’s name it wgswitch and table id 201.
1 2 |
# if you're not on Ubuntu, echo "201 wgswitch" >> /etc/iproute2/rt_tables echo "201 wgswitch" >> /etc/iproute2/rt_tables.d/wg_switch.conf |
Then modify wg0.conf.
1 2 3 4 5 |
[Interface] Address = 192.168.20.100/24 PrivateKey = KEY ListenPort = 51820 Table = 201 |
Now when you establish connections, you’ll be able to ping from router1 to router2 using 192.168.20.0/24 network.
But if you want to try a custom network, that’s not enough, you need extra route and ip rule for your network
1 2 3 4 5 6 7 8 9 10 11 12 |
# PostUp /sbin/ip route add ROUTE_TO_ROUTER1/16 via LOCAL_GW dev eth0 table 201 /sbin/ip route add ROUTE_TO_ROUTER2/16 via LOCAL_GW dev eth0 table 201 /sbin/ip route add LOCAL_INTERFACE_IP/24 dev eth0 table 201 /sbin/ip route add 192.168.10.0/24 dev wg0 /sbin/ip rule add iif wg0 lookup 201 /bin/ping -c 1 192.168.201.1 /bin/ping -c 1 192.168.201.20 |
Incoming search terms:
- unable to create wintun
- unable to create wintun interface 下载
- 面具 vpn
- practicalosx
- watchypg
- unable to create wintun interface wireguard
- stationo3r
- slopekya
- scaredc2g
- ridingns1
- researchgw6
- agev7y
- opencju
- nora65
- leadernsv
- knew4eo
- flowerjxh
- darkcy7
- climatef8z
- baseballyfu