Community discussions

MikroTik App
 
mtrakal
just joined
Topic Author
Posts: 2
Joined: Fri Jan 05, 2024 11:56 am

Port forward through P2P wireguard to internet

Fri Jan 05, 2024 12:29 pm

Hello, I need to port forward from my home server through wireguard P2P tunnel to internet.

I have public IP only in my own Office.
I have internet into Home.
Between these two locations is Wireguard P2P tunnel (it's on same ISP provider, so I use internal IP addresses and it not go through internet, only through ISP LAN network in same city).

Server is on 10.0.0.1 port for example 8080.
What I need is to port forward 10.0.0.1:8080 to public ip: 1.2.3.4:8080

Both routers are mikrotik.

I use masqaurade on both sides of P2P tunnel to access internal networks (from office access home server, from home connect to RDP).

But I have no idea how to setup port forward to public IP through wireguard from Home server.
You do not have the required permissions to view the files attached to this post.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 22266
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Port forward through P2P wireguard to internet

Fri Jan 05, 2024 5:19 pm

I am sorry, do not understand the architecture?
I have two connections locally to the same ISP, but each connection gets a different public WANIIP from the provider. Two different accounts.
I connect them via Wireguard as well.
What you describe does not computer for me, so unable to help.
 
mtrakal
just joined
Topic Author
Posts: 2
Joined: Fri Jan 05, 2024 11:56 am

Re: Port forward through P2P wireguard to internet

Fri Jan 05, 2024 6:46 pm

Home Internet connection does not have Public IPv4. Office Internet connection have public IPv4. Office and home are two different locations in same city. It has two different Internet connections.

Both places are connected over public WAN network over wireguard VPN (point to point). So I have access from both places to my own internal network (home and office as well).what I need is provide over office Internet connection (with public IPv4) access specific port on Home server (over wireguard VPN connection).

Is that more clear now?
Last edited by mtrakal on Fri Jan 05, 2024 6:50 pm, edited 2 times in total.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 22266
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Port forward through P2P wireguard to internet

Fri Jan 05, 2024 10:05 pm

Yes, I now can ignore everything in orange becauses its nonsensical.
Between these two locations is Wireguard P2P tunnel it's on same ISP provider, so I use internal IP addresses and it not go through internet, only through ISP LAN network in same city).

Whether or not the two ISP connections are from the same ISP provider has no bearing on the router or wireguard settings.
Whether or not the ISP sends out your trafffic past its servers to the www or not between two of its independent provided IP addresses, has no bearing or router or wireguard settings......... It may mean slightly higher throughput. Also if I use 1.1.1.1 as a DNS Server, for sure at least some traffic to resolve the public IP would exit the ISP system..........

Hence, the useless information clouded the post.

Finally your request makes no sense to me.............
What I need is to port forward 10.0.0.1:8080 to public ip: 1.2.3.4:8080

Port forwarding for SERVERS is the opposite. Incoming users coming into a public IP, get port forwarded to private LANIP.
In your case, it may be that you want to use the public IP of the office router as the DYNDNS domain name public IP that people use to connect to your server.
Assuming the server is actually on the home router,.
What you want to do is port forward at the office router INTO the wireguard tunnel and then point to the server on the home router.

Easily done, but you need to provide both configs to help make sense of what you have right and wrong.
/export file=anynameyouwish (minus router serial number, public WANIP information, keys etc.)
 
mtrakal
just joined
Topic Author
Posts: 2
Joined: Fri Jan 05, 2024 11:56 am

Re: Port forward through P2P wireguard to internet

Sat Jan 06, 2024 1:30 am

Hello again, I'm just stupid... because I have two domains (one for intranet IPs) and second one for public (A names redirect to Public IP) and whole time I used wrong domain name...

example:
office.my-domain.com > A name: 10.0.0.254 (Intranet IP)
office.my-domain.net > A name: 1.2.3.4 (Public IP).

The whole time I used the wrong domain name, so I tried to access from internet to intranet IPs+port 🤦‍♂️.

Port forward is working properly as I configured :D.
And yes, I needed it as you wrote... Thanks for explanation how it's properly named and way of port forward (from public IP to private server, not opposite way).
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 22266
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Port forward through P2P wireguard to internet

Sat Jan 06, 2024 2:47 pm

Awesome, glad its worked out for you........ Ive done many dumb things when it comes to MT, and most due to my lack of understanding of basic networking.