๐ŸŒ ๋„คํŠธ์›Œํฌ์™€ ์†Œ์ผ“ ์ดํ•ด

๐ŸŒ ๋„คํŠธ์›Œํฌ์™€ ์†Œ์ผ“ ์ดํ•ด

๐Ÿ“ก DNS( Domain Name System)

DNS ๋˜๋Š” Domain Name System์€ ์‚ฌ๋žŒ์ด ์ฝ์„ ์ˆ˜ ์žˆ๋Š” ๋„๋ฉ”์ธ ์ด๋ฆ„์„ ๋จธ์‹ ์ด ์ฝ์„ ์ˆ˜ ์žˆ๋Š” IP ์ฃผ์†Œ(์˜ˆ: 192.0.2.44)๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

# nslookup (/usr/bin/nslookup)
- ๋„๋ฉ”์ธ ๋„ค์ž„ ์„œ๋ฒ„์˜ ์ •๋ณด๋ฅผ ์ฟผ๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ.

๐Ÿ“ InetAddress

This class represents an Internet Protocol (IP) address.

Method description
static InetAddress getLocalHost() ๋กœ์ปฌํ˜ธ์ŠคํŠธ์˜ ์ฃผ์†Œ ๋ฐ˜ํ™˜
getHostName() ํ˜ธ์ŠคํŠธ ์ด๋ฆ„์„ ๋ฌธ์ž์—ด๋กœ ๋ฐ˜ํ™˜
getHostAddress() ํ˜ธ์ŠคํŠธ IP ๋ฐ˜ํ™˜
getAddress() InetAddress ๊ฐ์ฒด์˜ IP์ฃผ์†Œ๋ฅผ ๋ฐ˜ํ™˜

๐Ÿ’ป NSLookup in JAVA

  1. Scanner์™€ nextLine()์„ ๋„๋ฉ”์ธ์„ ์ž…๋ ฅ๋ฐ›๋Š”๋‹ค.
  2. ์ž…๋ ฅ๋ฐ›์€ ๋„๋ฉ”์ธ์˜ IP์ฃผ์†Œ๋ฅผ ์ถœ๋ ฅ.
  3. “exit"์ผ ๊ฒฝ์šฐ ํ”„๋กœ๊ทธ๋žจ ์ข…๋ฃŒ.
  4. InetAddress์˜ static ๋ฉ”์„œ๋“œ getAllByName(String host)๋ฅผ ์‚ฌ์šฉ.
  • getAllByName() : “www.google.com” ๊ฐ™์€ ํ˜ธ์ŠคํŠธ๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ ํ•ด๋‹น ์ฃผ์†Œ์—์„œ ๋ชจ๋“  IP๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋ฉ”์„œ๋“œ