- Timestamp:
- Jan 5, 2018, 11:41:47 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r388 r389 10 10 use strict; 11 11 use warnings; 12 use version; our $VERSION = qv('0.7. 6');12 use version; our $VERSION = qv('0.7.7'); 13 13 14 14 use Readonly; … … 76 76 'searchdb' => \&cmd_searchdb, 77 77 'removedb' => \&cmd_removedb, 78 ' addentrydb' => \&cmd_addentrydb,78 'insertdb' => \&cmd_insertdb, 79 79 'cleandb' => \&cmd_cleandb, 80 80 'search' => \&cmd_search, … … 288 288 $ret{'ipv4_address'} = inet_ntoa($packed_ip); 289 289 #if ($ret{'ipv4_address'} !~ m/$RE_IPv4_ADDRESS/) { 290 # print "Error: for computer $param_ip_or_host on interface $interface, IP $ret{'ipv4_address'} is not valide\n";290 # print "Error: for computer $param_ip_or_host on interface $interface, IPv4 $ret{'ipv4_address'} is not valide\n"; 291 291 # return %ret; 292 292 # } … … 1197 1197 klask updatedb [--verbose|-v] [--verb-description|-d] [--chk-hostname|-h] [--chk-location|-l] [--no-rebuildsw|-R] 1198 1198 klask exportdb [--format|-f txt|html] 1199 klask removedb IP* computer* 1199 klask removedb ipv4_addr* computer* 1200 klask insertdb --ip ipv4_addr --mac mac_addr --network vlan_name 1200 1201 klask cleandb [--verbose|-v] --day number_of_day --repair-dns 1201 1202 … … 1573 1574 1574 1575 #--------------------------------------------------------------- 1575 sub cmd_ addentrydb {1576 sub cmd_insertdb { 1576 1577 my @ARGV = @_; 1577 1578 … … 1609 1610 1610 1611 if ($resol_arp{'hostname_fq'} eq 'unknow') { 1611 print {*STDERR} "Error: DNS name not defined for IP $ip (mandatory)\n";1612 print {*STDERR} "Error: DNS name not defined for IPv4 $ip (mandatory)\n"; 1612 1613 exit 1; 1613 1614 } 1614 1615 1615 1616 if ($resol_arp{'ipv4_address'} ne $ip) { 1616 print {*STDERR} "Error: IP DNS resolution strange between $ip and $resol_arp{'ipv4_address'}\n";1617 print {*STDERR} "Error: IPv4 DNS resolution strange between $ip and $resol_arp{'ipv4_address'}\n"; 1617 1618 exit 1; 1618 1619 } … … 1624 1625 for my $current_ip (keys %{$computerdb}) { 1625 1626 if ($current_ip eq $ip) { 1626 print {*STDERR} "Error: IP $ip already exists in the computer database\n";1627 print {*STDERR} "Error: IPv4 $ip already exists in the computer database\n"; 1627 1628 exit 1; 1628 1629 } … … 2849 2850 print <<'END_HTML'; 2850 2851 <table class="sortable"> 2851 <caption>Klask Free IP Database</caption>2852 <caption>Klask Free IPv4 Database</caption> 2852 2853 <thead> 2853 2854 <tr> … … 3426 3427 klask updatedb [--verbose|-v] [--verb-description|-d] [--chk-hostname|-h] [--chk-location|-l] [--no-rebuildsw|-R] 3427 3428 klask exportdb [--format|-f txt|html] 3428 klask removedb IP* computer* 3429 klask removedb ipv4_addr* computer* 3430 klask insertdb --ip ipv4_addr --mac mac_addr --network vlan_name 3429 3431 klask cleandb [--verbose|-v] --day number_of_day --repair-dns 3430 3432 … … 3469 3471 so other switch cannot find the real downlink port... 3470 3472 One way to work around this problem is, if you have a computer directly connected on the switch, 3471 to put this IP as the fake ip for the switch.3473 to put this IPv4 as the fake ip for the switch. 3472 3474 The MAC address associated will be use just for the map detection. 3473 3475 The C<fake-ip> parameter is defined in the config file. … … 3549 3551 The network parameter C<scan-mode> can have two values: C<active> or C<passive>. 3550 3552 By default, a network is C<active>. 3551 This means that an C<fping> command is done at the beginning on all the IP of the network3553 This means that an C<fping> command is done at the beginning on all the IPv4 of the network 3552 3554 and the computers that was not detected in this pass, but where their Klask entry is less than one week, 3553 3555 will have an C<arping> … … 3571 3573 =head2 removedb 3572 3574 3573 klask removedb IP* computer*3575 klask removedb ipv4_addr* computer* 3574 3576 3575 3577 This command remove an entry in the database. 3576 There is only one kind of parameter, the IP of the computers to be removed.3577 You can put as many IP as you want...3578 There is only one kind of parameter, the IPv4 of the computers to be removed. 3579 You can put as many IPv4 as you want... 3578 3580 3579 3581 Computer DNS names are also a valid entry because a DNS resolver is executed at the beginning. 3582 3583 =head2 insertdb 3584 3585 klask insertdb --ip ipv4_addr --mac mac_addr --network vlan_name 3586 3587 This command insert an entry in the database. 3588 The IPv4 must not exist previously in the database 3589 and the DNS resolution name muts be active. 3590 3591 The date or timestamp of the entry will be C<number_of_day> in the past (see L<cleandb>) 3592 from today or from the oldest entry with the same MAC-Address. 3593 This command can be use to add pseudo entry and help in the process to detect bad vlan configuration (see L<bad-vlan-id>). 3580 3594 3581 3595 =head2 cleandb … … 3587 3601 This could be configure with the global regex parameter C<float-regex> in the configuration file F</etc/klask/klask.conf>. 3588 3602 This functionality could be use when computer define in VLAN 1 3589 could have a float IP when they are connected on VLAN 2.3603 could have a float IPv4 when they are connected on VLAN 2. 3590 3604 In the Klask database, the float DNS entries are less important. 3591 3605 … … 3639 3653 klask ip-free [--verbose|-v] [--day|-d days-to-death] [--format|-f txt|html] [vlan_name] 3640 3654 3641 This command return IP address that was not use (detected by Klask) at this time.3655 This command return IPv4 address that was not use (detected by Klask) at this time. 3642 3656 The list returned could be limited to just one VLAN. 3643 3657 IP returned could have been never used or no computer have been detected since the number of days specified … … 3648 3662 days-to-death: 730 3649 3663 3650 Computer that does not have the good IP but takes a float one (see L</cleandb>) are taken into account.3664 Computer that does not have the good IPv4 but takes a float one (see L</cleandb>) are taken into account. 3651 3665 3652 3666 … … 3657 3671 This command return a list of switch port that are not configure with the good VLAN. 3658 3672 Computer which are in bad VLAN are detected with the float regex parameter (see L</cleandb>) 3659 and another prior trace where they had the good IP (good DNS name).3673 and another prior trace where they had the good IPv4 (good DNS name). 3660 3674 The computer must stay connected on a bad VLAN more than XX days (15 days by default) before alert. 3661 3675 This parameter could also define in the configuration file F</etc/klask/klask.conf> (see L</CONFIGURATION>).
Note: See TracChangeset
for help on using the changeset viewer.