Changeset 208 for trunk/system/generators/nat_routerboard.php
- Timestamp:
- May 6, 2009, 8:21:23 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/generators/nat_routerboard.php
r197 r208 14 14 echo($Member['Name'].': '); 15 15 // Hosts 16 $DbResult2 = $Database-> select('hosts', '*', '(external_ip <> "") AND (user='.$Member['Id'].') AND (IP != external_ip) ORDER BY id DESC');17 while($ Host= $DbResult2->fetch_assoc())16 $DbResult2 = $Database->query('SELECT NetworkInterface.*, NetworkDevice.Name AS DeviceName FROM NetworkInterface LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device WHERE (NetworkInterface.ExternalIP <> "") AND (NetworkDevice.Member = '.$Member['Id'].') AND (NetworkInterface.LocalIP != NetworkInterface.ExternalIP) ORDER BY id DESC'); 17 while($Interface = $DbResult2->fetch_assoc()) 18 18 { 19 $Host['name'] = RouterOSIdent($Host['name']); 20 echo($Host['name'].'('.$Host['IP'].'), '); 21 $Commands[] = ' /ip firewall nat add chain=srcnat src-address='.$Host['IP'].' out-interface='.$InetInterface.' action=src-nat to-addresses='.$Host['external_ip'].' comment="'.$Host['name'].'"'; 22 $Commands[] = ' /ip firewall nat add chain=dstnat dst-address='.$Host['external_ip'].' in-interface='.$InetInterface.' action=dst-nat to-addresses='.$Host['IP'].' comment="'.$Host['name'].'"'; 19 $Name = $Interface['DeviceName'].'-'.$Interface['Name']; 20 $Name = RouterOSIdent($Name); 21 echo($Name.'('.$Interface['LocalIP'].'), '); 22 $Commands[] = ' /ip firewall nat add chain=srcnat src-address='.$Interface['LocalIP'].' out-interface='.$InetInterface.' action=src-nat to-addresses='.$Interface['ExternalIP'].' comment="'.$Name.'"'; 23 $Commands[] = ' /ip firewall nat add chain=dstnat dst-address='.$Interface['ExternalIP'].' in-interface='.$InetInterface.' action=dst-nat to-addresses='.$Interface['LocalIP'].' comment="'.$Name.'"'; 23 24 } 24 25
Note:
See TracChangeset
for help on using the changeset viewer.