Manage traffic filtering (port security)
To assign a security group to a port, you must first enable port security. You can enable network traffic filtering or on a separate port.
Enable network traffic filtering
We do not recommend that you enable traffic filtering on existing networks where you are running load balancer or cluster databases This can lead to balancer failures and disrupt cloud database replication. Create a new private network or public subnet and enable network-level traffic filtering in it.
Enabling traffic filtering on a network will not affect its existing ports — if filtering has been disabled on a port, it will not be enabled. On existing ports, you must enable traffic filtering separately for each port.
If traffic filtering is enabled at the network level, all new ports on the network will by default be created with filtering enabled and default security group. You can assign a different security group when creating a port.
OpenStack CLI
-
Enable network traffic filtering:
openstack network set \
--enable-port-security \
<network>Specify
<network>
— ID or network name, can be viewed with the commandopenstack network list
.
Enable traffic filtering on a port
OpenStack CLI
-
Enable traffic filtering for the port:
openstack port set \
--security-group <security_group> \
--enable-port-security \
<port>Specify:
<security_group>
— ID or security group name, can be viewed using the commandopenstack security group list
. If you do not assign a group, all port traffic will be blocked;<port>
— ID or port name, can be viewed with the commandopenstack port list
.
Turn off network traffic filtering
Turning off traffic filtering on a network will not affect its existing ports — if filtering has been enabled on a port, it will not be turned off. On existing ports, you must disable traffic filtering separately for each port. New ports on the network will be created with filtering disabled by default.
OpenStack CLI
-
Turn off traffic filtering for the network:
openstack network set \
--disable-port-security \
<network>Specify
<network>
— ID or network name, can be viewed with the commandopenstack network list
.
Disable traffic filtering on a port
Before disabling traffic filtering on a port, you must remove all security groups from the port.
OpenStack CLI
-
Remove the security groups from the port:
openstack port set \
--no-security-group
<port>Specify
<port>
— ID or port name, can be viewed with the commandopenstack port list
. -
Disable traffic filtering for the port:
openstack port set \
--disable-port-security \
<port>Specify
<port>
— ID or port name, can be viewed with the commandopenstack port list
.