From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 From: Sergey Organization: Home To: "ALT Linux sysadmins' discussion" Date: Sat, 26 Oct 2013 11:55:09 +0400 User-Agent: KMail/1.9.10 References: <201310251556.25452.a_s_y@sama.ru> <201310252056.11107.a_s_y@sama.ru> <201310252217.32402.a_s_y@sama.ru> In-Reply-To: <201310252217.32402.a_s_y@sama.ru> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_eV3aS71Rc/XAlqG" Message-Id: <201310261155.10277.a_s_y@sama.ru> Subject: Re: [Sysadmins] =?koi8-r?b?T3BlblZaLCDQxdLFxdrEIGJydW5jaCA1LjEgLT4g?= =?koi8-r?b?cDcsINDSz8LMxc3BINMgxM/T1NXQz80gyyBWUFM=?= X-BeenThere: sysadmins@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux sysadmins' discussion List-Id: ALT Linux sysadmins' discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2013 07:58:22 -0000 Archived-At: List-Archive: --Boundary-00=_eV3aS71Rc/XAlqG Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 8bit Content-Disposition: inline On Friday 25 October 2013, Sergey wrote: > На вскидку если, то это должен делать скрипт vps-net_add. Дальше копаться времени нет, сделал временную затычку пока, которую надо на cron вешать. Если же в vzctl эту возможность совсем сломали, надо будет тогда её доработать. Она сейчас на помеси awk/grep/perl, да, ещё, без поиска ethernet-интерфейсов. -- С уважением, Сергей a_s_y@sama.ru --Boundary-00=_eV3aS71Rc/XAlqG Content-Type: application/x-perl; name="vzarpset.pl" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="vzarpset.pl" #!/usr/bin/perl use Sys::Syslog; use constant ScriptName => "vzarpset"; use constant SysLogFacility => "local4"; use constant SysLogPriority => "info"; @arplist=`arp -vn|egrep "\\\*[[:space:]]*\\\*[[:space:]]*MP"|awk '{print(\$1);}'`; @velist=`vzlist| awk '{print(\$4);}'|egrep '^[0-9.]*\$'`; my %arphash; my %vehash; my %arpadd; my %arprm; foreach $ip (@arplist ) { $arphash{$ip} = 1 } foreach $ip (@velist) { $vehash{$ip} = 1; if (! $arphash{$ip}) {$arpadd{$ip} = 1} } foreach $ip (@arplist) { if (! $vehash{$ip}) {$arprm{$ip} = 1} } @arpadd = keys %arpadd; @arprm = keys %arprm; foreach $ip (@arpadd) { chomp($ip); openlog(ScriptName . "[$$]", "ndelay", SysLogFacility); syslog(SysLogPriority, "arp -s " . $ip . " 0:0:0:0:0:0 -i ether0 pub"); closelog; system "arp -s " . $ip . " 0:0:0:0:0:0 -i ether0 pub"; } foreach $ip (@arprm) { chomp($ip); openlog(ScriptName . "[$$]", "ndelay", SysLogFacility); syslog(SysLogPriority, "arp -d " . $ip . " -i ether0"); closelog; system "arp -d " . $ip . " -i ether0"; } --Boundary-00=_eV3aS71Rc/XAlqG--