Categories
Computer Network

우분투 20.04 에서 네트워크 설정하기 (고정 IP 주소, 자동할당 IP 주소)

우분투 20.04 에서 네크워크 설정 파일은 /etc/netplan 디렉토리에 저장되어 있다. 네트워크 설정 파일의 확장자는 .yaml 이다.

우분투 20.04를 새로 설치했을 때 디폴트로 만들어지는 네트워크 설정 파일은 /etc/netplan/00-installer-config.yaml 이다. 이 파일을 편집하여 네트워크 설정을 변경할 수 있다.

sudo vi /etc/netplan/00-installer-config.yaml

고정 IP 주소 세팅하기

/etc/netplan/00-installer-config.yaml 파일의 내용:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: false
      addresses:
      - 192.168.0.101/24
      gateway4: 192.168.0.1
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4

파일을 편집하고 저장을 마쳤으면 아래 명령으로 변경 사항을 시스템에 적용한다.

sudo netplan apply

DHCP 서버를 통한 IP 주소 자동 할당

/etc/netplan/00-installer-config.yaml 파일에서 dhcp4: 부분을 true 로 바꾼다. addresses: 부분, gateway4: 부분, nameservers: 부분은 삭제한다.

/etc/netplan/00-installer-config.yaml 파일의 내용:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: true

11 replies on “우분투 20.04 에서 네트워크 설정하기 (고정 IP 주소, 자동할당 IP 주소)”

I’m really enjoying the design and layout of your site.
It’s a very easy on the eyes which makes it much more enjoyable
for me to come here and visit more often. Did you hire out
a designer to create your theme? Fantastic work!

Leave a Reply

Your email address will not be published. Required fields are marked *