ubuntu 12.04에서는 정상적으로 geoip 가 세팅 되었는데
가끔 ubuntu 10.04 에서 실행 할때 에러가 나올 경우가 생겨서 잃어버릴까바 적어놓는다.
10.04 버전
문제 발생 : Could not open /var/geoip/LE/NL.iv0: No such file or directory
iptables v1.4.4: Could not read geoip database
이런 에러가 생긴다. 해당 문제는 실제 생성된 파일들은 iv4,ip6로 되어있는데 ip0값을 원할때
해당 에러가 나온다.
이는 아래 펄 스크립트(geoip_csv_iv0.pl)로, 다운 받고 Unzip된 GeoIPCountryWhois.csv 파일을 돌린다
./geoip_csv_iv0.pl GeoIPCountryWhois.csv
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/usr/bin/perl # # Converter for MaxMind CSV database to binary, for xt_geoip # Copyright A¨I Jan Engelhardt <jengelh@medozas.de>, 2008 # # Use -b argument to create big-endian tables. # use Getopt::Long; use IO::Handle; use Text::CSV_XS; # or trade for Text::CSV use strict; my %country; my %names; my $csv = Text::CSV_XS->new({binary => 0, eol => $/}); # or Text::CSV my $mode = "VV"; &Getopt::Long::Configure(qw(bundling)); &GetOptions("b" => sub { $mode = "NN"; }); while (my $row = $csv->getline(*ARGV)) { if (!defined($country{$row->[4]})) { $country{$row->[4]} = []; $names{$row->[4]} = $row->[5]; } my $c = $country{$row->[4]}; push(@$c, [$row->[2], $row->[3]]); if ($. % 4096 == 0) { print STDERR "\r\e[2K$. entries"; } } print STDERR "\r\e[2K$. entries total\n"; foreach my $iso_code (sort keys %country) { printf "%5u ranges for %s %s\n", scalar(@{$country{$iso_code}}), $iso_code, $names{$iso_code}; open(my $fh, ">".uc($iso_code).".iv0"); foreach my $range (@{$country{$iso_code}}) { print $fh pack($mode, $range->[0], $range->[1]); } close $fh; } |
하면 ip0로 파일들이 생성된다.
아니면
xt_geoip_build.pl 파일 내용을 수정하여 돌린다.
1 2 3 4 5 6 7 8 9 10 11 12 | //아래 이 부분을 $file = "$target_dir/LE/".uc($iso_code).".iv4"; if (!open($fh_le, "> $file")) { print STDERR "Error opening $file: $!\n"; exit 1; } //이렇게 수정 $file = "$target_dir/LE/".uc($iso_code).".iv0"; if (!open($fh_le, "> $file")) { print STDERR "Error opening $file: $!\n"; exit 1; } |
또 다른 에러
iptables: No chain/target/match by that name." error - instead of downloading xtables-addons-1.21.tar.bz2
는
sudo module-assistant --verbose --text-mode auto-install xtables-addons
실행
'IT > server' 카테고리의 다른 글
tar 특정 폴더 제외한 cp (0) | 2014.03.04 |
---|---|
[ubuntu] 대용량 하드 파티션 잡기 및 레이드 ubuntu hard partition raid (0) | 2014.03.03 |
[ubuntu]_iptable geoip 설정 (0) | 2014.03.03 |
mysql5..5 replication (0) | 2013.02.05 |
[ubuntu] 하드 자동 마운트 fstab (0) | 2012.02.23 |