diff --git a/netbox/ipam/forms/model_forms.py b/netbox/ipam/forms/model_forms.py index cf8117bf7..d85ce7a30 100644 --- a/netbox/ipam/forms/model_forms.py +++ b/netbox/ipam/forms/model_forms.py @@ -350,6 +350,13 @@ class IPAddressForm(TenancyForm, NetBoxModelForm): self.add_error( 'primary_for_parent', "Only IP addresses assigned to an interface can be designated as primary IPs." ) + + # Do not allow assigning a network ID or broadcast address to an interface + if interface: + if self.instance.ip == self.instance.network: + self.add_error('interface', "This address is a network ID, which may not be assigned to an interface.") + if self.instance.ip == self.instance.broadcast: + self.add_error('interface', "This address is a broadcast address, which may not be assigned to an interface.") def save(self, *args, **kwargs): ipaddress = super().save(*args, **kwargs)