1. # This file describes the network interfaces available on your system
    2. # For more information, see netplan(5).
    3. network:
    4. version: 2
    5. renderer: networkd
    6. ethernets:
    7. eth0:
    8. dhcp4: no
    9. eth1:
    10. dhcp4: no
    11. dhcp6: no
    12. optional: true
    13. eth2:
    14. dhcp4: no
    15. dhcp6: no
    16. optional: true
    17. eth3:
    18. dhcp4: no
    19. dhcp6: no
    20. optional: true
    21. vlans:
    22. vlan101:
    23. accept-ra: no
    24. id: 101
    25. link: eth0
    26. vlan102:
    27. accept-ra: no
    28. id: 102
    29. link: eth0
    30. vlan201:
    31. accept-ra: no
    32. id: 201
    33. link: eth0
    34. vlan202:
    35. accept-ra: no
    36. id: 202
    37. link: eth0
    38. bridges:
    39. br0:
    40. interfaces: [vlan101]
    41. dhcp4: no
    42. parameters:
    43. stp: false
    44. forward-delay: 0
    45. br1:
    46. interfaces: [vlan201]
    47. dhcp4: no
    48. parameters:
    49. stp: false
    50. forward-delay: 0
    51. br2:
    52. interfaces: [vlan102]
    53. dhcp4: no
    54. parameters:
    55. stp: false
    56. forward-delay: 0
    57. br3:
    58. interfaces: [vlan202]
    59. dhcp4: no
    60. parameters:
    61. stp: false
    62. forward-delay: 0
    63. bonds:
    64. bond0:
    65. dhcp4: no
    66. dhcp6: no
    67. addresses: [172.28.101.240/24]
    68. gateway4: 172.28.101.254
    69. mtu: 9000
    70. nameservers:
    71. addresses: [223.6.6.6,223.5.5.5]
    72. interfaces:
    73. - eth2
    74. - eth3
    75. parameters:
    76. mode: active-backup

    配置二:

    1. # cat /etc/netplan/01-netcfg.yaml
    2. network:
    3. version: 2
    4. renderer: networkd
    5. ethernets:
    6. enp132s0f0:
    7. dhcp4: no
    8. dhcp6: no
    9. optional: true
    10. eno1:
    11. dhcp4: no
    12. dhcp6: no
    13. optional: true
    14. vlans:
    15. vlan200:
    16. accept-ra: no
    17. id: 200
    18. link: bond0
    19. vlan201:
    20. accept-ra: no
    21. id: 201
    22. link: bond0
    23. vlan202:
    24. accept-ra: no
    25. id: 202
    26. link: bond0
    27. vlan203:
    28. accept-ra: no
    29. id: 203
    30. link: bond0
    31. vlan204:
    32. accept-ra: no
    33. id: 204
    34. link: bond0
    35. bridges:
    36. br0:
    37. interfaces: [bond0]
    38. dhcp4: no
    39. addresses: [10.33.240.211/24]
    40. gateway4: 10.33.240.254
    41. nameservers:
    42. addresses: [223.6.6.6,223.5.5.5]
    43. parameters:
    44. stp: false
    45. forward-delay: 0
    46. br200:
    47. interfaces: [vlan200]
    48. dhcp4: no
    49. parameters:
    50. stp: false
    51. forward-delay: 0
    52. br201:
    53. interfaces: [vlan201]
    54. dhcp4: no
    55. parameters:
    56. stp: false
    57. forward-delay: 0
    58. bonds:
    59. bond0:
    60. dhcp4: no
    61. dhcp6: no
    62. mtu: 9000
    63. interfaces:
    64. - eno1
    65. - enp132s0f0
    66. parameters:
    67. mode: active-backup
    68. # mode: 802.3ad
    69. # lacp-rate: fast
    70. mii-monitor-interval: 100