로컬 도메인 / 내부 네트워크 방법 / hosts 파일 사용

.

C:\Windows\System32\drivers\etc

.

hosts 파일 위치
hosts 파일 위치

.

IPv4 주소
IPv4 주소

.

hosts 파일 백업
hosts 파일 백업

.

메모장 관리자 권한 실행
메모장 관리자 권한 실행

.

hosts 파일 내부 IP 설정
hosts 파일 내부 IP 설정

.

<!doctype html>
<html lang="ko">
<meta charset="utf-8">
<title>URL & IP</title>
<pre id="out">Loading...</pre>
<script>
(async () => {
  const o = {};
  // URL 정보
  o.href     = location.href;
  o.origin   = location.origin;
  o.protocol = location.protocol;
  o.host     = location.host;
  o.hostname = location.hostname;
  o.port     = location.port || "(default)";
  o.pathname = location.pathname;
  o.search   = location.search || "(none)";
  o.hash     = location.hash   || "(none)";

  // 공인 IP (IPv4/IPv6 시도)
  async function getJSON(u){ try{ const r=await fetch(u); if(!r.ok) throw 0; return r.json(); }catch(e){ return null; } }
  const v6 = await getJSON("https://api64.ipify.org?format=json");
  const v4 = await getJSON("https://api.ipify.org?format=json");

  o.public_ipv6 = v6 && v6.ip ? v6.ip : "(unavailable)";
  o.public_ipv4 = v4 && v4.ip ? v4.ip : "(unavailable)";

  // 출력
  const lines = Object.entries(o).map(([k,v]) => `${k}: ${v}`);
  document.getElementById("out").textContent = lines.join("\n");
})();
</script>
</html><!doctype html>
<html lang="ko">
<meta charset="utf-8">
<title>URL & IP</title>
<pre id="out">Loading...</pre>
<script>
(async () => {
  const o = {};
  // URL 정보
  o.href     = location.href;
  o.origin   = location.origin;
  o.protocol = location.protocol;
  o.host     = location.host;
  o.hostname = location.hostname;
  o.port     = location.port || "(default)";
  o.pathname = location.pathname;
  o.search   = location.search || "(none)";
  o.hash     = location.hash   || "(none)";

  // 공인 IP (IPv4/IPv6 시도)
  async function getJSON(u){ try{ const r=await fetch(u); if(!r.ok) throw 0; return r.json(); }catch(e){ return null; } }
  const v6 = await getJSON("https://api64.ipify.org?format=json");
  const v4 = await getJSON("https://api.ipify.org?format=json");

  o.public_ipv6 = v6 && v6.ip ? v6.ip : "(unavailable)";
  o.public_ipv4 = v4 && v4.ip ? v4.ip : "(unavailable)";

  // 출력
  const lines = Object.entries(o).map(([k,v]) => `${k}: ${v}`);
  document.getElementById("out").textContent = lines.join("\n");
})();
</script>
<body>

</div>
</html>

.

로컬 도메인 내부 네트워크 테스트
로컬 도메인 내부 네트워크 테스트

.

댓글