linux

ubuntu 18.04- netplan (network)설정

sysman 2021. 3. 18. 16:53

ubuntu 18.04 LTS 부터 netplan으로 네트워크 설정방식이 변경

 

$ ls /sys/class/net
ens160  lo

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

network:

    ethernets:

        ens160:

            addresses: 

            - x.x.x.173/24

            gateway4: x.x.x.254

            nameservers:

              addresses:

              - 168.126.63.1

              #  search: [lesstif.com]

              #            dhcp4: yes

            dhcp4: no

#            optional: true

    version: 2

 

-----------------또는------------------------

network:

    ethernets:

        enp0s31f6:

            addresses: [x.x.x.14/24]

            gateway4: x.x.x.1

            nameservers:

              addresses: [168.126.63.1,8.8.8.8]

              #  search: [lesstif.com]

              #            dhcp4: yes

            dhcp4: no

#            optional: true

    version: 2

:wq!

--------------------------------------

 

 

$sudo netplan apply

$ifconfig

 

$ cat /etc/netplan/00-installer-config.yaml

# This is the network config written by 'subiquity'

network:

  ethernets:

    ens160:

      addresses:

      - x.x.x.172/24

      gateway4: x.x.x.254

      nameservers:

        addresses:

        - 168.126.63.1

  version: 2