1. Computing & Technology

Linux Network Administrators Guide

From

10.2.4. Accounting by Protocol

Let's now imagine that we are interested in knowing how much of the traffic on our link is TCP, UDP, and ICMP. We would use rules like the following:


   

 # ipfwadm -A both -a -W ppp0 -P tcp -D 0/0
 # ipfwadm -A both -a -W ppp0 -P udp -D 0/0
 # ipfwadm -A both -a -W ppp0 -P icmp -D 0/0 

or:


   

 # ipchains -A forward -i ppp0 -p tcp -d 0/0
 # ipchains -A forward -i ppp0 -p udp -d 0/0
 # ipchains -A forward -i ppp0 -p icmp -d 0/0 

or:


   

 # iptables -A FORWARD -i ppp0 -m tcp -p tcp
 # iptables -A FORWARD -o ppp0 -m tcp -p tcp
 # iptables -A FORWARD -i ppp0 -m udp -p udp
 # iptables -A FORWARD -o ppp0 -m udp -p udp
 # iptables -A FORWARD -i ppp0 -m icmp -p icmp
 # iptables -A FORWARD -o ppp0 -m icmp -p icmp 

With these rules in place, all of the traffic flowing across the ppp0 interface will be analyzed to determine whether it is TCP, UDP, or IMCP traffic, and the appropriate counters will be updated for each. The iptables example splits incoming flow from outgoing flow as its syntax demands it.


   Prev    Home    Next
   Configuring the Kernel for IP Accounting    Up    Using IP Accounting Results

* License

* Linux Network Administrators Guide Guide Index

©2012 About.com. All rights reserved.

A part of The New York Times Company.