Thursday, March 23, 2017

Adding Static IP to CoreOS host

My lab has machines with 2 network adapters one gets the IP from DHCP and the other is a static address that i usually configured with  /etc/sysconfig/network-scripts.  
CoreOS is a little different.  You put this information in the cloud-config.yaml file



#cloud-config


coreos:
  units:
    - name: 00-eno3.network
      runtime: true
      content: |
        [Match]
        Name=eno3

        [Network]
        DNS=8.8.8.8
        Address=10.0.0.3/24
        Gateway=10.0.0.1



ssh_authorized_keys:

  - "ssh-rsa xxxxx imported-openssh-key"


Now both IPs are assigned at bootup.  CoreOS auto-magically finds the DHCP server on the second NIC and uses the static IP on the eno3 NIC

No comments: