CoreOS Static IP Address
CoreOS static IP address configuration it is quite straight forward even though when we build a CoreOS cluster, DHCP should always be the standard setup. CoreOS has been cleverly designed to discover all new nodes that are joining in the same the network – with some extra configuration – but, in some cases, for various reasons, DHCP may not be an option and that is why in this short tutorial we will be showing you how to set up a static IP address on CoreOS by using a basic example. The solution for setting up a static IP is not complex at all, just a 2 minutes task and we are good to go. Long story short, all we need to do is just to create a file where we define all our network settings, once we have these in place we just need to restart the network service, which in this particular case is systemd-networkd.
Table of contents
CoreOS Network Configuration
Create a static.network file
Restart systemd-networkd service
CoreOS Network Configuration
The default CoreOS network configuration location is within /etc/systemd/network
folder, so let’s begin this short tutorial by opening a new terminal window and connect to our CoreOS server, once authenticated we should change the working directory as shown in the example below:
cd /etc/systemd/network/
Create a static.network file
Now, using our preferred text editor for Linux, we have to create a file name called static.network
, this is the main file that we will be using in order to define our network configuration. In this example we will be using vi
text editor but please feel free to use any other text editor that you are comfortable with:
vi static.network
Having static.network
file open we can now start to define our basic networking settings like shown in the example below, just make sure to replace all values with the right ones for your specific case.
[Match]
Name=ens192
[Network]
Address=10.0.0.5/24
Gateway=10.0.0.254
DNS=8.8.8.8
If everything looks good to you then just save and close the file as we will be moving to our last step with our CoreOS static IP address tutorial.
Restart systemd-networkd service
Restarting systemd-networkd
it is indeed our very last step with this short tutorial, so on our terminal window let’s use the next command in order to restart CoreOS network service:
systemctl restart systemd-networkd
That was all, our short tutorial ends here, we have managed to quickly configure CoreOS using a static IP address, using minimum required settings, in less than 2 minutes.