LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   i cannot run the command iptab (https://www.linuxquestions.org/questions/linux-newbie-8/i-cannot-run-the-command-iptab-669429/)

homyangcha 09-12-2008 04:29 AM

i cannot run the command iptab
 
when i run the iptab command the following is the result:

# iptab <enter>
+----------------------------------------------+
| addrs bits pref class mask |
+----------------------------------------------+
Can't call method "is_zero" on an undefined value at /usr/lib/perl5/5.8.8/Math/BigInt.pm line 1148.


what is the problem can any throw light on this matter.

chrism01 09-12-2008 07:03 AM

How big is iptab. Its obviously a Perl prog. Can you post it here?

jschiwal 09-12-2008 01:04 PM

Code:


jschiwal@hpmedia:~> iptab
+----------------------------------------------+
| addrs  bits  pref  class  mask            |
+----------------------------------------------+
Can't call method "is_zero" on an undefined value at /usr/lib/perl5/5.10.0/Math/BigInt.pm line 1185.

 ls -l $(locate BigInt.pm)
-r--r--r-- 1 root root 149722 2008-07-15 09:43 /usr/lib/perl5/5.10.0/Math/BigInt.pm
jschiwal@hpmedia:~> ls -l $(locate --regex '/iptab$')
-r-xr-xr-x 1 root root 982 2008-06-06 16:29 /usr/bin/iptab

I tried the iptab command and it did the same thing. It looks like both BigInt.pm and iptab have been recently updated.
Code:

rpm -qi $(rpm -qf $(which iptab))
Name        : perl-Net-IP                  Relocations: (not relocatable)
Version    : 1.25                              Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Release    : 29.1                          Build Date: Fri 06 Jun 2008 04:29:24 PM CDT
Install Date: Sat 21 Jun 2008 03:57:44 PM CDT      Build Host: kimball.suse.de
Group      : Development/Libraries/Perl    Source RPM: perl-Net-IP-1.25-29.1.src.rpm
Size        : 81251                            License: Artistic License
Signature  : DSA/SHA1, Fri 06 Jun 2008 04:36:52 PM CDT, Key ID a84edae89c800aca
Packager    : http://bugs.opensuse.org
URL        : http://cpan.org/modules/by-module/Net/
Summary    : allow easy manipulation of IPv4 and IPv6 addresses
Description :
This is the Net::IP module, designed to allow easy manipulation of IPv4
and IPv6 addresses.

Code:

> cat $(which iptab)
#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell

use Net::IP;
use strict;

print "+----------------------------------------------+
| addrs  bits  pref  class  mask            |
+----------------------------------------------+
";

my ($ip,$size,$class,$bits,$len);

my $ip = new Net::IP('0');

for my $len (reverse (0..32))
{

        $ip->set("0.0.0.0/$len");

        $size = $ip->size();

        if ($size >=1048576) # 1024*1024
        {
                $size /= 1048576;
                $size .= 'M';
        }
        elsif ($size >= 1024)
        {
                $size /= 1024;
                $size .= 'K';
        };

        $len = $ip->prefixlen();
        $bits = 32 - $len;

        if ($bits >= 24)
        {
                $class = 2**($bits-24);
                $class.= 'A';
        }
        elsif ($bits >= 16)
        {
                $class = 2**($bits-16);
                $class.= 'B';
        }
        elsif ($bits >= 8)
        {
                $class = 2**($bits-8);
                $class.= 'C';
        }

        printf ("| %5s %6s %6s %7s  %-15s |\n",
                $size,$bits,'/'.$len,$class,$ip->mask());


};

print "+----------------------------------------------+\n";


homyangcha 09-13-2008 02:02 AM

i cannot run the command iptab
 
guys
sorry, i had to reload the OS again (CentOS 5.2). but this time i could not even run the command... this is the output...

# iptab
bash: iptab: command not found

Can you throw some light on this... i mean how to configure, install or setup so that iptab works correctly.

Thanks again

jschiwal 09-13-2008 05:12 AM

On my system, the command is supplied by a "Perl-NET-IP" package. I think a perl package name may be standard across different Linux distributions.


All times are GMT -5. The time now is 10:07 PM.