Ignore:
Timestamp:
Jan 24, 2010, 9:21:28 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Výpočet IP rozsahu u generování nastavení sítě.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/system/generators/firewall_nat.php

    r275 r276  
    44include('../../global.php');
    55include('../routerboard.php');
     6include('common.php');
    67$Path = array('ip', 'firewall', 'nat');
    78
     
    4041    $NewAddress->Prefix = $Subnet['ExtMask'];
    4142    $Range = $NewAddress->GetRange();
    42     if($Subnet['ExtMask'] != 32) $Range = $Range['From'].'-'.$Range['To'];
    43       else $Range = $Range['From'];
     43    if($Subnet['ExtMask'] != 32) $Range = $Range['From']->AddressToStrin().'-'.$Range['To']->AddressToString();
     44      else $Range = $Range['From']->AddressToString();
    4445    if($Subnet['Mask'] == 32) $Src = $Subnet['AddressRange'];
    4546      else $Src = $Subnet['AddressRange'].'/'.$Subnet['Mask'];
     
    5051    $NewAddress->Prefix = $Subnet['Mask'];
    5152    $Range = $NewAddress->GetRange();
    52     if($Subnet['Mask'] != 32) $Range = $Range['From'].'-'.$Range['To'];
    53       else $Range = $Range['From'];
     53    if($Subnet['Mask'] != 32) $Range = $Range['From']->AddressToString().'-'.$Range['To']->AddressToString();
     54      else $Range = $Range['From']->AddressToString();
    5455    if($Subnet['ExtMask'] == 32) $Dest = $Subnet['ExtAddressRange'];
    5556      else $Dest = $Subnet['ExtAddressRange'].'/'.$Subnet['ExtMask'];
     
    6566$Items[] = array('chain' => 'dstnat', 'dst-address' => '212.111.4.174', 'protocol' => 'udp', 'dst-port' => 53, 'in-interface' => $InetInterface, 'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 53, 'comment' => 'DNS_redirection_UDP');
    6667
     68//print_r($Items);
    6769$Routerboard->ListUpdate($Path, array('chain', 'dst-address', 'in-interface', 'src-address', 'out-interface', 'to-ports', 'dst-port', 'protocol', 'action', 'to-addresses', 'comment'), $Items);
    6870
Note: See TracChangeset for help on using the changeset viewer.