본문으로 건너뛰기

IP Lookup

IP 주소의 지리적 위치, ISP, 조직 정보 등을 실시간으로 조회하는 도구입니다. 보안 분석, 네트워크 디버깅, 지역 기반 서비스 개발에 필수!

💡 Common Use Cases

  • Security Analysis: Check suspicious IP addresses
  • Geolocation: Identify user location for content delivery
  • Network Debugging: Verify server locations
  • Access Control: Implement geo-blocking or allowlisting

IP Lookup이란?

IP Lookup은 IP 주소를 기반으로 다음과 같은 정보를 조회하는 서비스입니다:

  • 지리적 위치: 국가, 지역, 도시, 좌표
  • 네트워크 정보: ISP, 조직, AS 번호
  • 시간대: 해당 지역의 타임존
  • 우편번호: 지역 우편번호 (가능한 경우)

주요 기능

1. IP 주소 조회

입력: 8.8.8.8
결과:
- Country: United States (US)
- Region: California
- City: Mountain View
- ISP: Google LLC
- Coordinates: 37.386, -122.084

2. 내 IP 확인

  • 버튼 클릭 한 번으로 현재 접속 중인 IP 주소 조회
  • 공용 IP와 지리적 위치 정보 확인

3. Google Maps 연동

  • IP 위치를 Google Maps에서 바로 확인
  • 정확한 지리적 위치 시각화

언제 사용하나요?

보안 분석

# 의심스러운 접속 로그 분석
2024-01-15 10:23:45 - Login attempt from 203.0.113.45
2024-01-15 10:24:12 - Failed login from 203.0.113.45

# IP Lookup으로 확인
→ 국가: Unknown Region
→ ISP: Suspicious Hosting Provider
→ 결과: 공격 시도로 판단, IP 차단

웹 서비스 지역화

// 사용자 IP 기반 콘텐츠 제공
async function getLocalization(ip) {
const ipInfo = await lookupIP(ip);

if (ipInfo.countryCode === 'KR') {
return { language: 'ko', currency: 'KRW' };
} else if (ipInfo.countryCode === 'US') {
return { language: 'en', currency: 'USD' };
}

return { language: 'en', currency: 'USD' };
}

CDN 최적화

// 사용자와 가장 가까운 CDN 서버 선택
const cdnServers = {
'Asia': 'cdn-asia.example.com',
'Europe': 'cdn-eu.example.com',
'Americas': 'cdn-us.example.com'
};

function selectCDN(ipInfo) {
const continent = ipInfo.region;
return cdnServers[continent] || cdnServers['Americas'];
}

지역 차단/허용

// 특정 국가만 접근 허용
const allowedCountries = ['KR', 'US', 'JP'];

function checkAccess(ipInfo) {
if (!allowedCountries.includes(ipInfo.countryCode)) {
return { allowed: false, message: 'Service not available in your region' };
}
return { allowed: true };
}

실제 사용 예시

1. 웹 서버 로그 분석

액세스 로그:

192.0.2.1 - [15/Jan/2024:10:30:45] "GET /admin" 403
198.51.100.42 - [15/Jan/2024:10:35:12] "POST /login" 401
203.0.113.15 - [15/Jan/2024:10:40:22] "GET /api/data" 200

IP Lookup 결과:

  • 192.0.2.1: 테스트 네트워크 (문서용 IP)
  • 198.51.100.42: 의심스러운 지역, VPN 서비스 ISP
  • 203.0.113.15: 정상 사용자, 회사 ISP

2. 사기 방지 시스템

async function detectFraud(transaction) {
const ipInfo = await lookupIP(transaction.ip);
const billingCountry = transaction.billingCountry;

// IP 위치와 결제 국가가 다른 경우
if (ipInfo.countryCode !== billingCountry) {
return {
risk: 'HIGH',
reason: 'IP location mismatch with billing country',
ipCountry: ipInfo.country,
billingCountry: billingCountry
};
}

// VPN/프록시 감지
if (ipInfo.isp.includes('VPN') || ipInfo.isp.includes('Proxy')) {
return {
risk: 'MEDIUM',
reason: 'VPN or Proxy detected'
};
}

return { risk: 'LOW' };
}

3. 분산 서비스 라우팅

// 지역별 서버 라우팅
const regionalServers = {
'Asia': {
'KR': 'api-kr.example.com',
'JP': 'api-jp.example.com',
'default': 'api-asia.example.com'
},
'Europe': {
'GB': 'api-uk.example.com',
'DE': 'api-de.example.com',
'default': 'api-eu.example.com'
},
'Americas': {
'US': 'api-us.example.com',
'BR': 'api-br.example.com',
'default': 'api-us.example.com'
}
};

function routeToServer(ipInfo) {
const region = getRegion(ipInfo.countryCode);
const servers = regionalServers[region];

return servers[ipInfo.countryCode] || servers['default'];
}

4. 광고 타게팅

// 지역 기반 광고 선택
async function selectAd(userIP) {
const ipInfo = await lookupIP(userIP);

const adCampaigns = {
'KR': {
language: 'ko',
currency: 'KRW',
promotions: ['local-delivery', 'korean-payment']
},
'US': {
language: 'en',
currency: 'USD',
promotions: ['free-shipping', 'black-friday']
}
};

return adCampaigns[ipInfo.countryCode] || adCampaigns['US'];
}

IP 주소 유형

IPv4

예시: 192.168.1.1
형식: xxx.xxx.xxx.xxx (0-255)
총 개수: 약 43억 개

IPv6

예시: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
형식: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx (16진수)
총 개수: 약 340언데실리언 개

공인 IP vs 사설 IP

사설 IP 대역 (조회 불가):

10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

공인 IP:

  • 인터넷에서 직접 라우팅 가능
  • ISP가 할당
  • IP Lookup으로 조회 가능

조회 가능한 정보

기본 정보

필드설명예시
IP Address조회한 IP 주소8.8.8.8
Country국가명 및 코드United States (US)
Region지역/주California (CA)
City도시Mountain View
ZIP Code우편번호94043
Timezone시간대America/Los_Angeles

네트워크 정보

필드설명예시
ISP인터넷 서비스 제공자Google LLC
Organization조직명Google Public DNS
AS자율 시스템 번호AS15169 Google LLC

위치 정보

필드설명예시
Latitude위도37.386
Longitude경도-122.084
Map LinkGoogle Maps 링크클릭하여 지도에서 확인

사용 팁

1. 보안 모니터링

# 실시간 로그 모니터링
tail -f /var/log/nginx/access.log | while read line; do
ip=$(echo $line | awk '{print $1}')
# IP Lookup API 사용
curl "http://ip-api.com/json/$ip"
done

2. IP 화이트리스트/블랙리스트

// 특정 국가 차단
const blockedCountries = ['XX', 'YY'];

async function checkIPAccess(ip) {
const ipInfo = await lookupIP(ip);

if (blockedCountries.includes(ipInfo.countryCode)) {
return { allowed: false, reason: 'Country blocked' };
}

return { allowed: true };
}

3. 개인정보 고려사항

// IP 주소 로깅 시 마스킹
function maskIP(ip) {
const parts = ip.split('.');
parts[3] = 'xxx'; // 마지막 옥텟 마스킹
return parts.join('.');
}

// 예: 192.168.1.100 → 192.168.1.xxx

4. 캐싱 전략

// IP 정보는 자주 변하지 않으므로 캐싱
const ipCache = new Map();
const CACHE_TTL = 24 * 60 * 60 * 1000; // 24시간

async function lookupIPWithCache(ip) {
const cached = ipCache.get(ip);

if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
return cached.data;
}

const data = await lookupIP(ip);
ipCache.set(ip, { data, timestamp: Date.now() });

return data;
}

주의사항

API 제한

  • 무료 API는 분당 요청 제한이 있습니다
  • 대량 조회 시 유료 API 고려
  • 캐싱으로 불필요한 요청 줄이기

정확도

  • IP 위치는 근사값입니다 (도시 수준)
  • VPN/프록시 사용 시 실제 위치와 다를 수 있음
  • 모바일 네트워크는 정확도가 낮을 수 있음

개인정보 보호

  • IP 주소는 개인정보로 간주될 수 있음
  • GDPR, 개인정보보호법 준수 필요
  • 로그 보관 시 마스킹 또는 익명화 고려

동적 IP

  • 가정용 인터넷은 대부분 동적 IP
  • 시간이 지나면 IP가 변경될 수 있음
  • 장기 추적에는 적합하지 않음

일반적인 사용 사례

1. 웹사이트 분석

// 방문자 국가별 통계
const visitorStats = {
'KR': 1240,
'US': 856,
'JP': 432,
'CN': 289
};

// 지역별 맞춤 콘텐츠 제공

2. E-commerce

// 배송 가능 지역 확인
async function checkShippingAvailability(ip) {
const ipInfo = await lookupIP(ip);
const shippingCountries = ['KR', 'US', 'JP', 'CN'];

return shippingCountries.includes(ipInfo.countryCode);
}

3. 스트리밍 서비스

// 지역별 콘텐츠 라이선스 확인
async function checkContentLicense(ip, contentId) {
const ipInfo = await lookupIP(ip);
const content = await getContent(contentId);

if (content.allowedCountries.includes(ipInfo.countryCode)) {
return { allowed: true };
}

return {
allowed: false,
message: 'Content not available in your region'
};
}

4. 네트워크 문제 진단

# 트레이서라우트 결과와 함께 IP 정보 확인
traceroute google.com
# 각 홉의 IP를 Lookup하여 라우팅 경로 파악

트러블슈팅

IP 정보가 조회되지 않음

  1. 사설 IP 주소: 공인 IP만 조회 가능
  2. 잘못된 형식: IPv4/IPv6 형식 확인
  3. API 제한: 요청 한도 초과 여부 확인

위치 정보가 부정확함

  • IP 블록 할당 위치 기준이므로 근사값
  • VPN/프록시 사용 시 서버 위치 표시
  • 모바일 네트워크는 정확도가 낮음

빈 정보 필드

  • ZIP Code: 모든 지역에서 제공되지 않음
  • Organization: ISP 정보만 있을 수 있음
  • 최신 IP 블록은 정보가 불완전할 수 있음

관련 도구

추가 리소스

베스트 프랙티스

1. 캐싱 활용

// Redis 캐싱 예시
async function lookupIPCached(ip) {
const cacheKey = `ip:${ip}`;
const cached = await redis.get(cacheKey);

if (cached) {
return JSON.parse(cached);
}

const data = await lookupIP(ip);
await redis.setex(cacheKey, 86400, JSON.stringify(data)); // 24시간

return data;
}

2. 에러 핸들링

async function safeLookupIP(ip) {
try {
const data = await lookupIP(ip);
return { success: true, data };
} catch (error) {
console.error(`IP lookup failed for ${ip}:`, error);
return {
success: false,
error: error.message,
data: null
};
}
}

3. Rate Limiting

const rateLimit = new Map();

async function lookupIPWithRateLimit(ip) {
const now = Date.now();
const lastRequest = rateLimit.get(ip) || 0;

if (now - lastRequest < 1000) { // 1초에 1번
throw new Error('Rate limit exceeded');
}

rateLimit.set(ip, now);
return await lookupIP(ip);
}

4. 개인정보 보호

// IP 주소 해싱으로 저장
const crypto = require('crypto');

function hashIP(ip) {
return crypto
.createHash('sha256')
.update(ip + 'secret-salt')
.digest('hex')
.substring(0, 16);
}

// 통계 목적으로 해시값만 저장