XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Static IP address with cloud-init

    Scheduled Pinned Locked Moved Xen Orchestra
    2 Posts 2 Posters 1.7k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      smmilton
      last edited by

      I was unable to get the static IP address configuration to work using the network section of the cloudinit cloud configs. So, I wrote the ifcfg file directly using the #cloud-config section. For example:

      #cloud-config
      write_files:
      - content: |
          # Cloudinit icfg-eth0 file (centos/redhat format)
      
          BOOTPROTO=STATIC
          DEVICE=eth0
          ONBOOT=yes
          TYPE=Ethernet
          USERCTL=no
          IPADDR=192.168.50.50
          NETMASK=255.255.255.0
          GATEWAY=192.168.50.1
          DNS1=8.8.8.8
          DNS2=8.8.4.4
        path: /etc/sysconfig/network-scripts/ifcfg-eth0
      

      Another user had this question in the old forums, and I wanted to post an alternate solution to the echo "long string of config" > file method mentioned there.

      https://xen-orchestra.com/forum/topic/1041/cloud-init-question-for-static-ip-adresse

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Online
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        Hi!

        Have you read https://xen-orchestra.com/docs/cloudinit.html#requirements ?

        1 Reply Last reply Reply Quote 0
        • First post
          Last post