<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet href="/rss/stylesheet/" type="text/xsl"?>
<rss xmlns:content='http://purl.org/rss/1.0/modules/content/' xmlns:taxo='http://purl.org/rss/1.0/modules/taxonomy/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:itunes='http://www.itunes.com/dtds/podcast-1.0.dtd' xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0" xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:podbridge='http://www.podbridge.com/podbridge-ad.dtd' version='2.0'>
<channel>
  <title>Jaryl Chng&apos;s Knowledge Base</title>
  <language>en-us</language>
  <generator>microfeed.org</generator>
  <itunes:type>episodic</itunes:type>
  <itunes:explicit>false</itunes:explicit>
  <atom:link rel="self" href="https://kb-jarylchng-com.pages.dev/rss/" type="application/rss+xml"/>
  <link>https://kb.jarylchng.com</link>
  <description>
    <![CDATA[<p>Welcome to the index page of my knowledge base, if you haven't done so, do visit my website at <a href="https://jarylchng.com" rel="noopener noreferrer" target="_blank">https://jarylchng.com</a>.</p><p>I will mainly use this site to document stuff, most of which will likely be in the public domain.</p>]]>
  </description>
  <itunes:author>Jaryl Chng</itunes:author>
  <itunes:image href="https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png"/>
  <image>
    <title>Jaryl Chng&apos;s Knowledge Base</title>
    <url>https://kb-static.jarylchng.com/kb-jarylchng-com/production/images/channel-c68f1f55f856ab833b4365991609dbec.png</url>
    <link>https://kb.jarylchng.com</link>
  </image>
  <copyright>©2024</copyright>
  <itunes:category text="Technology"/>
  <item>
    <title>Linux - Port Forwarding Through a VPS With The Help of WireGuard and iptables</title>
    <guid>z4FxEVf3KT_</guid>
    <pubDate>Sat, 06 Apr 2024 16:16:47 GMT</pubDate>
    <itunes:explicit>false</itunes:explicit>
    <description>
      <![CDATA[<p>Recently I wanted to host a Minecraft server on a network that I can not port forward with. Although this can be done with an SSH tunnel too, I believe Wireguard will give a slightly better performance overall.</p><h2>Commands</h2><h3>Add</h3><pre class="ql-syntax" spellcheck="false">iptables -t nat -A PREROUTING -p tcp -d 123.123.123.123 --dport 25565 -j DNAT --to 10.123.123.123:25565
iptables -A FORWARD -p tcp -d 10.123.123.123 --dport 25565 -j ACCEPT
iptables -t nat -o wg0 -A POSTROUTING -j MASQUERADE
</pre><h3>Delete</h3><pre class="ql-syntax" spellcheck="false">iptables -t nat -D PREROUTING -p tcp -d 123.123.123.123 --dport 25565 -j DNAT --to 10.123.123.123:25565
iptables -D FORWARD -p tcp -d 10.123.123.123 --dport 25565 -j ACCEPT
iptables -t nat -o wg0 -D POSTROUTING -j MASQUERADE
</pre><ul><li>Change 123.123.123.123 to your external facing server's public IP address</li><li>Change 10.123.123.123 to the server's Wireguard IP address</li><li>Change all instances of 25565 to a port you wish to forward</li><li>Change wg0 to your Wireguard interface name</li></ul>]]>
    </description>
    <link>https://kb.jarylchng.com/i/linux-port-forwarding-through-a-vps-with-the-hel-z4FxEVf3KT_/</link>
    <itunes:episodeType>full</itunes:episodeType>
  </item>
</channel>
</rss>