안녕세계

[Linux] hosts 파일 본문

[Linux] hosts 파일

Junhong Kim 2018. 4. 2. 16:22
728x90
반응형

브라우저가 도메인에 해당하는 IP를 찾는 순서

1. Local cache

2. hosts file

hosts 수정

# Unix $ /etc/hosts # Mac OSX $ /private/etc/hosts $ dscacheutil /flushcache # (or /etc/hosts, since /etc is a symbolic link to /private/etc) # Windows $ /Windows/system32/drivers/etc/hosts $ ipcinfig /renew # (or %SystemRoot%/system32/drivers/etc/hosts)

hosts 내용

hosts 설정후 브라우저에서 test.domain.com 으로 접속하면 로컬 서버(127.0.0.1)로 접속된다.

## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost 127.0.0.1 test.domain.com # [ip address] [domain name]

3. DNS(Domain Name Server)

[참고]
https://opentutorials.org/course/228/1457
https://en.wikipedia.org/wiki/Hosts_(file)

728x90
반응형
Comments