Network Access Control Lists (NACL)

  1. network access control list (NACL) is a layer of security for your VPC that acts as a virtual  firewall for controlling traffic in and out of one or more subnets.
  2. You set up network ACLs with rules similar to your security groups in order to add an additional layer of security to your VPC.
  3. NACL operates on subnets whereas Security Groups work at EC2 level
  4. SGs have only ALLOW rules at EC2 level but NACLs have both ALOW/DENY rules at subnet level.
    1. So you can DENY (block) ip addresses using NACLs at subnet level.
    2. This is not possible thru SGs since SGs only ALLOW at EC2 level.
    3. So if you want to BLOCK IP address then do it in the NACL, not possible with security groups.
  5. NACL rules (IOADC)
    1. rule is either Inbound or Outbound
    2. rule can specify ALLOW or DENY
    3. inbound rule has source CIDR outbound rule has destination CIDR
  6. When you create a VPC a default NACL is created
    1. Default NACL allows all inbound and outbound traffic.
    2. All subnets created are assigned this default NACL.
  7. We can create new custom NACLs and change the association from default to custom NACL at subnet level.
    1. By default a custom NACL DENYs all inbound and outbound traffic.
  8. Each subnet in your VPC must be associated with a network ACL. If you don’t explicitly associate a subnet with a network ACL, the subnet is automatically associated with the default network ACL.
  9. A subnet can have only one NACL associated at any given time unlike Security Groups, where multiple SGs can be assigned to an EC2 instance.
  10. One NACL can be associated with multiple subnets. For example the default NACL is assigned whenever a new subnet is created.
  11. Rules are evaluated starting with the lowest numbered rule. As soon as a rule matches traffic, it’s applied regardless of any higher-numbered rule that may contradict it. The highest number that you can use for a rule is 32766.
  12. NACLs rules are applied first before applying security group rules.
  13. NACLs are stateless
    1. Example: If you allow HTTP inbound in a NACL, this does not automatically ALLOW HTTP outbound. You need to explicitly ALLOW HTTP outbound as well.
    2. This is different from the security groups, which are stateful. In a SG, Once you allow HTTP inbound (request), the request’s corresponding outbound HTTP (response) is automatically allowed even if there is no such rule created.
  14. Use ephemeral (temporary) ports on outbound rules only
<<< Virtual Private Clouds (VPC)Network Address Translation (NAT) Instances, NAT Gateways, Egress only Internet Gateways and Bastion Hosts >>>
Copyright 2005-2016 KnowledgeHills. Privacy Policy. Contact .