collins icon indicating copy to clipboard operation
collins copied to clipboard

Clarify gateway (re)configuration (Specified Gateway vs Gateway)

Open discordianfish opened this issue 10 years ago • 4 comments

Hi,

I use collins IPAM features as a source for network configuration. I haven't specified a gateway so far since collins uses the first IP in the network which is exactly what I wanted. But now I want to make a collins managed IP the default gateway. Even though http://tumblr.github.io/collins/configuration.html#ipam says:

gateway Option[String]  If the gateway is not in the network range, specify it here

I can also specify a gateway within the network range (that's actually the only way that could work) and once I restart collins I see the new gateway under "Specified Gateway" in collins-shell ip_address pools, but not under "Gateway" (which might be expected).

If I now get the addresses for a given assets (api/asset//addresses) it only contains the old gateway. I assume I need to remote and reallocate an IP to make that work? All that isn't documented and not necessarily what you would expect. I would argue that a default gw may change during the life time of an asset, so imo it should be possible to change it.

discordianfish avatar Oct 01 '14 16:10 discordianfish

@byxorna thoughts?

yl3w avatar Oct 06 '14 01:10 yl3w

@discordianfish so when you allocate an IP from a pool in Collins, an entry is added to the ip_addresses table with ip address, gateway, and netmask. They are stored directly in that table (i.e. no reference to the gateway of the pool the address came from) so changing the gateway on the pool will not change the gateway on any allocated addresses. You are correct, the gateway on an address can definitely change over the lifetime of the asset. We provide http://tumblr.github.io/collins/api.html#ipam (specifically POST /api/asset/:tag/address) in order to update any existing addresses to use the new gateway after you change the pool's gateway. You could also use GET /api/assets/with/addresses/in/:pool if you wanted to update the gateway on all assets in the pool.

Let me know if you have any questions about this. Thanks!

byxorna avatar Oct 06 '14 13:10 byxorna

@byxorna Got it! I would still suggest adding that to the docs and especially fix "If the gateway is not in the network range, specify it here". It should be more something like "Specify gateway, defaults to first IP in network".

discordianfish avatar Oct 06 '14 17:10 discordianfish

@discordianfish np, sounds like a plan. If you have any specific wording you would like to see, PRs are welcome :). If not, @Primer42 do you have bandwidth to make this small change in documentation?

byxorna avatar Oct 06 '14 18:10 byxorna