http://search.cpan.org/~dpates/IPTables-IPv4-0.98/IPv4.pm
Трабл при использовании модуля IPTables::IPv4. странные вещи творятся..
начнем с iptables
host ~ # iptables -xnv -L table_a
Chain table_a (1 references)
pkts  bytes target prot opt in out   source          destination
0     0      DROP  all  --  *   *   192.168.7.155    10.10.0.0/21
Это правило я вбил руками.
а вот пеловый скрипт, который пытаеться показать это правило
-------8<-----------------------------------------
#!/usr/bin/perl
use IPTables::IPv4;
use Data::Dumper;
my $table = IPTables::IPv4::init('filter');
unless ($table) {
	print ("Can't initialize IPv4 table\n");
	exit;
}
my @rules = $table->list_rules("table_a");
print Dumper(@rules);
-------8<-----------------------------------------
I run it:
host new # ./aaa.pl
$VAR1 = {
          'pcnt' => '0',
          'jump' => 'DROP',
          'bcnt' => '0'
        };
заметьте, полей source и destination нету.
теперь я создам похожее правило, не через модуль IPTables::IPv4
-------8<-----------------------------------------
#!/usr/bin/perl
use IPTables::IPv4;
use Data::Dumper;
use strict;
use warnings;
my $table = IPTables::IPv4::init('filter');
unless ($table) {
	print ("Can't initialize IPv4 table\n");
	exit;
}
my $rule = {"source" => "192.168.7.154",
	"destination" => "10.10.0.0/21",
	"jump" => "DROP"};
$table->append_entry("table_a", $rule) ||
	print "Error: $!";
$table->commit() ||
	print "Commit Error: $!";
-------8<-----------------------------------------
iptables:
host ~ # iptables -nv -L table_a
Chain table_a (1 references)
pkts bytes target prot opt in out    source         destination
 0     0   DROP    all  --  *   *   192.168.7.155   10.10.0.0/21
 0     0   DROP    all  --  *   *   192.168.7.154   10.10.0.0/21
теперь вызываем смотрим на записи:
host new # ./aaa.pl
$VAR1 = {
          'pcnt' => '0',
          'jump' => 'DROP',
          'bcnt' => '0'
        };
$VAR2 = {
          'source' => '192.168.7.154',
          'pcnt' => '0',
          'destination' => '10.10.0.0/21',
          'jump' => 'DROP',
          'bcnt' => '0'
        };
вуаля, правило есть.
где бок ?
автору на dpates@dsdk12.net я уже отписал.
    
        Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.
      
Похожие темы
- Форум iptables для «простого» ноутбука. (2011)
- Форум docker iptables (2019)
- Форум IPTABLES ингнорирует пакеты на 445 порт (2013)
- Форум iptables. Не могу заблокировать айпишник. (2016)
- Форум Што за херня с IPTABLES? (2017)
- Форум Port forwarding [openwrt][iptables] (2011)
- Форум ``iptables\ip6tables`` имеет ключ ``-w`` (2014)
- Форум iptables DNAT (2013)
- Форум centos firewall (2018)
- Форум [2] iptables: Нужно запретить все входящие запросы на соединение (2004)