11.2.6.5. 静态路由

以下片段在接口 eth1 中配置静态路由和静态 IP。

...
    interfaces:
    - name: eth1
      description: Static routing on eth1
      type: ethernet
      state: up
      ipv4:
        address:
        - ip: 192.0.2.251 1
          prefix-length: 24
        enabled: true
    routes:
      config:
      - destination: 198.51.100.0/24
        metric: 150
        next-hop-address: 192.0.2.1 2
        next-hop-interface: eth1
        table-id: 254
...
1
以太网接口的静态 IP 地址。
2
节点流量的下一跳地址。这必须与为以太接口设定的 IP 地址位于同一个子网中。