Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Apple > Operating Systems

This chapter is from the book

Troubleshooting Your Firewall

The firewall services discussed in this chapter provide a point-and-click graphical user interface in Server Admin for simplified configuration. Of course, this simplification makes troubleshooting a little more complicated when things do not run as expected, especially with the firewall service.

The firewall service requires planning. You should make one change at a time and ensure that each change has the intended effect. Implementing too many changes at once makes it difficult to locate the source of a problem. Documenting changes is essential. When several administrators have permission to make changes to the firewall rules, it is imperative that each administrator be kept current with the actions of the others.

When rules are not working and time is not an issue, you can employ several tools and methods—such as ping, telnet, Network Utility, and tcpdump—to troubleshoot the firewall service.

Let’s examine a potential firewall configuration issue and the troubleshooting steps necessary to identify and remedy that issue. To simplify the exercise, we will utilize a server that is on an internal network and demonstrate restrictions and permissions on that internal network.

  1. Open Server Admin.
  2. Select the name of your server in the leftmost pane.
  3. In the Toolbar, click the Settings button.
  4. Select the Services tab.
  5. Select the checkbox to enable configuration of the firewall.
  6. In the lower-right corner of the Server Admin window, click Save. The Firewall service will now have an entry in the Services section of the left pane of the Server Admin window as seen in the following figure:
  7. In the left pane, click the Firewall service to view its settings, but do not start the service.
  8. If necessary, click the Address Group tab.
  9. Notice that the default address groups are 192.168-net and 10-net, which may or may not reflect your network settings. You will address these items first.
  10. Double-click 192.168-net and change the name to your internal network’s IP range. For example, the server used in this exercise has an internal IP address of 172.16.100.130 and a net mask of 255.255.255.0, so 172.16.100-net is appropriate.
  11. Enter your internal network range in the “Addresses in group” field.
  12. Click the 10-net address group to select it, then delete it by clicking the Delete (–) button at the bottom of the configuration window.

Test the Firewall Using Command-Line Tools

You can test and verify the performance of your firewall using commands in the Terminal application.

  1. On your client machine, open the Terminal application.
  2. ping your server’s IP address using your server’s internal IP address instead of the address shown below.
    ping 172.16.100.130
    
  3. Press Control-C to exit the ping. The report should look like this:
    PING 172.16.100.130 (172.16.100.130): 56 data bytes
    64 bytes from 172.16.100.130: icmp_seq=0 ttl=64 time=0.344 ms
    64 bytes from 172.16.100.130: icmp_seq=1 ttl=64 time=0.586 ms
    64 bytes from 172.16.100.130: icmp_seq=2 ttl=64 time=0.545 ms
    64 bytes from 172.16.100.130: icmp_seq=3 ttl=64 time=0.537 ms
    64 bytes from 172.16.100.130: icmp_seq=4 ttl=64 time=0.171 ms
    64 bytes from 172.16.100.130: icmp_seq=5 ttl=64 time=0.721 ms.
    

    This report shows that a ping packet was sent from your client machine (which utilizes the ICMP protocol) to the server, and the server responded. The output of the command displays the number of bytes received, the address received from the sequence (or the order of the ping request), the time to live, and the response time in milliseconds. Enabling stealth mode in the advanced section of the firewall configuration will block ping and other network status requests. Stealth mode does not block these requests from the internal network unless an explicit rule is set in the advanced tab of the firewall configuration.

  4. Click the Logging tab and then select “log all denied packets.” Click Save.

    To test whether a specific port is blocked or allowed, you will test the AFP service using telnet to check if the connection can be established.

  5. If the AFP service does not appear in the left pane of your server admin window, repeat steps 1 through 5 of the previous task to add the AFP service. Click the AFP service, and then click the Start button.
  6. In the Terminal window on your client machine, use the following telnet command, inserting your server’s internal network IP address to replace 172.16.100.130 (note that 548 is added to the command because AFP utilizes port 548):
    telnet 172.16.100.130 548
    

    The command output should resemble the listing below, which shows that telnet was able to establish a connection to the AFP service on port 548:

    Trying 172.16.100.130...
    Connected to 172.16.100.130.
    Escape character is '^]'..
    
  7. Press Control-J to close the connection.
  8. At the bottom of the Server Admin window, click Start Firewall to enable the default firewall rules.
  9. In the Terminal window on your client machine, type the following telnet command, inserting your server’s internal network IP address instead of 172.16.100.130.
    telnet 172.16.100.130 548
    

    The command output should look something like the listing below, illustrating that telnet was able to establish a connection to the AFP service on port 548:

    Trying 172.16.100.130...
    telnet: connect to address 172.16.100.130: Operation timed out
    telnet: Unable to connect to remote host
    
  10. In the Server Admin toolbar, click the Log button and examine the log.
  11. To filter the results and view only the DENY messages, at the right side of the Toolbar, type DENY in the filter area. Your output should be similar to this:
    Nov 22 13:41:43 server ipfw[2086]:  65534 Deny TCP 172.16.100.1:50971
    172.16.100.130:548 in via en0
    Nov 22 13:41:46: --- last message repeated 3 times ---.
    

    Looking at the output from the log the information displayed in order from left to right, you’ll see the date, the time, the host name of the server, the firewall component that responded (in this case, ipfw), the rule number, the action that was taken on specified ports and Ethernet card. Notice that this action occurred an additional three times and that the server IP address and requested port number is displayed last, not first.

    Another method to test whether the firewall allows a port through or denies it is to use the Network Utility application located in /Applications/Utilities.

  12. Open Network Utility on your client machine and click the Port Scan tab. Enter your server IP address in the “Enter an internet or IP address to scan for open ports” field and enter 548 in both “Only test ports between” fields. Verify that the “Only test ports between” checkbox is selected, and then click the Scan button.

    As seen below, the port scan is initiated and completed with no indication of an error. This is the normal behavior—Network Utility is reporting that it found no open port at the addresses specified.

  13. Using Server Admin on your server, click the Stop Firewall button and repeat the network scan described in step 12.

    This time the output includes a line indicating that the network traffic connected to the server on the specified port.

    Open TCP Port:  548      afpovertcp
    

Using a Packet Sniffer

If rules look like they should be working, but they are not, and time is not an issue, a packet sniffer will allow you to view the problem from the inside. Mac OS X ships with the tcpdump packet sniffer. This popular open source sniffer can print information in real time for a quick determination, or it can write its dump to a file for later, offline analysis.

  1. To dump all packets passing through the en0 interface to stdout, use the following commands:
    # tcpdump -i en0
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on en0, link-type EN10MB (Ethernet), capture size 96 bytes
    06:42:37.514597 IP mainserver.pretendco.com.ssh > 72.14.228.89.11667: P
    3011092458:3011092650(192) ack 3151495640 win 33312 <nop,nop,timestamp 1488505430
    575729407>
    06:42:37.523288 IP 72.14.228.89.11667 > mainserver.pretendco.com.ssh: .
    ack 0 win 65535 <nop,nop,timestamp 575729408 1488505364>
    06:42:37.589744 IP 72.14.228.89.11667 > mainserver.pretendco.com.ssh: .
    ack 192 win 65535 <nop,nop,timestamp 575729409 1488505430>
    06:42:37.637216 IP comproxy2.example.net.53730 > 192.168.1.1.9090:
    UDP, length 74
    06:42:37.760644 arp who-has 192-168-232-92.in-
    addr.arpa.example.com tell 192-168-232-1.in-addr.arpa.example.com
    06:42:38.137423 IP comproxy2.example.net.53730 > 192.168.1.1.9090:
    UDP, length 74
    06:42:38.320315 arp who-has 69-55-228-118.in-
    addr.arpa.johncompanies.com tell 69-55-228-1.in-
    addr.arpa.johncompanies.com
    ^C
    316 packets captured
    349 packets received by filter
    0 packets dropped by kernel
    
  2. Press Control-C to stop the capture.

    Each line displays the time that the packet was received; the protocol; the source of the packet; its destination; and, optionally, any set flags.

  3. To limit the tcpdump capture to a specific IP address, specify the host in the tcpdump command:
    # tcpdump -i en0 host 10.1.0.1
    
  4. Perhaps even more useful when troubleshooting a firewall problem is to limit the capture to a specific port—port 80, in this exercise:
    # tcpdump -i en0 port 80
    

    You can also negate a filter using the not keyword. For example, if you are troubleshooting remotely via the Secure Shell protocol (SSH), the SSH traffic that makes up your session is typically noise. Furthermore, you can combine filters with the and conditional.

  5. To listen for all traffic from the host at 192.168.55.8, but filter out traffic on port 22, use this command:
    # tcpdump -i en0 host 10.1.0.1 not port 22
    

    Sometimes, analyzing tcpdump on the fly is not enough. For deeper analysis, you can write dumps to a file and analyze them offline using a more powerful program, such as the open source application Wireshark. For deeper analysis, you can also increase the size of the packet capture. By default, tcpdump captures only the first 96 bytes of each packet. For a deeper look, you should capture the entire packet.

  6. To capture all traffic of unlimited packet size and write it to a file, you can use the -s (size) and -w (write) switches:
    # tcpdump -i en0 -s0 -w server_trace.pcap
    

    The -s0 (“ess zero”) designates unlimited packet size, and the -w switch in this example writes all capture data to the file server_trace.pcap.

A common error when configuring the firewall is accidentally creating conflicting rules. Review your rules and the order in which they are executed to ensure that your configuration is correct. Utilize the tools above to test the traffic through the firewall and adjust your rules accordingly.

In most cases, all you’re looking for on a server is any activity getting through the firewall or to the local interface. The more detailed traces are typically more helpful from the client side. In a worst-case scenario, you can document and back up the current firewall rule set, and then flush the current rules entirely. Then you can add half of the rules back in at a time, starting the firewall service each time that you introduce a new set of rules. Incrementally adding back rules will make it easier to determine which rule is causing the undesired behavior.

If you become completely lost with the firewall configuration, you may want to back it up and start from scratch. For instructions on resetting the firewall to default values, see “Resetting the Firewall to the Default Setting” in the Apple Network Services Administration document at: http://images.apple.com/server/macosx/docs/Network_Services_Admin_v10.6.pdf.

Peachpit Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Peachpit 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 Peachpit 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 ask@peachpit.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 Adobe Press. 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.peachpit.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