How to allocate an ip address
We currently use very different mechanisms to allocate IPv6 addresses compared to IPv4 addresses.
NOTE: The historical ip-temp
process on hay.mayfirst.org
is no longer in use!
Steps for allocating an IPv4 address
Now, we allocate an IP and create the iterface in the same step.
Find an available IP
Run:
freepuppet-helper ai | sort
To get a list of currently allocated IPs
Then, pick the next one in the range you want and edit the .pp file for the server in question and add the following
Sample for physical host
class { "mayfirst::m_interface": } mayfirst::m_interface::set { "209.234.253.26/27": dev => "br0", gateway => "209.234.253.1", hwaddress => "00:26:b9:35:c1:eb", bridge_ports => "eth0" }
Sample for canonical IP address on guest
class { "mayfirst::m_interface": } mayfirst::m_interface::set { "209.51.172.13/28": gateway => "209.51.172.1" }
Sample for additional IP on guest
mayfirst::m_interface::set { "209.51.180.27/28": label => "smtp" }
Steps for allocating an IPv6 address
The IPv6 process is much more manual, and not directly managed by puppet.
find a free IPv6 address
first, list all claimed IPv6 addresses by searching in :
0 mfpl-puppet$ git grep 'gateway.*->.*:' manifests/nodes/production/che.pp:# mayfirst::m_interface::set { "2001:470:1:116::7/64": gateway => "2001:470:1:116::1" } 0 mfpl-puppet$
Note that the lines are commented out (with a #
). this is as intended, they're still allocations, because puppet isn't dealing with IPv6 at all yet.
Then choose a free one.
assign it to the host manually
place the appropriate stanza in a new file in /etc/network/interfaces.d/
on hosts that use ifupdown
, or in a /etc/systemd/network/*.network
file on hosts that use systemd-networkd
claim it in puppet
remember to add a commented line in the appropriate puppet production file corresponding to the host!