Oversætter IP-adresse til land.
| Nuværende version | 01 November, 2025 |
|---|---|
| Næste opdatering | 15 November, 2025 |
| IPv4 Databasestørrelse |
BIN: 2.53 MB CSV: 12.32 MB (265,536 Rækker) CIDR: 14.33 MB (361,322 Rækker) MMDB: 17.23 MB |
| IPv6 Databasestørrelse |
BIN: 10.81 MB CSV: 55.11 MB (673,505 Rækker) CIDR: 124.31 MB (2,575,584 Rækker) |
| Array |
Binær (BIN)
ASCII-tekstfil (CSV) MMDB |
| Navn | Type | Beskrivelse |
|---|---|---|
| ip_from | INT (10)† / DECIMAL (39,0)†† | Første IP-adresse viser netblock. |
| ip_to | INT (10)† / DECIMAL (39,0)†† | Sidste IP-adresse viser netblock. |
| country_code | CHAR(2) | Landekode med to tegn baseret på ISO 3166. |
| country_name | VARCHAR(64) | Landsnavn baseret på ISO 3166. |
† IPv4
†† IPv6
††† Latitude and Longitude are often near the center of population. These values are not precise and should not be used to identify a particular address or household.
CREATE DATABASE ip2location;
USE ip2location;
CREATE TABLE `ip2location_db1`(
`ip_from` INT(10) UNSIGNED,
`ip_to` INT(10) UNSIGNED,
`country_code` CHAR(2),
`country_name` VARCHAR(64),
PRIMARY KEY (`ip_to`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
LOAD DATA LOCAL
INFILE 'IP2LOCATION-LITE-DB1.CSV'
INTO TABLE
`ip2location_db1`
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 0 LINES;
CREATE DATABASE ip2location
GO
USE ip2location
GO
CREATE TABLE [ip2location].[dbo].[ip2location_db1](
[ip_from] bigint NOT NULL,
[ip_to] bigint NOT NULL,
[country_code] nvarchar(2) NOT NULL,
[country_name] nvarchar(64) NOT NULL
) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [ip_to] ON [ip2location].[dbo].[ip2location_db1]([ip_to]) ON [PRIMARY]
GO
BULK INSERT [ip2location].[dbo].[ip2location_db1]
FROM '{PATH TO IP2LOCATION-LITE-DB1.CSV}'
WITH
(
FORMATFILE = '{PATH TO DB1.FMT}'
)
GO
12.0
5
1 SQLCHAR 0 1 "\"" 0 first_double_quote Latin1_General_CI_AI
2 SQLCHAR 0 20 "\",\"" 1 ip_from "",
3 SQLCHAR 0 20 "\",\"" 2 ip_to "",
4 SQLCHAR 0 2 "\",\"" 3 country_code Latin1_General_CI_AI,
5 SQLCHAR 0 64 "\",\"" 4 country_name Latin1_General_CI_AI
CREATE DATABASE ip2location WITH ENCODING 'UTF8';
\c ip2location
CREATE TABLE ip2location_db1(
ip_from bigint NOT NULL,
ip_to bigint NOT NULL,
country_code character(2) NOT NULL,
country_name character varying(64) NOT NULL,
CONSTRAINT ip2location_db1_pkey PRIMARY KEY (ip_from, ip_to)
);
COPY ip2location_db1 FROM 'IP2LOCATION-LITE-DB1.CSV' WITH CSV QUOTE AS '"';
mongoimport -u USERNAME -p PASSWORD --authenticationDatabase admin --drop --db ip2location --collection ip2location_db1 --type csv --file "IP2LOCATION-LITE-DB1.CSV" --fields ip_from,ip_to,country_code,country_name
CREATE DATABASE ip2location;
USE ip2location;
CREATE TABLE `ip2location_db1_ipv6`(
`ip_from` DECIMAL(39,0) UNSIGNED,
`ip_to` DECIMAL(39,0) UNSIGNED,
`country_code` CHAR(2),
`country_name` VARCHAR(64),
PRIMARY KEY (`ip_to`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
LOAD DATA LOCAL
INFILE 'IP2LOCATION-LITE-DB1.IPV6.CSV'
INTO TABLE
`ip2location_db1_ipv6`
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 0 LINES;
CREATE DATABASE ip2location
GO
USE ip2location
GO
CREATE TABLE [ip2location].[dbo].[ip2location_db1_ipv6](
[ip_from] char(39) NOT NULL,
[ip_to] char(39) NOT NULL,
[country_code] nvarchar(2) NOT NULL,
[country_name] nvarchar(64) NOT NULL
) ON [PRIMARY]
GO
CREATE CLUSTERED INDEX [ip_to] ON [ip2location].[dbo].[ip2location_db1_ipv6]([ip_to]) ON [PRIMARY]
GO
BULK INSERT [ip2location].[dbo].[ip2location_db1_ipv6]
FROM '{PATH TO IP2LOCATION-LITE-DB1.IPV6.CSV}'
WITH
(
FORMATFILE = '{PATH TO DB1.FMT}'
)
GO
12.0
5
1 SQLCHAR 0 1 "\"" 0 first_double_quote Latin1_General_CI_AI
2 SQLCHAR 0 39 "\",\"" 1 ip_from "",
3 SQLCHAR 0 39 "\",\"" 2 ip_to "",
4 SQLCHAR 0 2 "\",\"" 3 country_code Latin1_General_CI_AI,
5 SQLCHAR 0 64 "\",\"" 4 country_name Latin1_General_CI_AI
CREATE DATABASE ip2location WITH ENCODING 'UTF8';
\c ip2location
CREATE TABLE ip2location_db1_ipv6(
ip_from decimal(39,0) NOT NULL,
ip_to decimal(39,0) NOT NULL,
country_code character(2) NOT NULL,
country_name character varying(64) NOT NULL,
CONSTRAINT ip2location_db1_pkey PRIMARY KEY (ip_from, ip_to)
);
COPY ip2location_db1_ipv6 FROM 'IP2LOCATION-LITE-DB1.IPV6.CSV' WITH CSV QUOTE AS '"';
mongoimport -u USERNAME -p PASSWORD --authenticationDatabase admin --drop --db ip2location --collection ip2location_db1_ipv6 --type csv --file "IP2LOCATION-LITE-DB1.IPV6.CSV" --fields ip_from,ip_to,country_code,country_name
Nedenfor er prøvedatabasen til dine referencer.
"ip_from","ip_to","country_code","country_name"
"0","16777215","-","-"
"16777216","16777471","AU","Australia"
"16777472","16778239","CN","China"
"16778240","16779263","AU","Australia"
"16779264","16781311","CN","China"
"16781312","16785407","JP","Japan"
"16785408","16793599","CN","China"
"16793600","16809983","JP","Japan"
"16809984","16842751","TH","Thailand"
"16842752","16843007","CN","China"
"16843008","16843263","AU","Australia"
"16843264","16859135","CN","China"
"16859136","16875519","JP","Japan"
"16875520","16908287","TH","Thailand"
"16908288","16909055","CN","China"
"16909056","16909311","AU","Australia"
"16909312","16941055","CN","China"
"16941056","16973823","TH","Thailand"
"16973824","17039359","CN","China"
"17039360","17039615","AU","Australia"
"17039616","17072127","CN","China"
"17072128","17104895","TH","Thailand"
"17104896","17170431","JP","Japan"
"17170432","17301503","IN","India"
"17301504","17367039","CN","China"
"17367040","17432575","MY","Malaysia"
"17432576","17435135","CN","China"
"17435136","17435391","IN","India"
"17435392","17465343","CN","China"
"17465344","17498111","TH","Thailand"
"17498112","17563647","KR","Korea (the Republic of)"
"17563648","17825791","CN","China"
"17825792","17842175","KR","Korea (the Republic of)"
"17842176","17986559","-","-"
"17986560","18087935","KR","Korea (the Republic of)"
"18087936","18153471","TH","Thailand"
"18153472","18210815","JP","Japan"
"18210816","18219007","SG","Singapore"
"18219008","18350079","IN","India"
"18350080","18874367","CN","China"
"18874368","18907135","MY","Malaysia"
"18907136","18923519","SG","Singapore"
"18923520","18925567","HK","Hong Kong"
"18925568","18926847","SG","Singapore"
"18926848","18927103","HK","Hong Kong"
"18927104","18927615","SG","Singapore"
"18927616","18929663","TW","Taiwan (Province of China)"
"18929664","18930175","KR","Korea (the Republic of)"
"18930176","18930687","HK","Hong Kong"
"18930688","18930943","TW","Taiwan (Province of China)"
"18930944","18931455","HK","Hong Kong"
"18931456","18933759","JP","Japan"
"18933760","18935807","US","United States of America"
"18935808","18938879","HK","Hong Kong"
"18938880","18939135","KH","Cambodia"
"18939136","18939903","HK","Hong Kong"
"18939904","19005439","JP","Japan"
"19005440","19136511","TW","Taiwan (Province of China)"
"19136512","19202047","HK","Hong Kong"
"19202048","19267583","PH","Philippines"
"19267584","19398655","IN","India"
"19398656","19726335","AU","Australia"
"19726336","19791871","CN","China"
"19791872","19922943","TH","Thailand"
"19922944","20185087","CN","China"
"20185088","20447231","VN","Viet Nam"
"20447232","20971519","CN","China"
"20971520","21102591","HK","Hong Kong"
"21102592","21233663","JP","Japan"
"21233664","21495807","CN","China"
"21495808","22020095","JP","Japan"
"22020096","23068671","CN","China"
"23068672","24117247","KR","Korea (the Republic of)"
"24117248","24379391","JP","Japan"
"24379392","24510463","CN","China"
"24510464","24518655","HK","Hong Kong"
"24518656","24519679","NL","Netherlands (Kingdom of the)"
"24519680","24575999","HK","Hong Kong"
"24576000","24641535","CN","China"
"24641536","27262975","AU","Australia"
"27262976","28311551","TW","Taiwan (Province of China)"
"28311552","28442623","KR","Korea (the Republic of)"
"28442624","28443135","US","United States of America"
"28443136","28443647","AU","Australia"
"28443648","28450815","US","United States of America"
"28450816","28454911","BR","Brazil"
"28454912","28459007","AR","Argentina"
"28459008","28459519","US","United States of America"
"28459520","28460031","AU","Australia"
"28460032","28463103","US","United States of America"
"28463104","28463359","AU","Australia"
"28463360","28463615","US","United States of America"
"28463616","28464639","AU","Australia"
"28464640","28467199","US","United States of America"
"28467200","28468223","AU","Australia"
"28468224","28471295","US","United States of America"
"28471296","28479487","PS","Palestine, State of"
"28479488","28487423","US","United States of America"
"28487424","28488703","AU","Australia"
"28488704","28495871","US","United States of America"
"28495872","28499967","PS","Palestine, State of"
Gennemse generelle vilkår og betingelser for databaselicenser.