Ubuntu24.04单网卡配置多IP

原始配置:

root@Hanmber-Movble:/etc/netplan# cat 90-NM-f844b322-4a67-3574-bc41-771c12a6ba7f.yaml
network:
  version: 2
  ethernets:
    NM-f844b322-4a67-3574-bc41-771c12a6ba7f:
      renderer: NetworkManager
      match:
        name: "enp2s0"
      addresses:
      - "192.168.1.231/24"
      nameservers:
        addresses:
        - 192.168.1.1
      dhcp6: true
      ipv6-address-generation: "stable-privacy"
      wakeonlan: true
      networkmanager:
        uuid: "f844b322-4a67-3574-bc41-771c12a6ba7f"
        name: "有线连接 1"
        passthrough:
          connection.autoconnect-priority: "-999"
          connection.timestamp: "1737422035"
          ethernet._: ""
          ipv4.address1: "192.168.1.231/24,192.168.1.1"
          ipv4.method: "manual"
          ipv6.ip6-privacy: "-1"
          proxy._: ""

修改配置:
直接在添加IP的地方添加即可。

network:
  version: 2
  ethernets:
    NM-f844b322-4a67-3574-bc41-771c12a6ba7f:
      renderer: NetworkManager
      match:
        name: "enp2s0"
      addresses:
      - "192.168.1.231/24"
      - "99.0.0.122/24"
      - "192.168.100.122/24"
      nameservers:
        addresses:
        - 192.168.1.1
      dhcp6: true
      ipv6-address-generation: "stable-privacy"
      wakeonlan: true
      networkmanager:
        uuid: "f844b322-4a67-3574-bc41-771c12a6ba7f"
        name: "有线连接 1"
        passthrough:
          connection.autoconnect-priority: "-999"
          connection.timestamp: "1737422035"
          ethernet._: ""
          ipv4.address1: "192.168.1.231/24,192.168.1.1"
          ipv4.method: "manual"
          ipv6.ip6-privacy: "-1"
          proxy._: ""

发表回复

登录... 后才能评论