Ubuntu Server 20.04, Ubuntu Server 18.04
- 네트워크 설정 파일은 /etc/netplan 디렉토리 안에 있는 yaml 파일입니다.
- DHCP로 설치했다면, 설정 파일 내용은 다음과 비슷하게 되어 있습니다.
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: true
version: 2
- 다음과 같이 수정하고 저장합니다. IP 등은 네트워크 환경에 맞게 적절히 수정합니다.
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
addresses: [192.168.0.136/24]
gateway4: 192.168.0.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
version: 2
- 다음과 같이 명령하면 설정 변경 사항이 적용됩니다.
netplan apply
Ubuntu Server 16.04
- 네트워크 설정 파일은 /etc/network/interfaces입니다.
- 우분투를 유동 IP로 설치했다면 설정 파일의 내용은 다음과 비슷하게 되어 있습니다.
# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp
- 이를 다음처럼 변경하고 저장합니다. xxx.xxx.xxx.xxx는 네트워크 환경에 맞게 수정합니다.
# The primary network interface
auto enp0s3
iface enp0s3 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
dns-nameservers xxx.xxx.xxx.xxx
- 다음과 같이 명령하여 네트워크를 재시작합니다.
systemctl restart networking.service
- 만약 위와 같이 해도 IP가 바뀌지 않는다면 재부팅합니다.