I have VPS server run Docker Wireguard ready image. When i connect from client side, its working and traffic its going through there. I need redesign solution, add in between Mikrotik CHR with static IP. And client side should be connect through new Mikrotik CHR though that static IP.
So in the end i would like to connect to Mikrotik CHR static IP from client end Mikrotik and traffic pass through VPS docker Wireguard via Mikrotik CHR. Like in the scheme bellow.
VPS Docker Wireguard <--------> Mirkotik CHR (with static IP) <-------------------> Client Mikrotik.
Configuaration in Docker Wireguard
# Server
[Interface]
PrivateKey = xxxxxxxxxxxxxTwO2VU=
Address = 10.10.10.1/24
ListenPort = 51820
PreUp =
PostUp = iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -o eth0 -j MASQUERADE; iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT; iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j >PreDown =
PostDown =
# Client: gw01 (xxxxx)
[Peer]
PublicKey = xxxxxxxxxxxxxl8OTkI=
PresharedKey = xxxxxxxxxxxxxxFzGs=
AllowedIPs = 10.10.10.2/32
My configuaration on Mikrotik CHR like that
# may/16/2023 11:05:44 by RouterOS 7.9
# software id =
#
/interface ethernet
set [ find default-name=ether1 ] disable-running-check=no
set [ find default-name=ether2 ] disable-running-check=no
/interface wireguard
add listen-port=13231 mtu=1280 name=wireguard1
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/port
set 0 name=serial0
set 1 name=serial1
/interface wireguard peers
add allowed-address=10.2.0.0/24,0.0.0.0/0,::/0 endpoint-address=x.x.x.x \
endpoint-port=51820 interface=wireguard1 persistent-keepalive=10s \
public-key="xxxxxxxuiMKQ4="
add allowed-address=10.10.10.4/32 interface=wireguard1 persistent-keepalive=10s \
public-key="xxxxxxxgr+RwI="
/ip address
add address=51.x.x.x/29 interface=ether1 network=51.x.x.128
add address=10.20.20.63/24 interface=ether2 network=10.20.20.0
add address=10.10.10.2/24 interface=wireguard1 network=10.10.10.0
/ip dhcp-client
add interface=ether1
/ip dns
set servers=1.1.1.1
/ip firewall filter
add action=accept chain=forward in-interface=wireguard1
/ip firewall mangle
add action=change-mss chain=forward new-mss=clamp-to-pmtu out-interface=\
wireguard1 protocol=tcp tcp-flags=syn
/ip firewall nat
add action=masquerade chain=srcnat out-interface=ether1
/ip route
add disabled=no dst-address=0.0.0.0/0 gateway=51.x.x.x routing-table=main \
suppress-hw-offload=no
/routing rule
add action=lookup disabled=no src-address=51.x.x.x/32 table=main
/system note
set show-at-login=no
Configuration in client Wireguard
[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxo0WsrV0=
Address = 10.10.10.4/24
DNS = 10.2.0.100
MTU = 1280
[Peer]
PublicKey = xxxxxxxxxxxxxxxgr+RwI=
AllowedIPs = 10.2.0.0/24, 0.0.0.0/0, ::/0
Endpoint = 51.x.x.x:51820