I found a similar question from 2014, How to give a Juju charm a static ip address - wordpress, but the answer only says it's not possible, but will be in 15.04, which doesn't help much.

Currently the juju machines are set a IP from DHCP. I would like to set a static IP so that it doesn't change; do I just SSH into the machine and modify the /etc/network/interfaces?

Edit:
I found bionical is using netplan instead of ifupdown, but this "doesn't persist accross instances":
cat /etc/netplan/50-cloud-init.yaml

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        ens192:
            dhcp4: true
            match:
                macaddress: <MAC>
            set-name: ens192

Is there a way to specify it in the bundle?

modifed /etc/netplan/50-cloud-init.yaml (shown below), not sure if this is the right way to do it but communications still work between machines.
juju status shows wrong dns entries/public address for a while but eventually updates.

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        ens192:
            match:
                macaddress: <mac>
            set-name: ens192
            addresses:
              - 192.168.1.10/24
            gateway4: 192.168.1.1
            nameservers:
                search: [<domain>]
                addresses: [192.168.1.2,192.168.1.3]

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.