http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&limit=50&action=history&feed=atom One-to-one NAT - Revision history 2024-03-28T11:07:06Z Revision history for this page on the wiki MediaWiki 1.10.1 http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=43309&oldid=prev Glenn: /* Introduction */ chg 2012-06-28T20:54:42Z <p><span class="autocomment">Introduction -</span> chg</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 20:54, 28 June 2012</td> </tr> <tr><td colspan="2" align="left"><strong>Line 1:</strong></td> <td colspan="2" align="left"><strong>Line 1:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">==Introduction==</td><td> </td><td style="background: #eee; font-size: smaller;">==Introduction==</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">One-to-one NAT (aka Static NAT) is a way to make systems behind a firewall and configured with private IP addresses <del style="color: red; font-weight: bold; text-decoration: none;">(those addresses reserved for private use in RFC 1918) </del>appear to have public IP addresses.</td><td>+</td><td style="background: #cfc; font-size: smaller;">One-to-one NAT (aka Static NAT) is a way to make systems behind a firewall and configured with <ins style="color: red; font-weight: bold; text-decoration: none;">[[</ins>private IP addresses<ins style="color: red; font-weight: bold; text-decoration: none;">]] </ins>appear to have public IP addresses.</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">&#160;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">==Setup==</td><td> </td><td style="background: #eee; font-size: smaller;">==Setup==</td></tr> </table> Glenn http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=43304&oldid=prev Glenn: /* Resources */ wiki 2012-06-28T20:03:09Z <p><span class="autocomment">Resources -</span> wiki</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 20:03, 28 June 2012</td> </tr> <tr><td colspan="2" align="left"><strong>Line 71:</strong></td> <td colspan="2" align="left"><strong>Line 71:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">==Resources==</td><td> </td><td style="background: #eee; font-size: smaller;">==Resources==</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">http://www.shorewall.net/NAT.htm&lt;br&gt;</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">* </ins>http://www.shorewall.net/NAT.htm&lt;br&gt;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">http://www.dd-wrt.com/phpBB2/viewtopic.php?t=24555&lt;br&gt;</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">* </ins>http://www.dd-wrt.com/phpBB2/viewtopic.php?t=24555&lt;br&gt;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">http://www.dd-wrt.com/phpBB2/viewtopic.php?p=400472#400472</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">* </ins>http://www.dd-wrt.com/phpBB2/viewtopic.php?p=400472#400472</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">&#160;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category:NAT]]</td><td> </td><td style="background: #eee; font-size: smaller;">[[Category:NAT]]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">[[Category: Basic tutorials]]</td><td> </td><td style="background: #eee; font-size: smaller;">[[Category: Basic tutorials]]</td></tr> </table> Glenn http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=39794&oldid=prev Phuzi0n: /* Setup */ 2011-02-28T06:08:29Z <p><span class="autocomment">Setup</span></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 06:08, 28 February 2011</td> </tr> <tr><td colspan="2" align="left"><strong>Line 4:</strong></td> <td colspan="2" align="left"><strong>Line 4:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">==Setup==</td><td> </td><td style="background: #eee; font-size: smaller;">==Setup==</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Begin by <del style="color: red; font-weight: bold; text-decoration: none;">setting your WAN to use </del>one of the static addresses using the <del style="color: red; font-weight: bold; text-decoration: none;">web ui </del>and then use these scripts to add the rest. Everything in square brackets needs to be replaced by your values. Examples are at the bottom.</td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">'''</ins>Begin by <ins style="color: red; font-weight: bold; text-decoration: none;">assigning </ins>one of the static addresses <ins style="color: red; font-weight: bold; text-decoration: none;">to the WAN port </ins>using the <ins style="color: red; font-weight: bold; text-decoration: none;">[[Web interface]] </ins>and then use these scripts to add the rest.<ins style="color: red; font-weight: bold; text-decoration: none;">'''</ins></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">&#160;</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Everything in square brackets needs to be replaced by your values. Examples are at the bottom.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> </table> Phuzi0n http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=38154&oldid=prev Phuzi0n at 02:35, 24 January 2011 2011-01-24T02:35:48Z <p></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 02:35, 24 January 2011</td> </tr> <tr><td colspan="2" align="left"><strong>Line 1:</strong></td> <td colspan="2" align="left"><strong>Line 1:</strong></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">One-to-one NAT (aka Static NAT) is a way to make systems behind a firewall and configured with private IP addresses (those addresses reserved for private use in RFC 1918) appear to have public IP addresses.<del style="color: red; font-weight: bold; text-decoration: none;">¹</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">==Introduction==</ins></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">One-to-one NAT (aka Static NAT) is a way to make systems behind a firewall and configured with private IP addresses (those addresses reserved for private use in RFC 1918) appear to have public IP addresses.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">These examples have been tested and work with multiple public static IPs.</td><td colspan="2">&nbsp;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Tested with:</td><td colspan="2">&nbsp;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">* WRT54GL v.1.1 with DD-WRT RC6 and it works just fine.²</td><td colspan="2">&nbsp;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">* DD-WRT v24-sp2 (01/01/09) mega on Linksys WRT 600N V1</td><td colspan="2">&nbsp;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">__TOC__</td><td colspan="2">&nbsp;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">==Setup==</td><td> </td><td style="background: #eee; font-size: smaller;">==Setup==</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"></td><td colspan="2">&nbsp;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Begin by setting your WAN to use one of the static addresses using the web ui and then use these scripts to add the rest. Everything in square brackets needs to be replaced by your values. Examples are at the bottom.</td><td> </td><td style="background: #eee; font-size: smaller;">Begin by setting your WAN to use one of the static addresses using the web ui and then use these scripts to add the rest. Everything in square brackets needs to be replaced by your values. Examples are at the bottom.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">====Startup====</td><td colspan="2">&nbsp;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Set up new public static IP on dd-wrt WAN interface. This must be done for each public static IP and should be saved to the Startup script using the Save Startup button on the Administration -&gt; Commands page. If you do not know how to calculate your broadcast address, then enter your WAN IP and subnet mask into this [[http://www.subnet-calculator.com/ calculator]].</td><td colspan="2">&nbsp;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">If <del style="color: red; font-weight: bold; text-decoration: none;">wan_iface causes trouble </del>then <del style="color: red; font-weight: bold; text-decoration: none;">try wan_ifname instead </del>and <del style="color: red; font-weight: bold; text-decoration: none;">notify phuzi0n</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">===Startup===</ins></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> WANIF=`<del style="color: red; font-weight: bold; text-decoration: none;">nvram get wan_iface`</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"><ins style="color: red; font-weight: bold; text-decoration: none;">Set up new public static IP on dd-wrt WAN interface. This must be done for each public static IP and should be saved to the Startup script using the Save Startup button on the Administration -&gt; Commands page. </ins>If <ins style="color: red; font-weight: bold; text-decoration: none;">you do not know how to calculate your broadcast address, </ins>then <ins style="color: red; font-weight: bold; text-decoration: none;">enter your IP </ins>and <ins style="color: red; font-weight: bold; text-decoration: none;">subnet mask into this [[http://www.subnet-calculator.com/ calculator]].</ins></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;"> WANMASK=`nvram get wan_netmask</del>`</td><td>+</td><td style="background: #cfc; font-size: smaller;">&#160;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:1 [PUBLIC_IP1] netmask <del style="color: red; font-weight: bold; text-decoration: none;">$WANMASK </del>broadcast [BROADCAST]</td><td>+</td><td style="background: #cfc; font-size: smaller;"> WANIF=`<ins style="color: red; font-weight: bold; text-decoration: none;">get_wanface</ins>`</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:2 [PUBLIC_IP2] netmask <del style="color: red; font-weight: bold; text-decoration: none;">$WANMASK </del>broadcast [BROADCAST]</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:1 [PUBLIC_IP1] netmask <ins style="color: red; font-weight: bold; text-decoration: none;">[NETMASK] </ins>broadcast [BROADCAST]</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:3 [PUBLIC_IP3] netmask <del style="color: red; font-weight: bold; text-decoration: none;">$WANMASK </del>broadcast [BROADCAST]</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:2 [PUBLIC_IP2] netmask <ins style="color: red; font-weight: bold; text-decoration: none;">[NETMASK] </ins>broadcast [BROADCAST]</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:3 [PUBLIC_IP3] netmask <ins style="color: red; font-weight: bold; text-decoration: none;">[NETMASK] </ins>broadcast [BROADCAST]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">=</del>===Firewall<del style="color: red; font-weight: bold; text-decoration: none;">=</del>===</td><td>+</td><td style="background: #cfc; font-size: smaller;">===Firewall===</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Here are some examples of firewall rules to NAT the external IP's to your internal IP's. Put them in the command box and use the Save Firewall button on the Administration -&gt; Commands page to save them to your firewall script.</td><td> </td><td style="background: #eee; font-size: smaller;">Here are some examples of firewall rules to NAT the external IP's to your internal IP's. Put them in the command box and use the Save Firewall button on the Administration -&gt; Commands page to save them to your firewall script.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">==</del>====SNAT/DNAT<del style="color: red; font-weight: bold; text-decoration: none;">==</del>====</td><td>+</td><td style="background: #cfc; font-size: smaller;">====SNAT/DNAT====</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Route all packets for the new public IP, to a certain local IP.</td><td> </td><td style="background: #eee; font-size: smaller;">Route all packets for the new public IP, to a certain local IP.</td></tr> <tr><td colspan="2" align="left"><strong>Line 36:</strong></td> <td colspan="2" align="left"><strong>Line 30:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"> iptables -t nat -I POSTROUTING -s [LAN_IP] -j SNAT --to-source [PUBLIC_IP]</td><td> </td><td style="background: #eee; font-size: smaller;"> iptables -t nat -I POSTROUTING -s [LAN_IP] -j SNAT --to-source [PUBLIC_IP]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">==</del>====PORT FORWARD<del style="color: red; font-weight: bold; text-decoration: none;">==</del>====</td><td>+</td><td style="background: #cfc; font-size: smaller;">====PORT FORWARD====</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Forward port X to above local IP</td><td> </td><td style="background: #eee; font-size: smaller;">Forward port X to above local IP</td></tr> <tr><td colspan="2" align="left"><strong>Line 52:</strong></td> <td colspan="2" align="left"><strong>Line 46:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">===Startup Script===</td><td> </td><td style="background: #eee; font-size: smaller;">===Startup Script===</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"> # Save Startup</td><td> </td><td style="background: #eee; font-size: smaller;"> # Save Startup</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> WANIF=`<del style="color: red; font-weight: bold; text-decoration: none;">nvram get wan_iface`</del></td><td>+</td><td style="background: #cfc; font-size: smaller;"> WANIF=`<ins style="color: red; font-weight: bold; text-decoration: none;">get_wanface</ins>`</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;"> WANMASK=`nvram get wan_netmask</del>`</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:1 173.X.X.250 netmask <ins style="color: red; font-weight: bold; text-decoration: none;">[NETMASK] </ins>broadcast [BROADCAST]</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:1 173.X.X.250 netmask <del style="color: red; font-weight: bold; text-decoration: none;">$WANMASK </del>broadcast [BROADCAST]</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:2 173.X.X.251 netmask <ins style="color: red; font-weight: bold; text-decoration: none;">[NETMASK] </ins>broadcast [BROADCAST]</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:2 173.X.X.251 netmask <del style="color: red; font-weight: bold; text-decoration: none;">$WANMASK </del>broadcast [BROADCAST]</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:3 173.X.X.252 netmask <ins style="color: red; font-weight: bold; text-decoration: none;">[NETMASK] </ins>broadcast [BROADCAST]</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:3 173.X.X.252 netmask <del style="color: red; font-weight: bold; text-decoration: none;">$WANMASK </del>broadcast [BROADCAST]</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">===Firewall Script===</td><td> </td><td style="background: #eee; font-size: smaller;">===Firewall Script===</td></tr> <tr><td colspan="2" align="left"><strong>Line 76:</strong></td> <td colspan="2" align="left"><strong>Line 69:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">==Resources==</td><td> </td><td style="background: #eee; font-size: smaller;">==Resources==</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">¹ </del>http://www.shorewall.net/NAT.htm&lt;br&gt;</td><td>+</td><td style="background: #cfc; font-size: smaller;">http://www.shorewall.net/NAT.htm&lt;br&gt;</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"><del style="color: red; font-weight: bold; text-decoration: none;">² </del>http://www.dd-wrt.com/phpBB2/viewtopic.php?t=24555&lt;br&gt;</td><td>+</td><td style="background: #cfc; font-size: smaller;">http://www.dd-wrt.com/phpBB2/viewtopic.php?t=24555&lt;br&gt;</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">http://www.dd-wrt.com/phpBB2/viewtopic.php?p=400472#400472</td><td> </td><td style="background: #eee; font-size: smaller;">http://www.dd-wrt.com/phpBB2/viewtopic.php?p=400472#400472</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> </table> Phuzi0n http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=34591&oldid=prev Phuzi0n: /* Firewall */ 2010-07-17T22:22:02Z <p><span class="autocomment">Firewall</span></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 22:22, 17 July 2010</td> </tr> <tr><td colspan="2" align="left"><strong>Line 22:</strong></td> <td colspan="2" align="left"><strong>Line 22:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">====Firewall====</td><td> </td><td style="background: #eee; font-size: smaller;">====Firewall====</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;"></td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">Here are some examples of firewall rules to NAT the external IP's to your internal IP's. Put them in the command box and use the Save Firewall button on the Administration -&gt; Commands page to save them to your firewall script.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">======SNAT/DNAT======</td><td> </td><td style="background: #eee; font-size: smaller;">======SNAT/DNAT======</td></tr> </table> Phuzi0n http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=31657&oldid=prev Glenn: catchg 2010-04-30T13:36:09Z <p>catchg</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 13:36, 30 April 2010</td> </tr> <tr><td colspan="2" align="left"><strong>Line 79:</strong></td> <td colspan="2" align="left"><strong>Line 79:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">[[Category: <del style="color: red; font-weight: bold; text-decoration: none;">English documentation</del>]][[Category: Basic tutorials]]</td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Category:<ins style="color: red; font-weight: bold; text-decoration: none;">NAT</ins>]]</td></tr> <tr><td colspan="2">&nbsp;</td><td>+</td><td style="background: #cfc; font-size: smaller;">[[Category: Basic tutorials]]</td></tr> </table> Glenn http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=31015&oldid=prev Phuzi0n: /* Startup */ - link to subnet calculator for broadcast address 2010-04-12T01:34:50Z <p><span class="autocomment">Startup -</span> - link to subnet calculator for broadcast address</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 01:34, 12 April 2010</td> </tr> <tr><td colspan="2" align="left"><strong>Line 12:</strong></td> <td colspan="2" align="left"><strong>Line 12:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">====Startup====</td><td> </td><td style="background: #eee; font-size: smaller;">====Startup====</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;">Set up new public static IP on dd-wrt WAN interface. This must be done for each public static IP and should be saved to the Startup script using the Save Startup button on the Administration -&gt; Commands page.</td><td>+</td><td style="background: #cfc; font-size: smaller;">Set up new public static IP on dd-wrt WAN interface. This must be done for each public static IP and should be saved to the Startup script using the Save Startup button on the Administration -&gt; Commands page<ins style="color: red; font-weight: bold; text-decoration: none;">. If you do not know how to calculate your broadcast address, then enter your WAN IP and subnet mask into this [[http://www.subnet-calculator.com/ calculator]]</ins>.</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">If wan_iface causes trouble then try wan_ifname instead and notify phuzi0n</td><td> </td><td style="background: #eee; font-size: smaller;">If wan_iface causes trouble then try wan_ifname instead and notify phuzi0n</td></tr> </table> Phuzi0n http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=30388&oldid=prev Phuzi0n: /* PORT FORWARD */ 2010-02-25T03:49:32Z <p><span class="autocomment">PORT FORWARD</span></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 03:49, 25 February 2010</td> </tr> <tr><td colspan="2" align="left"><strong>Line 37:</strong></td> <td colspan="2" align="left"><strong>Line 37:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Forward port X to above local IP</td><td> </td><td style="background: #eee; font-size: smaller;">Forward port X to above local IP</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> iptables -I FORWARD <del style="color: red; font-weight: bold; text-decoration: none;">-i [WAN_Interface] </del>-d [LAN_IP] -p tcp --dport [Destination_Port] -j ACCEPT</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -I FORWARD -d [LAN_IP] -p tcp --dport [Destination_Port] -j ACCEPT</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">You could also replace above rule(s) with the following:</td><td> </td><td style="background: #eee; font-size: smaller;">You could also replace above rule(s) with the following:</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> iptables -I FORWARD <del style="color: red; font-weight: bold; text-decoration: none;">-i [WAN_Interface] </del>-d [LAN_IP] -j ACCEPT </td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -I FORWARD -d [LAN_IP] -j ACCEPT </td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Which instead of forwarding just a single port, will let through all tcp/udp connections on all ports to this public ip--&gt;lan ip. </td><td> </td><td style="background: #eee; font-size: smaller;">Which instead of forwarding just a single port, will let through all tcp/udp connections on all ports to this public ip--&gt;lan ip. </td></tr> </table> Phuzi0n http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=30387&oldid=prev Phuzi0n: /* SNAT/DNAT */ 2010-02-25T03:48:28Z <p><span class="autocomment">SNAT/DNAT</span></p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 03:48, 25 February 2010</td> </tr> <tr><td colspan="2" align="left"><strong>Line 26:</strong></td> <td colspan="2" align="left"><strong>Line 26:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Route all packets for the new public IP, to a certain local IP.</td><td> </td><td style="background: #eee; font-size: smaller;">Route all packets for the new public IP, to a certain local IP.</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> iptables -t nat -I <del style="color: red; font-weight: bold; text-decoration: none;">[</del>PREROUTING<del style="color: red; font-weight: bold; text-decoration: none;">] </del>-d [PUBLIC_IP] -j DNAT --to-destination [LAN_IP]</td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -t nat -I PREROUTING -d [PUBLIC_IP] -j DNAT --to-destination [LAN_IP]</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Route packets on a port on the new public IP, to a different port of a local IP. Note that you can skip [LAN_Port] if it matches [Destination_Port].</td><td> </td><td style="background: #eee; font-size: smaller;">Route packets on a port on the new public IP, to a different port of a local IP. Note that you can skip [LAN_Port] if it matches [Destination_Port].</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> iptables -t nat -I PREROUTING <del style="color: red; font-weight: bold; text-decoration: none;">-i [WAN_Interface] </del>-d [PUBLIC_IP] -p tcp --dport [Destination_Port] -j DNAT --to-destination [LAN_IP]:[LAN_Port] </td><td>+</td><td style="background: #cfc; font-size: smaller;"> iptables -t nat -I PREROUTING -d [PUBLIC_IP] -p tcp --dport [Destination_Port] -j DNAT --to-destination [LAN_IP]:[LAN_Port] </td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">Masquerade returned packets from the local ip to the public IP</td><td> </td><td style="background: #eee; font-size: smaller;">Masquerade returned packets from the local ip to the public IP</td></tr> </table> Phuzi0n http://wiki.dd-wrt.com/wiki/index.php?title=One-to-one_NAT&diff=30365&oldid=prev Phuzi0n: broadcom k2.4 builds have a bug with calculating the broadcast address 2010-02-23T22:35:32Z <p>broadcom k2.4 builds have a bug with calculating the broadcast address</p> <table border='0' width='98%' cellpadding='0' cellspacing='4' style="background-color: white;"> <tr> <td colspan='2' width='50%' align='center' style="background-color: white;">←Older revision</td> <td colspan='2' width='50%' align='center' style="background-color: white;">Revision as of 22:35, 23 February 2010</td> </tr> <tr><td colspan="2" align="left"><strong>Line 52:</strong></td> <td colspan="2" align="left"><strong>Line 52:</strong></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"> WANIF=`nvram get wan_iface`</td><td> </td><td style="background: #eee; font-size: smaller;"> WANIF=`nvram get wan_iface`</td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"> WANMASK=`nvram get wan_netmask`</td><td> </td><td style="background: #eee; font-size: smaller;"> WANMASK=`nvram get wan_netmask`</td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:1 173.X.X.250 netmask $WANMASK</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:1 173.X.X.250 netmask $WANMASK <ins style="color: red; font-weight: bold; text-decoration: none;">broadcast [BROADCAST]</ins></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:2 173.X.X.251 netmask $WANMASK</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:2 173.X.X.251 netmask $WANMASK <ins style="color: red; font-weight: bold; text-decoration: none;">broadcast [BROADCAST]</ins></td></tr> <tr><td>-</td><td style="background: #ffa; font-size: smaller;"> ifconfig $WANIF:3 173.X.X.252 netmask $WANMASK</td><td>+</td><td style="background: #cfc; font-size: smaller;"> ifconfig $WANIF:3 173.X.X.252 netmask $WANMASK <ins style="color: red; font-weight: bold; text-decoration: none;">broadcast [BROADCAST]</ins></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;"></td><td> </td><td style="background: #eee; font-size: smaller;"></td></tr> <tr><td> </td><td style="background: #eee; font-size: smaller;">===Firewall Script===</td><td> </td><td style="background: #eee; font-size: smaller;">===Firewall Script===</td></tr> </table> Phuzi0n