본문 바로가기

리눅스 관련

우분투 아이피 설정(Ubuntu 16.04 Network Static IP)

반응형

우분투 16.04기준입니다.

자동으로 설정되어있는 IP동작이 되지 않아 수동으로 바꿀때 아래를 참조하세요.

 Network관련  Config파일을 수정해야합니다. 위치는 /etc/network/interfaces입니다.

ip=192.168.8.68 예제

vi로 Config를 수정하면 되고, 네트워트 설정 파일 위치와 내용은 아래와 같습니다.

($ sudo vi /etc/network/interfaces)

 /etc/network/interfaces
# This file describes the network interfaces available on your system 
# and how to activate them. For more information, see interfaces(5). 
source /etc/network/interfaces.d/* 
# The loopback network interface 
auto lo 
iface lo inet loopback 



# The primary network interface 
auto enp3s11 
iface enp3s11 inet dhcp

마지막 라인을 주석(#)처리하고 아래처럼 수동 아이피 설정을 진행합니다.

iface옆의 enp3s11은 network interface이름으로 아래 예제와 다를 수있습니다. 기존에 적혀있는 interface이름을 사용하세요(ex. iface ens160 inet dhcp인경우 ens160을 사용)

( :wq로 저장하고 vi종료)

# This file describes the network interfaces available on your system 
# and how to activate them. For more information, see interfaces(5). 
source /etc/network/interfaces.d/* 
# The loopback network interface 
auto lo 
iface lo inet loopback 

# The primary network interface
auto enp3s11
#iface enp3s11 inet dhcp
iface enp3s11 inet static

address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 210.220.163.82

네트워크 서비스를 재시작하면 되는데, 안되는 경우 reboot을 해야 적용이 됩니다.

($ sudo service networking restart)

 

ifconfig로 변경된 ip를 확인합니다.

$ ifconfig
enp3s11   Link encap:Ethernet  HWaddr --:--:--:--:--:-- 
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          ...

 

반응형