diff options
-rw-r--r-- | etc/inc/filter.inc | 22 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat.php | 5 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_1to1.php | 1 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_out.php | 6 | ||||
-rwxr-xr-x | usr/local/www/firewall_nat_server.php | 1 |
5 files changed, 24 insertions, 11 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index fe1d88e..1795417 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -262,18 +262,10 @@ function filter_nat_rules_generate_if($if, $src, $dst, $target) { else $tgt = "0/32"; - if(isset($config['nat']['enableoutboundloadbalancing'])) { - $natrule = <<<EOD -nat on $if from $src to any -> ($if) - -EOD; - } else { $natrule = <<<EOD nat on $if from $src to any -> $if EOD; - } - return $natrule; } @@ -286,6 +278,8 @@ function filter_nat_rules_generate() { $pptpdcfg = $config['pptpd']; $wanif = get_real_wan_interface(); + $lanif = $config['interfaces']['lan']['if']; + $lansa = gen_subnet($lancfg['ipaddr'], $lancfg['subnet']); $natrules = ""; @@ -307,6 +301,18 @@ function filter_nat_rules_generate() { } } + /* Setup outgoing NAT load balancing */ + if (isset($config['nat']['outgoingloadbalancing']['rule'])) { + $natrules .= "pass in on " . $lanif . " route-to { "; + $isfirst = 0; + foreach ($config['nat']['outgoingloadbalancing']['rule'] as $rule) { + if(isfirst == 1) $natrules .= ", "; + $natrules .= " (" . $wanif . " " . $rule['gatewayip'] . ") "; + $isfirst = 1; + } + $natrules .= "} round-robin proto tcp from {$lansa} to any flags S/SA modulate state\n"; + } + /* outbound rules - advanced or standard */ if (isset($config['nat']['advancedoutbound']['enable'])) { /* advanced outbound rules */ diff --git a/usr/local/www/firewall_nat.php b/usr/local/www/firewall_nat.php index 806327f..386f3b8 100755 --- a/usr/local/www/firewall_nat.php +++ b/usr/local/www/firewall_nat.php @@ -2,8 +2,10 @@ <?php /* firewall_nat.php - part of m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2004 Scott Ullrich + All rights reserved. + originally part of m0n0wall (http://m0n0.ch/wall) Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. All rights reserved. @@ -96,6 +98,7 @@ if ($_GET['act'] == "del") { <li class="tabinact"><a href="firewall_nat_server.php">Server NAT</a></li> <li class="tabinact"><a href="firewall_nat_1to1.php">1:1</a></li> <li class="tabinact"><a href="firewall_nat_out.php">Outbound</a></li> + <li class="tabinact"><a href="firewall_nat_out_load_balancing.php">Outbound Load Balancing</a></li> </ul> </td></tr> <tr> diff --git a/usr/local/www/firewall_nat_1to1.php b/usr/local/www/firewall_nat_1to1.php index c303734..b12ae65 100755 --- a/usr/local/www/firewall_nat_1to1.php +++ b/usr/local/www/firewall_nat_1to1.php @@ -92,6 +92,7 @@ if ($_GET['act'] == "del") { <li class="tabinact"><a href="firewall_nat_server.php">Server NAT</a></li> <li class="tabact">1:1</li> <li class="tabinact"><a href="firewall_nat_out.php">Outbound</a></li> + <li class="tabinact"><a href="firewall_nat_out_load_balancing.php">Outbound Load Balancing</a></li> </ul> </td></tr> <tr> diff --git a/usr/local/www/firewall_nat_out.php b/usr/local/www/firewall_nat_out.php index 1f43278..a24caa8 100755 --- a/usr/local/www/firewall_nat_out.php +++ b/usr/local/www/firewall_nat_out.php @@ -2,8 +2,10 @@ <?php /* firewall_nat_out.php - part of m0n0wall (http://m0n0.ch/wall) + Copyright (C) 2004 Scott Ullrich + All rights reserved. + originally part of m0n0wall (http://m0n0.ch/wall) Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. All rights reserved. @@ -42,7 +44,6 @@ if ($_POST) { $pconfig = $_POST; $config['nat']['advancedoutbound']['enable'] = ($_POST['enable']) ? true : false; - $config['nat']['enableoutboundloadbalancing'] = $_POST['enableoutboundloadbalancing'] ? true : false; write_config(); $retval = 0; @@ -95,6 +96,7 @@ if ($_GET['act'] == "del") { <li class="tabinact"><a href="firewall_nat_server.php">Server NAT</a></li> <li class="tabinact"><a href="firewall_nat_1to1.php">1:1</a></li> <li class="tabact">Outbound</li> + <li class="tabinact"><a href="firewall_nat_out_load_balancing.php">Outbound Load Balancing</a></li> </ul> </td></tr> <tr> diff --git a/usr/local/www/firewall_nat_server.php b/usr/local/www/firewall_nat_server.php index 584e0ad..4878c63 100755 --- a/usr/local/www/firewall_nat_server.php +++ b/usr/local/www/firewall_nat_server.php @@ -105,6 +105,7 @@ if ($_GET['act'] == "del") { <li class="tabact">Server NAT</li> <li class="tabinact"><a href="firewall_nat_1to1.php">1:1</a></li> <li class="tabinact"><a href="firewall_nat_out.php">Outbound</a></li> + <li class="tabinact"><a href="firewall_nat_out_load_balancing.php">Outbound Load Balancing</a></li> </ul> </td></tr> <tr> |