I'm new in the Linux world so I don't know how to do the IPtable configs. my scenario is like this: I have a MikroTik and an UBUNTU Linux server. I created a GRE Tunnel between them and it works well. I also created a Wireguard on my Linux server and I can connect to it from my windows PC. all I want now is to send all incoming traffic to my Linux server from Wireguard connection to the GRE Tunnel. i already enabled port forwarding on my Linux by setting it to 1. here is my wireguard config :
[Interface]
PrivateKey = ***************
address = 10.0.0.1/8
SaveConfig=true
PostUp=iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o gre1 -j MASQUERADE;
PostDown=iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o gre1 -j MASQUERADE;
ListenPort=51820
gre1 is my GRE tunnel interface. but my IP is the same as my Linux server's public IP
GRE LINUX IP : 11.11.11.1/24
GRE MIKROTIK IP : 11.11.11.2/24
LINUX WIREGUARD IP : 10.0.0.1/8
WINDOWS WIREGUARD IP : 10.0.0.2/8
MIKROTIK PUBLIC IP : 171.51.174.240
LINUX PUBIC IP : 71.141.34.80
thanks for your reply, but unfortunately my scenario is like this one :
pc/phone -- vpn(PPTP/WireGuard/l2tp) ---> Linux server --> GRE Tunnel --> Mikrotik Server ---> INTERNET
I can connect to the Linux server via VPN without any issues and my Linux is also connected to MikroTik via GRE Tunnel. the only problem is in the Linux server where I don't know how to route the incoming traffic from the VPNs to GRE Tunnel.