우분투 16.04 부터 네트워크 설정이 netplan 으로 설정하도록 바뀜

netplan 으로 default route 를 1개로 지정하는 방법



문제 - default route 가 2개 등록되어 전송성능이 저하됨

$ sudo ip route
default via 172.16.0.1 dev eno1 proto static
default via 192.168.0.1 dev eno2 proto static
...


해결 - default route 를 1개만 등록

/etc/netplan/00-installer-config.yaml
network:
  ethernets:
# Network A - Default Route
    eno1:
      dhcp4: false
      addresses:
          - 172.16.0.20/24
      gateway4: 172.16.0.1
      nameservers:
          addresses: [8.8.8.8, 8.8.4.4]
# Network B
    eno2:
      dhcp4: false
      addresses:
          - 192.168.0.10/24
      # gateway4: 192.168.0.1 # important - disable default gateway for Network B
      routes:
          # route for internal (if needed)
          - to: 192.168.0.10/24
            via: 192.168.0.1
            metric: 0
  version: 2


$ sudo ip route
default via 172.16.0.1 dev eno1 proto static
192.168.0.10/24 dev eno2 proto kernel scope link src 192.168.0.1
...


  • 레이블 없음