본문 바로가기
IT/Linux

Ubuntu 18.04 Network Address 수동 설정

by 혁이 2021. 8. 25.
반응형

네트워크 변경 파일

#vi /etc/netplan/50-cloud-init.yaml

 

변경 전

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: true
    version: 2

 

변경 후

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: no
            addresses: [192.168.1.230/24]
            gateway4: 192.168.1.1
            nameservers:
                    addresses: [8.8.8.8]
    version: 2

 

네트워크 재시작

#netplan apply

 

결과 확인

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.230  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::d45e:6cff:fe11:8bf1  prefixlen 64  scopeid 0x20<link>
        ether d6:5e:6c:11:8b:f1  txqueuelen 1000  (Ethernet)
        RX packets 196494  bytes 388557998 (388.5 MB)
        RX errors 0  dropped 11  overruns 0  frame 0
        TX packets 54857  bytes 4037662 (4.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
반응형

'IT > Linux' 카테고리의 다른 글

Docker 명령어로 "Hello world" 출력하기  (0) 2021.08.26
Ubuntu 18.04에 Docker 설치  (0) 2021.08.25
리눅스에 하마치 설치하기  (0) 2017.04.21