nodetool invalidatenetworkpermissionscache
Cassandra 4.1+
This command is available in Cassandra 4.1 and later.
Invalidates the network permissions cache on the node.
Synopsis
Section titled “Synopsis”nodetool [connection_options] invalidatenetworkpermissionscacheSee connection options for connection options.
Description
Section titled “Description”nodetool invalidatenetworkpermissionscache clears all cached network authorization decisions on the node. The network permissions cache stores the results of CIDR-based and network-level access control checks, allowing Cassandra to authorize client connections from specific IP addresses without re-evaluating network rules for every operation.
This cache is specifically for network-layer authorization that determines whether a client from a particular IP address or network range is allowed to connect and perform operations. It works in conjunction with CIDR filtering and network-based role restrictions.
Network Authorization Required
This cache is only relevant when network-based authorization is configured. If CIDR filtering or network permissions are not enabled, this cache is not used.
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool invalidatenetworkpermissionscacheAfter Network Rule Changes
Section titled “After Network Rule Changes”# After modifying network access rulesnodetool invalidatenetworkpermissionscacheNetwork Permissions Cache Overview
Section titled “Network Permissions Cache Overview”What the Cache Stores
Section titled “What the Cache Stores”| Cached Data | Description |
|---|---|
| Client IP address | The source IP of the connection |
| Network authorization result | Whether access is allowed or denied |
| Associated CIDR groups | Which network groups the IP belongs to |
| Role-network mappings | Which roles are allowed from which networks |
How It Improves Performance
Section titled “How It Improves Performance”Without Network Permissions Cache: Connection Attempt → Evaluate CIDR rules → Check role-network mappings → Allow/Deny
With Network Permissions Cache: Connection Attempt → Lookup cached authorization → Allow/Deny (Avoids repeated network rule evaluation)Network Authorization Flow
Section titled “Network Authorization Flow”When to Use
Section titled “When to Use”After CIDR Group Changes
Section titled “After CIDR Group Changes”When CIDR groups are modified:
# Update CIDR groupnodetool updatecidrgroup office_network '192.168.1.0/24,192.168.2.0/24'
# Invalidate network permissions cachenodetool invalidatenetworkpermissionscacheAfter Role-Network Binding Changes
Section titled “After Role-Network Binding Changes”When role access is restricted by network:
# After modifying which networks a role can connect from# (via CQL or configuration)nodetool invalidatenetworkpermissionscacheSecurity Incident Response
Section titled “Security Incident Response”When immediate network access revocation is critical:
#!/bin/bashCIDR_GROUP="$1"
echo "=== Emergency Network Block ==="
# 1. Drop the CIDR groupnodetool dropcidrgroup $CIDR_GROUP
# 2. Invalidate all network-related caches on all nodesfor node in $(nodetool status | grep "^UN" | awk '{print $2}'); do echo "Processing $node..." ssh "$node" "nodetool invalidatenetworkpermissionscache" ssh "$node" "nodetool invalidatecidrpermissionscache"done
echo "Network access revoked for CIDR group: $CIDR_GROUP"Troubleshooting Network Access Issues
Section titled “Troubleshooting Network Access Issues”When clients are unexpectedly allowed or denied:
# Clear cached network authorization decisionsnodetool invalidatenetworkpermissionscache
# Check which CIDR groups contain the client IPnodetool getcidrgroupsofip 10.1.50.100
# Verify CIDR filtering statisticsnodetool cidrfilteringstatsAfter Configuration Changes
Section titled “After Configuration Changes”When network authorization configuration changes:
# After modifying cassandra.yaml network settings# and reloading configurationnodetool invalidatenetworkpermissionscacheImpact Assessment
Section titled “Impact Assessment”Immediate Effects
Section titled “Immediate Effects”| Aspect | Impact |
|---|---|
| Cached network decisions | All cleared |
| Next connections | Require full network rule evaluation |
| Connection latency | Slight increase until cache warms |
| Existing connections | Not affected |
Security Effects
Section titled “Security Effects”| Scenario | Behavior |
|---|---|
| CIDR group removed | IP immediately blocked |
| New CIDR group added | IP immediately allowed |
| Role-network binding changed | Takes effect immediately |
Recovery Timeline
Section titled “Recovery Timeline”| Phase | Duration | Cache State |
|---|---|---|
| Immediately after | 0 | Empty |
| First connections | Milliseconds | Being populated |
| Normal operations | Seconds | Active IPs cached |
Minimal Performance Impact
Network permission cache invalidation typically has minimal impact since network rule evaluation is fast and the cache repopulates quickly with active connections.
Configuration
Section titled “Configuration”Related Settings
Section titled “Related Settings”# cassandra.yaml - Network authorization related settings
# CIDR authorizer (if using CIDR-based access control)cidr_authorizer: CassandraCIDRAuthorizer
# Network permissions cache settings (when available)network_permissions_validity_in_ms: 2000network_permissions_update_interval_in_ms: 1000network_permissions_cache_max_entries: 1000Cluster-Wide Operations
Section titled “Cluster-Wide Operations”Invalidate on All Nodes
Section titled “Invalidate on All Nodes”For network permission changes to take effect cluster-wide:
#!/bin/bashecho "Invalidating network permissions cache cluster-wide..."# Get list of node IPs from local nodetool status
nodes=$(nodetool status | grep "^UN" | awk '{print $2}')
for node in $nodes; do echo -n "$node: " ssh "$node" "nodetool invalidatenetworkpermissionscache 2>/dev/null && echo "invalidated" || echo "FAILED""done
echo "Network permissions cache cleared on all nodes."Combined Network Cache Refresh
Section titled “Combined Network Cache Refresh”Clear all network-related caches:
#!/bin/bashecho "Refreshing all network authorization caches cluster-wide..."# Get list of node IPs from local nodetool status
nodes=$(nodetool status | grep "^UN" | awk '{print $2}')
for node in $nodes; do echo "Processing $node..." ssh "$node" "nodetool invalidatenetworkpermissionscache 2>/dev/null" ssh "$node" "nodetool invalidatecidrpermissionscache 2>/dev/null" ssh "$node" "nodetool reloadcidrgroupscache 2>/dev/null" echo " Done"done
echo "All network caches cleared."Workflow: Network Access Change with Validation
Section titled “Workflow: Network Access Change with Validation”#!/bin/bashACTION="$1" # allow or blockCIDR="$2" # CIDR range, e.g., "10.1.0.0/16"GROUP="$3" # CIDR group name
echo "=== Network Access Change Workflow ==="
# 1. Show current CIDR groupsecho "1. Current CIDR groups:"nodetool listcidrgroups
# 2. Perform actionecho ""echo "2. Action: $ACTION for $CIDR"case $ACTION in allow) nodetool updatecidrgroup $GROUP "$CIDR" ;; block) # Get current group, remove the CIDR (requires manual handling) echo "Removing $CIDR from $GROUP..." nodetool dropcidrgroup $GROUP ;;esac
# 3. Invalidate cachesecho ""echo "3. Invalidating network caches..."nodetool invalidatenetworkpermissionscachenodetool invalidatecidrpermissionscache
# 4. Verifyecho ""echo "4. Updated CIDR groups:"nodetool listcidrgroups
# 5. Test an IPecho ""echo "5. Test IP membership:"read -p "Enter IP to test: " test_ipnodetool getcidrgroupsofip $test_ip
echo ""echo "=== Complete ==="Troubleshooting
Section titled “Troubleshooting”Client Unexpectedly Blocked
Section titled “Client Unexpectedly Blocked”# Check if IP is in expected CIDR groupsnodetool getcidrgroupsofip <client_ip>
# Verify CIDR groups existnodetool listcidrgroups
# Clear cache and retrynodetool invalidatenetworkpermissionscacheClient Unexpectedly Allowed
Section titled “Client Unexpectedly Allowed”# Check CIDR group membershipnodetool getcidrgroupsofip <client_ip>
# If IP shouldn't be in any group, check CIDR rangesnodetool listcidrgroups
# Clear cache and verifynodetool invalidatenetworkpermissionscachenodetool cidrfilteringstatsNetwork Changes Not Taking Effect
Section titled “Network Changes Not Taking Effect”# Invalidate on all nodesfor node in $(nodetool status | grep "^UN" | awk '{print $2}'); do ssh "$node" "nodetool invalidatenetworkpermissionscache" ssh "$node" "nodetool invalidatecidrpermissionscache"done
# Reload CIDR groups from system tablesfor node in $(nodetool status | grep "^UN" | awk '{print $2}'); do ssh "$node" "nodetool reloadcidrgroupscache"doneHigh Cache Miss Rate
Section titled “High Cache Miss Rate”# Check CIDR filtering statisticsnodetool cidrfilteringstats
# If miss rate is high with many unique IPs,# consider increasing cache size or# using broader CIDR rangesBest Practices
Section titled “Best Practices”Network Permissions Cache Guidelines
- Invalidate after CIDR changes - Always invalidate when modifying network rules
- Cluster-wide for security - Invalidate all nodes when blocking networks
- Combine with CIDR cache - Network permission changes often require both caches cleared
- Test changes - Verify network access after modifications
- Monitor statistics - Use
cidrfilteringstatsto verify behavior
Security Considerations
- Network rule changes can have immediate security implications
- Always invalidate cluster-wide when blocking access
- Test changes thoroughly before production deployment
- Audit all network access changes for compliance
Relationship to CIDR Filtering
The network permissions cache works with the CIDR filtering system:
- CIDR groups cache: Stores CIDR group definitions
- CIDR permissions cache: Stores IP-to-group mappings
- Network permissions cache: Stores authorization decisions
For complete network access refresh, consider invalidating all related caches.
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| invalidatecidrpermissionscache | Clear CIDR permissions cache |
| reloadcidrgroupscache | Reload CIDR groups |
| cidrfilteringstats | View filtering statistics |
| listcidrgroups | List CIDR groups |
| getcidrgroupsofip | Check IP group membership |
| updatecidrgroup | Modify CIDR groups |
| dropcidrgroup | Remove CIDR groups |
| invalidatepermissionscache | Clear role permissions cache |