Home > Articles

Packet Filtering

This chapter is from the book

Effective Uses of Packet-Filtering Devices

Because packet filtering is older technology and lacks the capability to differentiate between types of network traffic, you might be wondering why we are discussing it. What could be the possible use for this technology in a world that is filled with hi-tech firewalls that can track protocols using knowledge of the way they work to intelligently differentiate between incoming and outgoing traffic streams? Good question! Why use a PC when we have supercomputers? Sometimes a lighter-weight, less expensive means to get things done is a major advantage. Because packet filters don't go to great depth in their analysis of traffic streams, they are faster than other firewall technologies. This is partially due to the speed at which the header information can be checked and partially due to the fact that packets don't have to be "decoded" to the application level for a decision to be made on them. Complex decisions are not necessary, simply a comparison of bits in a packet to bits in an ACL.

Filtering Based on Source Address: The Cisco Standard ACL

One of the things that packet-filtering technology is great for is the blocking or allowing of traffic based on the IP address of the source system. Some ways that this technology can be usefully applied are filters blocking specific hosts (blacklisting), filters allowing specific hosts (such as business partners), and in the implementation of ingress and egress filters. Any of these examples can be implemented on a Cisco router by using a "standard" access list.

The standard access list is used to specifically allow or disallow traffic from a given source IP address only. It cannot filter based on destination or port number. Because of these limitations, the standard access list is fast and should be preferred when the source address is the only criteria on which you need to filter.

The syntax for a standard access list is as follows:

access-list list number 1-99 or 1300-1999 permit |deny source address mask log

Notice that when ACLs were first created, the list number had to be 1–99. This range was expanded in IOS version 12.0(1) to include the numbers 1300–1999. The only way that the Cisco IOS can identify the list as a standard ACL is if a list number in one of these two ranges is used. The mask option is a required wildcard mask, which tells the router whether this is a single host we are filtering or an entire network range. (For more information on wildcard masks, check out the sidebar "The Cisco Wildcard Mask Explained" later in this chapter). The log option can be appended to tell the router to specifically log any matches of this filter. These log entries can be saved in local memory or more appropriately sent to a remote Syslog server. For more information on router logging, see Chapter 6, "The Role of a Router," and Chapter 20, "Network Log Analysis."

The previously listed access list notation is entered in global configuration mode and can be applied to the interface in the interface configuration mode with the access-group statement, as shown here:

ip access-group list number in|out

The access-group command is used to specifically apply an ACL to an interface (by its list number) either inbound or outbound. Only one access list can be applied in one direction (in or out) per interface. This means a maximum of two applied ACLs per interface: one inbound and one outbound.

One of the confusing concepts of router ACLs is the way that applying filters "in" or "out" works. This is confusing because people normally visualize "in" as traffic moving toward their internal network and "out" as traffic moving away from their network toward outside entities. However, this premise does not necessarily hold true when talking about the in and out keywords in Cisco router access lists. Specifically, the keywords tell the router to check the traffic moving toward (in) or away from (out) the interface listed.

In a simple dual-interface router, this concept is more easily illustrated. Let's assume you have an interface called e1 (hooked to your internal network) and an external interface called s1 (hooked up to the Internet, for example). Traffic that comes into the s1 interface moves toward your internal network, whereas traffic that goes out of the s1 interface moves toward the Internet.

So far this seems to be pretty logical, but now let's consider the internal e1 interface. Traffic that comes into e1 moves away from your internal network (toward the Internet), and traffic that goes out of e1 goes toward your internal network.

Keep in mind when you apply access-group commands to your interfaces that you apply the access list in the direction that the traffic is traveling, in regards to the router's interface. You might be thinking, "What is the difference, then, between inbound on the s1 interface and outbound on the e1 interface? Both refer to traffic that is moving in the same direction. Which is more appropriate to use?"

The less work the router has to do, the better. Always try to filter traffic at the first interface it enters, or apply your filters "inbound" as much as possible.

Returning to our example, if something should be blocked (or permitted, for that matter) coming in from the Internet, it would make the most sense to block it coming in to the s1 (outside) interface. In addition, if something should be filtered leaving your network, it would be best to filter it inbound on the e1 (inside) interface. Basically, you should show preference to the in keyword in your access lists. Some specific exceptions to this rule exist, which involve certain access list types (such as reflexive ACLs) that require being placed outbound.

These examples often list the actual prompt for a router named "router" to remind you of the command modes that the router will be in when entering the various commands.

The following is an example of an actual filter that uses the previous syntax and 190.190.190.x as the source network's IP address that you want to deny:

router(config)#access-list 11 deny 190.190.190.0 0.0.0.255

This filter's list number is 11. It denies any packet with a source network address of 190.190.190 with any source host address. It is applied to the interface inbound, so it filters the traffic on the way into the router's interface.

The command to apply the access list to your serial 1 interface would be

router(config-if)#ip access-group 11 in

where we are in interface configuration mode for the interface to which we are applying the access list, inbound.

Blacklisting: The Blocking of Specific Addresses

One popular use of the standard access list is the "blacklisting" of particular host networks. This means that you can block a single host or an entire network from accessing your network. The most popular reason for blocking a given address is mischief. If your intrusion detection system (IDS) shows that you are being scanned constantly by a given address, or you have found that a certain IP address seems to be constantly trying to log in to your systems, you might simply want to block it as a preventative measure.

For example, if your intranet web server should only be offering its information to your business locations in the continental United States, and you are getting a lot of hits from a range of IPs in China, you might want to consider blocking those addresses.

The blocking of address ranges is also a popular way to "band-aid" your system against an immediate threat. For example, if one of your servers was being attacked from a certain IP address, you could simply block all traffic from that host or network number. As another example, if you just found out that you had a widespread infection of a Trojan that contacted a remote IRC server, you could block all traffic coming from that IRC server. It would be more appropriate to block the traffic leaving your network to that destination, however, but that would require an extended access list because standard ACLs only filter on source address.

A sample access list to block access from an outside address range would be

router(config)#access-list 11 deny 192.168.1.0 0.0.0.255
router(config-if)# ip access-group 11 in

where the network number of the outside parties to be blocked would be 192.168.1.0–255. (Of course, this address range is part of the ranges reserved for private addressing, and it's simply used as an example in this instance.) This access list would be applied to the external router interface, inbound.

"Friendly Net": Allowing Specific Addresses

Another way you can use a standard access list is to permit traffic from a given IP address. However, this is not recommended. Allowing access to an address in this manner, without any kind of authentication, can make you a candidate for attacks and scans that use spoofed addresses. Because we can only filter on source address with a standard ACL, any inside device with an IP address can be accessed. Also, it's impossible to protect individual services on those devices. If you need to set up access like this and can't do it through a solution that requires authentication or some type of VPN, it is probably best to at least use an access list that considers more than the source address. We'll discuss this more in the section on extended access lists. However, this type of access may be suitable in situations requiring less security, such as access between internal network segments. For example, if Bob in accounting needs access to your intranet server segment, a standard ACL would be a simple way to allow his station access.

Ingress Filtering

RFC 1918 pertains to reserved addresses. Private/reserved addresses are ranges of IP addresses that will never be distributed for public use. This way, you can use these addresses in internal networks without worry of accidentally picking network addresses that might correspond with a public address you might want to access some day.

For example, imagine that you are in a world in which reserved private addresses don't exist. You are installing a new private network for your business that will have access to the Internet and will be running TCP/IP, so you will have to come up with a range of IP addresses for your stations. You don't want these stations to have public addressing because they won't be serving information to the Internet, and you will be accessing the Internet through a proxy server. You pick a range of IP addresses at random (say, 190.190.190.0–255). You configure your stations and set up Internet access.

Everything is working great until the first time you attempt to access your bank's website and receive an error. You call the bank, and the bank says that everything is fine on its end. You eventually come to discover that the bank is right. The bank's system you were trying to contact has a public IP address of 190.190.190.10, the same address you have configured for one of your own stations. Every time your web browser goes to send information to the bank, it never even leaves your internal network. You've been asking your CAD station for a web page, and because your CAD station doesn't run web server software, you've just been getting an error. This example paints a clearer picture of why reserved addresses are so important for the interrelationship of public and private TCP/IP networks.

The reserved ranges are as follows:

  • Class A: 10.0.0.0–10.255.255.255

  • Class B: 172.16.0.0–172.31.255.255

  • Class C: 192.168.0.0–192.168.255.255

Because these ranges are often used as internal network numbers, they are good candidates for someone who is crafting packets or doing other malicious packet-transmitting behavior, including denial of service. Therefore, these ranges should be blocked at the outside of your network. In addition, the loopback address 127.0.0.1 (the default address that all IP stations use to "address" themselves) is another candidate for being blocked, for the same reason. While you are blocking invalid addresses, you should also block the multicast address range 224.0.0.0–239.255.255.255 and the invalid address 0.0.0.0. Following is a sample access list to accomplish this:

router(config)#access-list 11 deny 10.0.0.0 0.255.255.255
router(config)#access-list 11 deny 127.0.0.0 0.255.255.255
router(config)#access-list 11 deny 172.16.0.0 0.15.255.255
router(config)#access-list 11 deny 192.168.0.0 0.0.255.255
router(config)#access-list 11 deny 224.0.0.0 15.255.255.255
router(config)#access-list 11 deny host 0.0.0.0
router(config-if)# ip access-group 11 in

These access lists are similar to the last one, denying access to the IP address ranges listed in an inbound direction on the applied interface. Notice the host keyword when blocking 0.0.0.0 in the previous example. When blocking a single host, instead of following the IP address with the wildcard 0.0.0.0, you can precede the address with the keyword host. These lists have the same "implicit deny" that any access list does. This means that somewhere in access list number 11, a permit statement would have to exist; otherwise, all inbound traffic would be denied! An example of an appropriate permit statement might be one that allows the return of established traffic, like the following:

router(config)# access-list 111 permit tcp any any established

This is, however, an extended access list, which we'll talk more about later in the section "Filtering by Port and Destination Address: The Cisco Extended ACL."

It is also advisable that you create a rule to block traffic coming into your network that claims to have a source address matching that of your internal network, to complete your ingress access list. Valid traffic from the outside world doesn't have to have the same addressing as your stations. However, if this traffic is allowed to pass, it could bypass security mechanisms that think the traffic is local. If you are using one of the standard private address ranges, this is already done. If you're not, it would look like this:

router(config)#access-list 11 deny 201.201.201.0 0.0.0.255

Here, your network address range is 201.201.201.0–255. This rule would be added to the previous list before the line that allows return traffic.

Ingress filters are an excellent example of a means to use packet-filtering technology to its fullest, on any network. Even if you have a stateful or proxy firewall, why not let your perimeter router use packet filtering to strip off this unwanted traffic? Let perimeter routers be the "bouncers" of your network, stripping off the undesirables before they even reach other internal protection devices.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020