sudo vi /etc/network/interfaces
설정파일을 수정하기 위해 위의 파일로 들어가서
#This file describes the network interfaces available on your system
#and how to activate them. For more information, see interfaces(5).
#The loopback network interface
auto lo
iface lo inet loopback
#The primary network interface
#auto eth0
#iface eth0 inet dhcp
#menual
auto eth0
iface eth0 inet static
address 192.168.0.20
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 168.126.63.1 168.126.63.2 8.8.8.8
☆ dhcp -> static으로 수정하고 직접 ip를 설정해준다 ☆
sudo /etc/init.d/networking restart
설정을 끝낸 다음, 네트워크를 다시 시작
ping -c 5 www.yahoo.co.kr
인터넷이 되는지 확인한다
원래는 static으로 ip를 설정하지 않아도 특정한 파일에 nameserver 8.8.8.8 하면 됐었는데 왜 갑자기 안될까 ㅜ 또 이런일이 일어날까봐 기록해보았다 감사한 포스팅 -
출처: https://webdir.tistory.com/188 [WEBDIR]