- Timestamp:
- Apr 14, 2015, 10:20:16 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigRouterOS/Generators/FirewallNAT.php
r735 r738 34 34 35 35 // Skip local subnet 36 //$Items[] = array('chain' => 'inet-out', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet'); 36 //$Items[] = array('chain' => 'inet-out', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet'); 37 37 //$Items[] = array('chain' => 'inet-in', 'dst-address' => '172.16.1.1/30', 'action' => 'accept', 'comment' => 'Local_subnet'); 38 38 … … 46 46 $DbResult2 = $System->Database->query('SELECT `NetworkInterface`.*, `NetworkDevice`.`Name` AS `DeviceName`, `NetworkDevice`.`InboundNATPriority` FROM `NetworkInterface`'. 47 47 ' LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` WHERE (`NetworkInterface`.`ExternalIP` <> "")'. 48 ' AND (`NetworkInterface`.`LocalIP` <> "")'. 48 ' AND (`NetworkInterface`.`LocalIP` <> "")'. 49 49 ' AND (`NetworkDevice`.`Member` = '.$Member['Id'].') AND (`NetworkInterface`.`LocalIP` != `NetworkInterface`.`ExternalIP`) ORDER BY `id` DESC'); 50 50 while($Interface = $DbResult2->fetch_assoc()) … … 57 57 { 58 58 $Items[] = array('chain' => 'inet-out', 'src-address' => $Interface['LocalIP'], 'action' => 'src-nat', 'to-addresses' => $Interface['ExternalIP'], 'comment' => $Name.'-out'); 59 if($Interface['InboundNATPriority'] > 0) 59 if($Interface['InboundNATPriority'] > 0) 60 60 $Items[] = array('chain' => 'inet-in', 'dst-address' => $Interface['ExternalIP'], 'action' => 'dst-nat', 'to-addresses' => $Interface['LocalIP'], 'comment' => $Name.'-in'); 61 } else 61 } else 62 62 { 63 63 $Items[] = array('chain' => 'dstnat', 'src-address' => $Interface['LocalIP'], 'protocol' => 'tcp', 'dst-port' => 80, 'action' => 'dst-nat', 'to-addresses' => $IPCentrala, 'to-ports' => 81, 'comment' => $Name.'-out'); … … 68 68 $DbResult2 = $System->Database->select('NetworkSubnet', '*', '`Member`='.$Member['Id']); 69 69 while($Subnet = $DbResult2->fetch_assoc()) 70 { 70 { 71 71 $Subnet['Name'] = RouterOSIdent('subnet-'.$Subnet['Name']); 72 72 echo($Subnet['Name'].'('.$Subnet['AddressRange'].'/'.$Subnet['Mask'].'), '); … … 82 82 else $Src = $Subnet['AddressRange'].'/'.$Subnet['Mask']; 83 83 $Items[] = array('chain' => 'inet-out', 'src-address' => $Src, 'action' => 'src-nat', 'to-addresses' => $Range, 'comment' => $Subnet['Name'].'-out'); 84 84 85 85 $NewAddress = new NetworkAddressIPv4(); 86 86 $NewAddress->AddressFromString($Subnet['AddressRange']); … … 114 114 115 115 // Accept free-access clients 116 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 117 'src-address-list' => 'free-access', 'in-interface' => $LocalInterface, 118 116 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 117 'src-address-list' => 'free-access', 'in-interface' => $LocalInterface, 118 'action' => 'accept', 'comment' => 'Free_access'); 119 119 // Redirect unregistred clients to free access activation page 120 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 121 'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface, 122 120 $Items[] = array('chain' => 'dstnat', 'dst-address' => '!10.145.0.0/16', 121 'src-address-list' => 'unregistred', 'in-interface' => $LocalInterface, 122 'action' => 'dst-nat', 'to-addresses' => '10.145.64.8', 'to-ports' => 82, 'comment' => 'Redirect_unregistred'); 123 123 124 124 /*
Note:
See TracChangeset
for help on using the changeset viewer.