目次

06 Ubuntu Network設定

bond + bridge

root@dadmhv03:~# cat /etc/netplan/00-installer-config.yaml 
network:
  ethernets:
    enp1s0: {}
    enp2s0: {}
    enp6s0f0: {}
    enp6s0f1: {}
    enp7s0f0: {}
    enp7s0f1: {}
  bonds:
    bond0:
      interfaces:
      - enp1s0
      - enp2s0
      parameters:
        lacp-rate: slow
        mode: 802.3ad
        transmit-hash-policy: layer3+4
    bond1: 
      interfaces:
      - enp7s0f0
      - enp7s0f1
      parameters:
        lacp-rate: slow
        mode: 802.3ad
        transmit-hash-policy: layer3+4
    bond2: 
      interfaces:
      - enp6s0f0
      - enp6s0f1
      parameters:
        lacp-rate: slow
        mode: 802.3ad
        transmit-hash-policy: layer3+4
  vlans:
    vlan.100:
      id: 100
      link: bond1
  bridges:
    br0:
      interfaces:
      - bond0
      addresses:
      - 10.10.0.10/16
      nameservers:
        addresses: []
        search: []
    br1:
      interfaces:
      - vlan.100
      addresses:
        - 100.100.0.10/16
      gateway4: 100.100.255.254
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
    br2:
      interfaces:
      - bond2

  version: 2

ethernetsのみ

# cat /etc/netplan/00-installer-config.yaml
network:
  ethernets:
    eno1:
      addresses:
      - 10.10.0.101/16
      gateway4: 10.10.0.1
      nameservers:
        addresses:
        - 8.8.8.8
  version: 2

bridgeのみ

# cat /etc/netplan/00-installer-config.yaml
network:
  ethernets:
    eno1: {}
  bridge:
    br0:
      interfaces:
      - eno1
      addresses:
      - 10.10.0.101/16
      gateway4: 10.10.0.1
      nameservers:
        addresses:
        - 8.8.8.8
  version: 2

ルーティングを書く場合

# cat /etc/netplan/00-installer-config.yaml
network:
  ethernets:
    eno1:
      addresses:
      - 10.10.0.101/16
      gateway4: 10.10.0.1
      nameservers:
        addresses:
        - 8.8.8.8
      routes:
        - to: 192.168.10.0/24
          via: 10.10.100.1

  version: 2