안경잡이개발자

728x90
반응형

우분투(Ubuntu) 서버(Server) OS의 IP를 변경하기 위해서는 /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 enp3s0
iface enp3s0 inet static
        address {사용할 IP 주소}
        netmask {네트워크 마스크 주소}
        gateway {게이트웨이 주소}
        dns-nameservers {사용할 DNS 서버 주소 1} {사용할 DNS 서버 주소 2}

 

설정을 변경한 뒤에는 다음과 같이 네트워크 서비스(service)를 재시작하여 변경된 네트워크 설정을 반영한다.

 

systemctl restart networking.service

 

이후에 ifconfig 명령어를 이용하여 아이피(IP)가 변경되었는지 확인한다. 만약 변경되지 않았다면 재부팅을 진행한 뒤에 다시 확인해보자.

 

[ 참고 ]

 

고정 IP 설정을 위해서는 /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 enp3s0
iface enp3s0 inet dhcp

 

728x90
반응형