Changeset 698 for trunk/Modules/NetworkConfigLinux/Generators/DNS.php
- Timestamp:
- Sep 28, 2014, 10:41:47 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkConfigLinux/Generators/DNS.php
r695 r698 17 17 $MinimumTime = 10800; 18 18 $TTL = 86400; 19 $BaseDir = '/home/chronos/Projekty/centrala/trunk/var/named'; 19 $BaseDir = '/var/named'; 20 //$BaseDir = '/home/chronos/Projekty/centrala/trunk/var/named'; 20 21 if(!file_exists($BaseDir)) die('Base directory "'.$BaseDir.'" not exists.'); 21 22 $MailServer = 'centrala'; … … 68 69 $Output .= strtolower($Host['Name'])."\tIN\tAAAA\t".$Host['IPv6']."\n"; 69 70 } 70 71 71 72 // Alias list 72 73 foreach($DNS['Alias'] as $Alias) … … 112 113 } 113 114 114 /* 115 // Generate reverse DNS IPv6 records 115 // Generate reverse DNS IPv6 records 116 116 foreach($DNS['IPv6Network'] as $Network) 117 117 { 118 $Parts = explode('.', $Network); 118 $Parts = explode('/', $Network); 119 $NetworkAddress = $Parts[0]; 120 $Prefix = $Parts[1]; 119 121 $Output = // '$ORIGIN '.$Parts[2].'.'.$Parts[1].'.'.$Parts[0].'.in-addr.arpa'."\n". 120 122 '$TTL '.$DNS['TTL']."\n". … … 134 136 foreach($DNS['Host'] as $Host) 135 137 if(array_key_exists('IPv6', $Host) and ($Host['IPv6'] != '')) 136 if(substr($Host['IPv6'], 0, strlen($Network)) == $Network)137 138 { 138 $Remaining = substr($Host['IPv6'], strlen($Network)); 139 $Remaining = explode(':', $Remaining); 140 foreach($Remaining) 141 $Remaining = array_reverse($Remaining); 142 139 $Addr = new NetworkAddressIPv6(); 140 $Addr->AddressFromString($Host['IPv6']); 141 $Octets = $Addr->GetOctets(); 142 $Octets = array_slice($Octets, 0, (128 - $Prefix) / 4); 143 $Octets = array_reverse($Octets); 144 $Octets = implode('.', $Octets); 145 143 146 $Host['Name'] = strtolower($Host['Name']); 144 $Output .= implode(':', $Remaining)."\tIN\tPTR\t".$Host['Name'].".".$DNS['Domain'].".\n";147 $Output .= $Octets."\tIN\tPTR\t".$Host['Name'].".".$DNS['Domain'].".\n"; 145 148 } 146 $Reverse = implode(':', array_reverse(explode(':', $Network))); 147 $File = fopen($DNS['BaseDir'].$Reverse.'.ipv6.arpa.zone', 'w+'); 149 150 $NetAddr = new NetworkAddressIPv6(); 151 $NetAddr->AddressFromString($NetworkAddress); 152 $Octets = array_reverse($NetAddr->GetOctets()); 153 $Octets = array_reverse(array_slice($Octets, 0, $Prefix / 4)); 154 $FileName = implode('.', $Octets).'.ipv6.arpa.zone'; 155 $File = fopen($DNS['BaseDir'].$FileName, 'w+'); 148 156 fputs($File, $Output); 149 //echo($Output);150 157 fclose($File); 151 158 } 152 */153 159 } 154 160 … … 169 175 'Host' => array(), 170 176 'Alias' => array(), 171 'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', '10.145.68', 172 173 'IPv6Network' => array('2 001:470:9ab9:1'),177 'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', '10.145.68', 178 '10.145.69', '10.145.70', '10.145.71', '77.92.221', '172.16.0', '172.16.1'), 179 'IPv6Network' => array('2a00:e580:244::/48'), 174 180 ); 175 181 … … 232 238 'Alias' => array(), 233 239 'Network' => array('81.2.194', '193.86.238', '212.111.4', '77.92.221'), 234 'IPv6Network' => array('2 001:470:9ab9:1'),240 'IPv6Network' => array('2a00:e580:244::/48'), 235 241 ); 236 242 … … 271 277 'Host' => array(), 272 278 'Alias' => array(), 273 'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', 279 'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', 274 280 '10.145.68', '10.145.69', '10.145.70', '10.145.71'), 275 281 'IPv6Network' => array(), … … 311 317 'Host' => array(), 312 318 'Alias' => array(), 313 'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', 319 'Network' => array('10.145.64', '10.145.65', '10.145.66', '10.145.67', 314 320 '10.145.68', '10.145.69', '10.145.70', '10.145.71'), 315 321 'IPv6Network' => array(),
Note:
See TracChangeset
for help on using the changeset viewer.