|
| Top | Log In | Cart Contents | Checkout |
ET/BWMGR User Manual(Version 4.1 For FreeBSD 7)Table of ContentsET/BWMGR OverviewInstallationTrying out the ET/BWMGR ProductET/BWMGR ConfigurationStats-only ModeSetting the Outside InterfaceBridgingSetting Up A Fallback Interface System Configuration IssuesSetting the Indexing Level Setting the Stats and Burst Period Starting the Bandwidth ManagerObtaining Your System Serial Number Stopping the Bandwidth Manager All about Rules and PoliciesSetting Rules and Limits Setting Policies for Hosts and Networks Enabling and Disabling by Time of Day The ET/BWMGR Protocol Engine Special Protocol Definitions Configuring the FirewallPackets Per Second Firewall Rules log-only rules Controlling Bandwidth UtilizationSetting Bandwidth Limits with the bwmgr Utility Setting up a Bandwidth Rule with Bursting Setting the Maximum Burst Duration Setting Asymetrical Burst Rates Per Session Bandwidth Management Packets per Second Settings Excluding Traffic (pass-thru rules) Using Bandwidth ProfilesThe Effect of Bandwidth Profiles
Group Bandwidth ManagementSetting a Ceiling for a Group of Rules Bandwidth Settings Within Groups Nested Groups (Groups within Groups) Reverse Dynamic Rules (per source host limiting) Reverse Rules with a Bandwidth Ceiling Creating Dynamic Groups with Reverse Rules
PrioritizationSetting the Priority of Bandwidth Rules StatisticsShowing "Hits" and "Drops" on a Rule Gathering and Saving StatisticsSaving Statistics for a Host or Traffic Type Combining Stats with -statscombine Viewing bwmgr entries and Statistics Changing the Statistical Period AutoMgr - Automated Bandwidth ManagementAdvanced TopicsSetting a password for use by non-superusers Controlling P2P File Sharing Programs - Gnutella, Kazaa, etc. Building Compound Burst Triggers Using Squid on a Bridge System Special Considerations when using a Web Cache General MaintenanceOther TopicsHTML GUI Manual (Graphical User Interface)ET/BWMGR OverviewET/BWMGR is a bandwidth management system that provides a rich set of tools for monitoring and controlling the flow of traffic to and from your network. The System Monitor allows you to view traffic on your network with a variety of criteria, allowing you to learn about the composition of traffic on your network and also to view current usage by devices or protocols. The Firewall allows you to control the type of traffic that is allowed to flow in and out of your network. The bandwidth manager controls the shaping and limiting of traffic flows in your network. Getting the ET/BWMGR productThe ET/BWMGR is sold as a complete, integrated hardware solution, or as a software image that can be installed on your own hardware. Downloading the Demo CDBefore you buy the product you'll want to try it. If you want to run the software on your own hardware you'll need to test the hardware first, as sell as obtain the information needed to determine what licensing is required. To download the CD, you'll need to open a sales ticket (see contact us) and provide your IP so we can allow you to download.Buying an ApplianceThere are many advantages to an appliance vs the CD Appliance version of the product. Anyone who's ever used a computer knows that there are so many diferent chipsets, NICs, video cards and memory types that running any os will always result in some small problems. Our appliances run on hardware that we've rigorously tested. We've fixed and tuned drivers, and we have 100s of customers all using the same hardware. If you encounter a problem, we will help figure out what it is, because we don't want our other customers to have the same problem. With our appliances, you get a solid product with full support. Its a piece of mind thats very important for such an important piece of your network. Another advantage is performance. Tuning a system, and getting the most out of a NIC are critical at the high end of performance. Our systems are optimised to perform on our hardware. In many cases, we've had to modify drivers and subsystems to fix seamlessly into our system image. If you are using your own hardware, you may encounter some quirkiness, which is why its important that you test the hardware before you buy. The CD ApplianceThe CD appliance is an appliance image that is built from the ET/BWGR demo CD. First you download and burn a demo CD. While you're testing, you can just boot off the CD. If you decide to purchase a license, you can use the CD to build an appliance. This allows you to test your hardware before you buy. In order to build a system, you will need to access our update server, which requires a license. Once you receive your license, you will be able to build a complete system on your own hardware. The advantage of a CD appliance over self-installation of the software is that you get all of the correct versions of companion software needed (mySQL, snmp, kernel configuration, driver patches), plus you get to use our update service to download updates directly to your system. Because we know that you are using the corect software versions, we can provide more help. (you are required to buy a subscription to get updates and support). The disadvantage of the CD appliance is that you may have hardware problems; some variation of a NIC that we haven't encountered, some chip that isn't supported well. Luckily you can test our hardware with our CD demo before making a purchase, so you should be able to find problems. Editing default.cfgYou should not edit default.cfg manually. The file is described in the GUI manual. Configuring Stats-only ModeStats-only mode is used if you just want to gather statistics and/or monitor your network activity. It allows you to plug only 1 ethernet port into a passive hub without putting the system "inline", so that the system cannot and will not affect your network in any way. Note that you must use a hug and not a switch, as switches will filter the traffic so the ET/BWMGR software will not see everything. To configure stats-only mode, configure the interface that is plugged into the hub as follows: bwmgr em0 -ifac -statsonly From the GUI, go into the bandwidth rules screen, click on the interface link and select "Edit Interface". Then check the "stats-only mode" checkbox. In stats-only mode, all rules must be -global with stats enabled. This allows you to gather stats by IP, MAC or traffic type and store them in the database. You can also use the system monitor in stats-only mode to view activity on your network. Setting the Outside InterfaceIn order for the bwmgr to detect protocols and to understand the direction of your traffic, you must tag the interface connected to the outside world as an outside interface. Typically this is the interface connected to the internet. If you have multiple paths, then all interfaces connected to the interface should be set as outside. Protocols are only gathered on the outside interfaces to avoid being counted twice. To set the outside interface, use the -o setting:bwmgr em0 -ifac -o Setting Up BridgingThe ET/BWMGR software allows you to set up your system as a transparent MAC layer bridge. Bridging allows you to put a PC with the ET/BWMGR software in between any two segments without having to worry about renumbering your network. Bridge Types There are 2 bridges for FreeBSD 7+: the standard bridge and the "fastbridge". Bridge The bridge is essentially the bridge which is included with the FreeBSD operating system, with some customization for use with the ET/BWMGR. Its loaded by default when you load the etbwmgr module. There is nothing special to do to load the normal bridge. FreeBSD 7.0 requires that you create a bridge device. While the OS allows for name flexibility, the ET/BWMGR requires that bridges be named bridge# where '#' is a number from 1 to 8, representing the bridge group number. While you could use ifconfig to create the bridge, the ET/BWMGR implements a command to do it which allows you to set the MAC address: bwmgr bridge0 create 00:00:00:17:12:11 This is significant because in FreeBSD 7, the bridge MAC address is used rather than the ethernet address for the local address. If you create the bridge with the ifconfig command, it will generate a random address, which has the consequence of giving the system a different address every time the machine is restarted. Using the ET/BWMGR command allows you to assign a static mac address for the system. The number of the bridge is also the bridge group number, which you'll need to add members to the bridge. To add members to the bridge, you can use bwmgr commands as follows: bwmgr em0 bridge 0 These commands add em0 and em1 to the bridge. If you need to assign an address to the bridge, you assign it to the bridge that you created rather than an interface on the bridge using an ifconfig command. ifconfig bridge0 192.168.11.1 netmask 255.255.255.0 Members can be added to the bridge in the same way as in previous versions: bwmgr em0 bridge 0 These statements add em0 and em1 to bridge group 0 (bridge0). There are several flags that can be set per interface in FreeBSD 7. The most useful flag is ffwd; short for "Fast Forward". This can be used when there are only 2 interfaces in the group and all traffic needs to be forwarded. Note on a network you may have local traffic (such as a local file server) which is usually "learned" by a bridge and not forwarded. If your setup is purely client<->internet, then you can use fast forwarding for better performance. Also supported is STP, or "Spanning Tree Protocol". You can turn STP in with the stp flag. Note that STP interacts with other spanning tree bridges in your network. If you choose to use this feature, we do not support the interactiions. We don't guarantee that its compatible in any given network. Setting Up a FastBridgeThe fastbridge is not really a bridge at all; its actually a forwarder that is designed to provide superior performance in systems where there are only 2 interfaces in the traffic flow, AND you are using a separate interface for administration. The fastbridge eliminates the code necessary to support learning and broadcast functions and reduces a layer of lock contention in the OS. The fastbridge is essential for use in 10 gigabit environments. The rules for using a fastbridge are:
To use the fastbridge, you must explicitly load the fastbridge driver. When the etbwmgr.ko module is loaded, it will load the regular bridge by default. To load the fastbridge, you'll need to set it in loader.conf: loader.conf In the file /boot/loader.conf, add the following line:
if_fastbridge_load="YES" Note that the if_fastbridge_load line must appear before the etbwmgr_load line. Otherwise etbwmgr will load the regular bridge and there will be a conflict. Setting up the fastbridge is the same as the regular bridge. Fast Forwarding is the default and only option. So all you'll need to do is:
ifconfig bridge0 192.168.11.1 netmask 255.255.255.0 Fast Forwarding Another setting is "Fast Forwarding" mode. Fast forwarding disabled all learning and other filtering and assumes that there are only 2 ports and that all traffic needs to be forwarded. This is a typical setup where the box is between the router and main switch and all traffic is destined for the internet: bwmgr em0 bridge 1 ffwd Setting up a Fallback InterfaceA fallback can be implemented using a LAGG(4) interface. You can add a LAGG interface to a bridge as follows:bwmgr em0 bridge 1 ffwd man lagg Span Ports The Bridge also allows for an interface to be configured as a span port. Span ports send traffic to a monitor and is effectively a "tap" on the line. When a port is configured as a span interface, all traffic forwarded on that bridge group will be sent out the span port. Note that span ports are not supported on the fastbridge. System Configuration ParametersSetting the Indexing LevelThe ET/BWMGR incorporates a powerful algorithm which indexes rules for ultra-fast lookup. There are 4 indexing levels available for non-firewall rules, both of which use the -addr (IP Address) part of the rule as the index. The default, level 4, should be used for most installations. Levels 1,2 and 3 have less granularity but can be used for rulesets which have a lot of subnet rules. Firewall setups with extensive blocks on a wide variety of rules can be made much more efficient by changing the indexing.
Indexing can be summarized as follows. Suppose your address rule is A.B.C.D:
Level 4 - Uses A.B.C.D Rules that have less precision than the index cannot be indexed and are therefore global rules. Global rules much be checked for each packet received. So the rule: bwmgr em0 -addr 192.168.1.0 -addrmsk 255.255.255.0 can be indexed for levels 1,2 and 3 (full 255 mask) but not for level 4.Each interface can index at a different level. As stated before, the default is Level 4, so if you are using level 4 you dont need to do anything to set the level. The GUI (and the "rebuild" command) will always generate a command line to set the index level. The syntax is as follows: bwmgr em0 indexlevel 4 This sets the index level on interface em0 to 4. Note that you MUST do this before adding any rules to the interface. The driver will reject an attempt to change the level if there are rules presently defined. Starting with v3.3, the firewall rules are also indexed. Firewalls have 5 index level choices. 1,2,3 and 4 are the same as for the regular rulesets, using the IP address. A 3rd choice is available, ports, which uses -port. port indexing is useful if you are firewalling by port rather than by address. Address is more effective, so if you use both ports and addresses, then use you shouldn't use the port indexlevel. You set the firewall indexlevel using the fwlevel keyword: bwmgr em0 fwindex 1|2|3|4|ports Analyzing your rulesetYou can check the efficiency of your ruleset with the analyze command: bwmgr em0 analyze FW Global Rules: 0 This shows that the current ruleset has 3 rules that have to be checked for every packet that arrives. Keeping the number of global rules down is the key to efficiency. The "Worst Case" is the rule which requires the most processing. Worst case is always higher than the number of global rules, which is "every case". Note that the context of the term "global" is important here. In this context, a global rule is any rule that is not indexed. So all rules that do not have an IP address or MAC address is a global rule. For example, a rule that matches a protocol is a global rule, since there is no way to index it. Secondly, a rule tagged -global is NOT a global rule if it has an IP or MAC address. So in that sense, the Global rules showed here have nothing to do with rules tagged -global in your ruleset. Setting the maxbuffers parameterThe maxbuffers parameter will put a cap on the number of buffers that the bandwidth manager will use to store managed data in its limiting or prioritization queues. The purpose of this parameter is to keep the bandwidth manager from exhausting your system of network buffers (which may cause it to fail). You can also use it to limit the amount of backup traffic that the bandwidth manager will manage. Typically, this number should be somewhat lower than the number of system buffers you have available for network frames. You can check to see how many buffers are allocated in your running kernel with the following command: sysctl kern.ipc.nmbclusters Issuing this command will print the number of buffers allocated in your system. To change the setting, you can either change the NMBCLUSTERS setting in your kernel, or you can set the number of buffers to use at boot time by putting a line like the following in /boot/loader.conf: kern.ipc.nmbclusters="16000" Remember that each buffer is 2K, so you can't allocate an infinite number of buffers. Normally Freebsd will allocate 1/3 of RAM to the kernel. Our supplied kernels and kernels in our appliances use an algorithm to determine how much ram to use. Note that buffers are allocated on the fly, so the system won't tell you if there isn't enough RAM to implement your setting. If you set it too high, your system may just blow up when it runs out of memory, so be careful. After determining the buffer allocation in your system, you can then use "netstat -m" after initial boot to see how many buffers your system uses with no traffic (this will vary depending on what cards and devices you have in your system. Suppose your system uses 700 clusters after boot. You could set your maxbuffers setting to say 15000 (which is less than 16000 - 700). In Linux, you have no way of knowing how many buffers your system has as the memory pool is dynamic, so its pretty much a crapshoot. Usually a setting of 10000 or so is safe for most installations. When you issue a "show" command via the command line or look at the main menu in the HTML interface, you will see "maxbuffers" shown in the n1/n2 format. The first number is the "high use" counter..this is not the number in use currently, but the most that were ever required. The second number is your "maxbuffers" setting. You can clear the first number by setting maxbuffers to the same number as you currently have. Its not generally a good idea to change the maxbuffers setting when your system is experiencing a heavy load, but setting it to the same value will only reset the high use counter. So, if you have 8000 buffers allocated in your system, you can issue the command: bwmgr maxbuffers 16000 to reset the high use counter. Setting the Stats PeriodThe stats period is the length of the window used internally to manage per-rule statistics. The default period is 20 seconds. For statistics, the stats period is how often snapshots of statistics are saved. For the most part, this is completely arbitrary. When you view stat for a rule, you will see the usage for the current period and the last stats period. The current period will have a slight error unless looked at exactly on the second. The "last period" will be a snapshot of the last stats-period, and will be an exact usage value for that period. These are the stats that are used with the "sort by usage" feature in the GUI. Starting the Bandwidth ManagerYou can start the bandwidth manager process with the following syntax:: bwmgr interface start authentication_key where interface is the interface that you used to generate your serial number with the "bwmgr interface serialize" command and authentication_key is the license key that you received when you purchased your license.. If you have a v3.2 license key, that is you purchased your license before v4.0 was released and you haven't upgraded, you need to use the startv32 command instead of start: bwmgr interface startv32 v32_authentication_key Running the ET/BWMGR DemoBefore you purchase a license, you should test your target hardware with out Demo CD. You'll need to run the sofware in "demo mode" by using the word demo as the key. So, for example, to run the bandwidth manager in demo mode, you could use a line similar to the following: bwmgr bw0 start demo Demo mode provides full functionality for a gigabit bandwidth license but will only run for 6 hours, provided that your system can contact out server when you start it (ie an internet connection is required). When the demo concludes, a message will be displayed indicating that it has completed. Once the demo completes, traffic will no longer be controlled, and bridging will cease to operate. In order to restart the software, you will have to reboot the system. You will be able to run the full demo for approximately 20 days. If you cannot contact our server or your demo period has expired, the bandwidth manager will start in "Limited" demo mode, which is only 1 hour, disables use of the System Monitor and allows a maximum of 10 rules. Once you have determined that the sofware is installed properly on your hardware, you can obtain a license key from Emerging Technologies that will no longer stop after the demo time period (see the FAQ). If you are considering a purchase of a 10Mb/s or 2Mb/s software license, you can run a 10 or 2Mb/s demo, which runs at 10Mb/s or 2Mb/s respectively, and will simulate a software license. To run the 10Mb/s demo, use the following: bwmgr em0 start demo10 for the 2Mb/s demo: bwmgr em0 start demo2 and for the 100Mb/s demo: bwmgr em0 start demo100 Obtaining Your System Serial NumberIn order to purchase a license, you will need to supply your system "serial number". This is a unique number that is specific to the physical system you are using. When you order the ET/BWMGR software license, you will receive a "key", which is keyed to the serial number, so it can only be used on your physical system. To get the serial number, run the following command: # bwmgr interface serialize (where interface is an ethernet interface, such as em0). This will print out 10 hex pairs that is the serial number for your system, such as:
#bwmgr em0 serialize
System Serial# 06:9b:10:08:69:03:77:ff:89:50 Note that there is a "license level" next to the different types of licenses available. When you order your license, you will need to provide the serial sequence as well as the license level on the order form so that we can generate your license key. When you receive your license key, you MUST start the bandwidth manager on the same interface that you used to generate the serial (em0 in the above example). Registering your ET/BWMGR License KeyWhen you receive your license key, you will need to register it before you can use it. Before you register it you should make certain that you've tested with the demo for long enough (several 6 hour tests are recommended) to make sure you don't have a hardware problem. If you find a problem with your hardware, you can get a replacement key, provided that you have not yet registered the license. Once you register your license, you will have to buy a replacement license, and you are only permitted to buy 1 replacement. To register the license, you will need to be able to contact our server. If you can ping www.etinc.com then you have access to the server. Also, you will have to have UDP ports in the 4000-5000 range available. So if you have a firewall be certain that you "open up" the bandwidth management device to allow the registration information to pass. To register, from the command line do the following: # bwmgr em0 register license_key where em0 is the interface that you used to generate the serial number and license_key is the license you purchased from ET. If all goes well, you will receive a message such as "Registration Complete". Once you receive this message, you can reestablish your firewall and you will be able to restart the bandwidth manager without restriction. If you still have a version 3.2 license key, you'll need to use the registerv32 command: # bwmgr em0 registerv32 v32_license_key Note that any time you receive an updated license key, or if you upgrade your OS or change hard drives you will need to re-register your software (you DO NOT need to re-register when upgrading versions of the ET/BWMGR drivers). If you re-register you will need to do it from the same IP address as you originally registered from. If you need to change the IP, you will have to notify ET so that we can authorize the change. Just create a sales or support ticket with your license_key or serial number and tell us you need to re-register with a different IP address. Stopping the Bandwidth ManagerYou can stop the bandwidth manager, which will stop it from limiting traffic with the following command: bwmgr stop Note that you shouldn't normally use this command unless there is something critically wrong. If you have bridging enabled, traffic will no longer be forwarded. If you are routing and not bridging, then stopping the bandwidth manager will just stop the functions of the software and revert to normal processing of traffic. Rule Tutorial - What is a Rule?A "rule" is a specification which defines what actions should be taken when events occur. In the context of the bandwidth manager, a rule is a description of a type of traffic, and a specification of what action to take when that traffic is encountered. The ET/BWMGR is controlled by "rules", which you will set up to allow the sofware to control your network traffic. Some products call these "policies". We'll use both terms. Rule SyntaxThe bwmgr rule syntax is very extensive, and will be illustrated throught this document in the appropriate section. The base syntax for adding rules can be summarized in the following: bmgr interface [-x rulenumber] criteria [bandwidth controls] [-priority priority_selector] where criteria is the match critera and the default priority is "normal". Basic criteria includes the following:
-name name (a label) for the rule
-x index (precedence) of the rule
-r reverse rule
-l enable logging
-fw firewall rule
-saddr {ip_address} source IP address
-daddr {ip_address} destination IP address
-addr {ip_address} either source or destination IP address
-smaddr{ mac_address} source MAC address
-dmaddr {mac_address} destination MAC address
-maddr {mac_address} either source or destination mac address
-nameaddr {hostname} name address (virtual host)
-url {url} matches URL text for http and ftp requests
-prot {ip_protocol} IP protocol (ie TCP, UDP, ICMP)
-mprot {mac_protocol} MAC protocol
-dport {port} destination port
-sport {port} source port
-port {port} either source or destination port
-portrange {start end} port range from startport to endport
-priority {priority} priority rule 1 to 10 (10 is highest)
-global specifies a global rule
Throughout this document the above criteria will be illustrated along with details of their use. First, some basics. Rule PrecedenceEach rule has an "index", which is a number which defines its precedence. The lower the index, the higher the precedence. Rules are processed from low to high. Generally, once a rule "hits", processing stops and the action specified by the rule is carried out, with the exception of global and log-only rules. Use the -x parameter to specify an index: bwmgr em0 -x 300 ... specifies an index of 300. If you add a rule without specifying an index, it will automatically select an index for you at the end of your ruleset, with one exception...... Large Rule IndexesAuto-indexing will not consider rules with indexes of 1 million or greater when determining the next highest index. This allows you to specify rules that MUST be at the end of your ruleset with high indexes that will always be at the end unless you manually place one higher. For example, suppose you have 2 rules: bwmgr em0 -x 100 -addr 10.1.1.1 -bwboth 256000 if you were to add a rule without an index specified, the rule would be added at index 200, so your rule 1000000 would still be at the end as required. Global RulesGlobal rules are a new concept in v3.24. Previously, rule index precedence was absolute. With global rules, its possible for a data frame to match multiple rules, which is useful both for statistics and control. Global rules are set with the -global tag. As as example, consider the following: bwmgr fxp2 -x 100 -ipprot tcp -global Now suppose a telnet packet originating from 10.1.1.1 is received. Without global rules, the packet would "hit" on rule 100 and stop there. But since 100 and 110 are global rules, in this case 100, 110 and 120 all will "hit". Note that is makes no difference where the global rule is located in the ruleset; a global rule will always hit on a match, so the following:
would make no difference; all 3 rules would "hit". Note however the following case: bwmgr fxp2 -x 300 -addr 10.1.1.0 -addrmsk 255.255.255.0
-global In this case, the telnet packet would only hit on 300 and 310, since rule 320 is not global. Only the first non-global rule will hit, and it does so by rule precedence. Naming EntriesNames function as aliases to rule numbers and are used to uniquely identify rules (out of the scope of the interface) for links with other rules. Names must be unique for the entire system. If you will be graphing the data from a particular rule (see the -stats option below) you MUST name it. Also note that names are case insensitive in the database, so if you have rules named "ACME" and "acme" they will be considered the same for graphing (and it will cause problems). Groups must also be named, as must reverse rules. In order to modify or view a particular rule, you need to specify the index number or the name that is assigned to the rule when you create it. To make things easier, you can name entries and use the name to modify or refer to specific rules without having to know the index number. To name an entry, use the -name option: bwmgr em0 -name GenMotors -x 300 ... the above entry will associate the name, GenMotors with this rule 300. So, for example, if you wanted to modify this rule in the future, you could simply do the following: bwmgr em0 -name GenMotors ...criteria... Note that names must be no more than 16 characters long and cannot include spaces or any other special characters other than a dash or underscore. You also should not use periods. Specifying Hosts and Network AddressesYou can also specify host addresses and networks with bwmgr to limit the amount of bandwidth that a specific host or network could use. This is done as follows: bwmgr em0 -addr 207.11.14.1 -bwout 56000 -bwin 56000 This would limit the traffic from and to host 207.11.14.1 to 56000bps. Similarly, an address mask can be used to specify an entire network or sub-network: bwmgr em0 -addr 207.11.14.0 -addrmsk 255.255.255.0 -bwout 56000 -bwout 56000 This would limit the bandwidth of all of the devices on network 207.11.14 to an aggregate of 56000bps. You can also use host/domain names for specific hosts. For example, to limit traffic of a specific host by name: bwmgr em0 -addr www.sumdomain.com -bwout 128000 -bwin 128000 Note that if you use internet host.domain names, the name is simply resolved to a host address. So if you do bwmgr em0 -addr domain.com ... the rule will be equivalent to bwmgr em0 -addr 10.1.1.1 ... assuming that domain.com resolves to 10.1.1.1. No attempt is made to resolve numbers to hosts, so in your configuration files the numeric IP address will be used. MAC Address RulesYou may want to lmit an entire physical machine, or a customer by his router's MAC address. Assuming that you know the MAC address of the specific machine, you can specify the MAC address using the -maddr option in the same way that you can limit by IP address. For example: bwmgr em0 -maddr 00:00:c0:a2:ca:bc -bwin 64000 -bwout 64000 The above example would limit all of the traffic to and from the host with MAC address 00:00:00:c0:a2:bc to 64kb/s. MAC rules match all of the traffic from or to the specified MAC address, including non-IP traffic. Alternatively, you can use -smaddr and/or -dmaddr to limit to or from or to control a specific connection. For example: bwmgr em0 -smaddr 00:00:c0:a2:ca:bc -dmaddr 00:00:c0:01:01:01 The above rule pair would limit all of the traffic for MAC 00:00:c0:a2:ca:bc except traffic going from this address to 00:00:c0:01:01:01. Grouping Bandwidth Entries - Creating a GroupIf you want to define a disjoint group of addresses, you can use the "Group" feature to create a group. To define a group, define a named group entry, and then link the other entries to that name of the head entry. For example:
bwmgr em0 -name losers -group -bwboth 128000 the above would create a group with the 3 specified addresses which would all have the same aggregate bandwidth limits, as if they were all in one rule. . Note the use of the -name parameter for the initial (group) entry. You must use the name of the entry when linking to a group head (previous versions allowed the index to be used). Using the name allows for group members to be on different interfaces. Note that if you delete the Group entry the other entries will continue to exist with an unattached link, and they will re-attach when a group rule with the proper name is added. You should avoid deleting group entries when possible, as the remaining rules will work differently (in the above case they will get unlimited bandwidth) when they are not in the group. More powerful use of groups is discussed in the Group Bandwidth Management section below. Managing Traffic by Data Type with bwmgrTraffic can be identified by "traffic type" as well as by previously described IP or MAC addresses. Traffic types can also be specified along with addresses to identify specific traffic sent by or to specific hosts or customers. Traffic types supported are: Mac Protocol We will describe each below. MAC Protocol RulesThe "MAC protocol" is the "ethernet type" in an ethernet frame. While virtually all of your "internet" traffic is IP, you may have many other types of traffic on your LAN. If you have co-located customers, if you are bridging your traffic to remote locations or if you just want to control certain types of LAN traffic, the MAC protocol can be used to identify such traffic. The syntax for specifying MAC traffic is as follows: bwmgr em0 -mprot Protocol Where "Protocol" is the hexidecimal representation of the ethernet type (ie 0x800 or 800 for IP, 0x806 or 806 for ARP, etc). The more common MAC types (IP, ARP, IPX) may be specfied by keyword. There are 2 special types. First is "-mprot vlan", which matches all vlan tagged traffic. Note that such rules will only match vlan encapsulated traffic that contain the vlan header. The second is "-mprot 802.3", which is "typeless" ethernet traffic. Some older protocols (and IPX implementations) may specify the length instead of the protocol type. Specifying 802.3 will match all such traffic, regardless of the higher level protocol. VLAN (VPN) RulesYou can also Match based on the vlan tag (ie the vlan ID number) using the -vlan option. For example: bwmgr em0 -vlan 128 -bwboth 256000 will limit traffic containing vlan header info for vlan 128 to 256000. Note that -vlan implies -mprot 0x8100 and that any other setting of -mprot is not valid. IP Protocol RulesAll IP traffic has an IP protocol. The most common IP protocols are TCP, UDP and ICMP, but there are many more. Most likely, you will not encounter anything different than the "big 3". Other IP protocols are listed in the file /etc/protocols on most unix-like installations. To match traffic with a specific IP protocol, use the -ipprot (legacy -prot is also supported). The following are examples of how to match "the big 3": bwmgr em0 -ipprot UDP Note that port-defined and special internally defined protocols can also be specified with the -ipprot setting. These are discussed in the protocol engine section later in this document. IP TOS RulesYou can use a mask to match bits in the TOS field of ipv4 packets with the -iptos option. Since TOS is used in many different and sometimes non-standard ways, it is your responsibility to set the mask according to whatever scheme is in place on your network. Note also that this HEX value Matches the entire TOS octet, meaning both TOS and priority fields. For example: bwmgr em0 -iptos 0x18 -gpriority 8 The above rule will set the global priority (explained later) to 8 for any packets containing either the LOW_DELAY (0x10) or THROUGHPUT (0x08) bits. This implies that 0x10, 0x08 and 0x18 and 0x1E will all Match. IP Protocol Port RulesWhile you *can* use ports in rules to match traffic, its more efficient to use protocol mappings than to use ports. Virtually all port matching has been antiquated by the v3.3 protocol engine. You can still use -port to match a port if the protocol isn't defined, but its recommended that you use -ipprot in most cases. "Special" Protocol DefinitionsThere are several "special" ip protocols defined that arent really IP protocols at all, but they can be quite useful. "Special" protocols are specified with the -ipprot syntax, although some of them actually combine protocols and ports. They represent special cases that are common and they are not definable by protocol and port alone:
*These are described in detail in "Advanced Topics" below Note that user-defined protocols can be added to this internal list of protocols using the "loadprotocols" and /etc/bwmgr-protocols file. See a description of the protocol engine later in this document. URL RulesURL rules are special rules that look into HTTP and FTP frames and seek requests for specific pages or files. URL rules specifically match 2 types of traffic: HTTP GET or POST requests for specific URLs and FTP RETR requests. These can be useful in filtering known attacks (ie default.ida or root.exe) and also for controlling downloads of specific pages or specific types of pages. Suppose Microsoft just released IE 12.0. You could limit only downloads with a "-url iesetup12" rule possibly. Or "-url .exe" to limit all excutables. URL rules with "track" any session that is encountered using the URL. So, for example, if you wanted to limit the download or tarballs, you could use: bwmgr em0 -url .tgz -bwin 64000 -bwout 64000 This would be all that would be necessary to limit the entire download of any file containing ".tgz". ".mp3", ".mpg", ".avi", ".wmv" are other useful choices. URL rules may contain spaces. If a url contains spaces, it must be enclosed with quotation marks: bwmgr em0 -addr 10.1.1.1 -ipprot smtp "foo bar; Its also notable that url rules can be useful as triggers for firewall deny type rules. Suppose, for example, the old "form.pl" virus were to appear again. You could block any such use with: bwmgr em0 -fw -url form.pl -priority fw-deny There is a setting urldecode "URL Decode" that can be enabled to cause the system to read the parameters string as well as the url. So if you wanted to block an exploit such as "page=http://www.url.com", with URL decoding enabled, you could use: bwmgr em0 -fw -url "page=http" -priority fw-deny To set url decoding, use the command:bwmgr urldecode on|off where on enables and off disables.Virtual Host RulesIf you are using name virtual hosts you may have many virtual hosts assigned to the same IP address, in which case limiting the IP address may not be flexible enough. You can use the -nameaddr option to specify a host by name. Note that this feature uses the HTTP header information to determine which host is being accessed, which clearly implies that it will only work on http traffic (AND HTTP 1.1 headers are required). For example: bwmgr em0 -nameaddr www.thishost.com ... The above rule will match http traffic with a host header specifying www.thishost.com. Note that the entire string must match. So if this host could also be addressed as "thishost.com", you could use "-nameaddr thishost.com" which would match both "www.thishost.com" and "thishost.com", but also "anthingelse.thishost.com". -nameaddr rules are special rules which use internal stream tracking to "keep track" of the traffic associated with a name address rule. There is no need (in versions 3.22n and later) to use reverse rule syntax with these rules. Enabling and Disabling RulesYou may want to disable a rule temporarily to allow someone into your network or allow someone out. To disable a rule, use the following syntax: bwmgr em0 disable #### where #### is the rule number to disable. disablefw is used to disable firewall rules. Note that disable internally flags the rule as disabled, and you must use enable to re-enable the rule (unless you delete it and re-add it of course). To reenable a rule or to change its I/O flags, use the enable keyword: bwmgr em0 enable 1000 for the above commands, rule 1000 will be enabled as Incoming and Outgoing (the default), rule 2000 as incoming only, rule 3000 as outgoing and rule 4000 as both. There is no danger in enabling a rule which has not been disabled. Enabling and Disabling Rule by Time of DayRules may optionally be given an "enable time" and "disable time", allowing you to specify when the rule should be active. You may want rules that are only active during certain hours of the day, or only during the week. The default setting is for a rule to be active all of the time. To set up other times, use the following syntax: -timeon XXX-H-0 -timeoff XXX-H-0 where XXX is either ALL (for every day), WEO (for weekends only) or WDO (week days only), and H is the hour of the day in military time (0-23). Only full hour settings are currently supported, so the 3rd parameter must be set to zero. As an example: bwmgr em0 -x 100 -addr 10.1.1.1 -timeon ALL-8-0 -timeoff ALL-17-0 The above setting would enable this rule at 8AM and disable it at 5PM every day. Note that the XXX setting must be the same for both -timeon and -timeoff. Also note that both must be used, as one has no meaning without the other. Time management is performed by the bwmgrd daemon, so it must be running in order for rules to be enabled and disabled. Changing Bandwidth SettingsIf you just want to change the bandwidth settings on a rule, you can use the -changebw to indicate that you are changing the bandwidth on an existing bandwidth rule (don't use this on a rule that doesn't have a bandwidth setting). When you issue a rule by name or index, if there is an old rule with the same name it is actually deleted, and then the new rule is added. If you are gathering stats, this can disrupt the counts and cause some information to be lost. The -changebw option will change the -bwin, -bwout, -bwboth, -bwmin and -bwburst settings safely without affecting any other settings or indexes.For example, suppose you had the following rule in place: bwmgr em0 -x 3000 -addr 100.1.1.1 -ipprot tcp -port www -bwin 64000 -bwout 64000 and you then issued the following: bwmgr em0 -x 3000 -changebw -bwin 128000 -bwout 128000 the resulting rule would be bwmgr em0 -x 3000 -addr 100.1.1.1 -ipprot tcp -port www-bwin 128000 -bwout 128000 Note that all of the matching criteria (address, protocol, port) remain. Notes on LoggingAny rule can be given the "-l" option to enable logging. Note that logging requires that information be written to the system logging system and that the information be written to a file. While logging can be a powerful tool for debugging or intruder detection, you should be aware that excessive logging can and will eat up your systems resources. If, for example, you set a bandwidth rule for a host and enable logging, every single frame that goes to or comes from that host will be logged, which is unacceptable. More acceptable uses of logging might be as follows. Suppose you wanted to know what connections a specific employee of yours was making. You could use the following: bwmgr em0 -addr 207.14.172.1 -prot tcpconnect -l The above rule would log all TCP connect requests from host 207.14.172.1. The information from rules with logging enabled will be sent to LOG_INFO in FreeBSD (kern.info in syslogd) and KERN_DEBUG (kern.debug in syslogd) in LINUX. "Usually", the defaults for these are the file /var/log/messages. The ET/BWMGR Protocol EngineVersion 3.3. introduces a completly remodeled internal protocol engine. All port to protocol mappings are under user control, and groups of ports are maintained internally in a much more efficient manner than using external rules. This allows you to customize the port to protocols mapping to fit your particular needs. Internal Protocols: Many protocols are defined internally, and you can use any internally-defined name in a rule. To get a list of available protocols, use the command: bwmgr getprot all This will display all of the protocols defined by the system. User Defined Protocols: /etc/bwmgr-protocolsUsers can define protocols by manipulating the /etc/bwmgr-protocols file. This file is included in your system distribution with many well-known default settings. Using the protocols file, you can define which ports should be mapped to a specific protocol. This allows you to group ports in a much more efficient manner than using groups of rules. The syntax for /etc/bwmgr-protocols is: port tcp||udp protocol-name so to define the protocol "myprot" on udp port 11472, you'd use: 11473 udp myprot Now suppose that ports 11474 and 12800 also were used in this protocols, you could add the lines: 11474 udp myprot and now when you used the rule: bwmgr em0 -x 5000 -addr 11.1.1.1 -ipprot myprot -bwprofile lotsabandwidth the rule would match on ports 11473, 11474 and 12800. The /etc/user-protocols files is the same format as the bwmgr-protocols file. Its recommended that you define your protocols in the user-protocols file, so that you can use the standard protocols that we include with each release. We'll be updating bwmgr-protocols regularly so any changes you have made with be lost if you want to use our newer file. The loadprotocols commandTo read protocols into the bandwidth manager system, use the loadprotocols command as follows: bwmgr loadprotocols This command is included in your rc.bwmgr file when you do a rebuild or when the GUI rebuilds the file. loadprotocols reads 3 files in the following order: /etc/protocols /etc/protocols defined your actual IP protocols (the ip_p field in an IP packet). bwmgr-protocols and user-protocols read user-defined port mappings as decribed above. Note that later settings will override previous settings, so if you have: 1000 tcp http in bwmgr-protocols and 1000 tcp someprot in user-protocols, port 1000 will be mapped to someprot. Mapping Agents to ProtocolsAnyone hosting a web site knows about crawlers and exploits. The ET/BWMGR allows you to "map" user agents to protocols so you can manage them more easily. Managing user agents in the BWMGR allow you to create central policies for blocking bots, crawlers and exploits without having to create complicated rules for each web site in Apache or by using .htaccessYou can create user agent protocol mappings in the file /etc/bwmgr_agents. Below is an example:
protocol goodbots bots Once you have your file with settings, run the command: bwmgr loadagents After running this command, datastreams with the specified user agent will be mapped to the protocol specified. The purpose of the priority is to specify the importance of the string. Take the following agent string:Mozilla/5.0 (compatible; Yahoo! Slurp/3.0 This might be both Mozilla and Slurp, however Slurp is more specific. So you want to make sure it checks the more specific ones first. By giving Slurp a higher priority, the above agent will map to goodbots instead of http.To see the currently defined agents, use the command: bwmgr getagent all Mapping URLs to ProtocolsYou can use the same principle describe above to map parts of urls to protocols. This is particularly useful for catching exploits on a network-wide basis.You can create URL protocol mappings in the file /etc/bwmgr_urls. Below is an example:
protocol exploits Once you have your file with settings, run the command: bwmgr loadurls As with agents, the priority is to specify the importance of the string.To see the currently defined urls, use the command: bwmgr geturl all Beginning with v3.2, the ET/BWMGR software incorporates a firewall function which is separate from the bandwidth management and priority rules. Each manageable interface on your system can optionally have a firewall, which can help you to control the flow of traffic to and from your network. The purpose of a firewall is to decide which packets are allowed to pass through the network and which packets are not allowed. The default is to allow all traffic. So, if you have no firewall rules enabled, all traffic will pass through the firewall. Typically, you will add rules for traffic that you want to "firewall", or filter, from getting into your network. For example, suppose you don't want anyone on the outside world to access your server whose IP address is 207.11.14.1. You could do the following: bwmgr em0 -fw -addr 207.11.14.1 -priority fw-deny the above syntax selects interface em0 (which would have to be the interface connected to the outside world), uses the -fw flag to specify a firewall rule, and selects the address as the match criteria. The "priority" for firewall rules can be fw-deny, fw-allow or log-only. log-only rules will be discussed later. For now, you can either set a rule to allow, or to deny passage through the firewall. The above rule will cause all traffic to or from 207.11.14.1 to be discarded. This results in this address being inaccessable from outside of interface em0. Setting up the Firewall - Theory of OperationBeginning with v3.2, the ET/BWMGR software incorporates a firewall function which is separate from the bandwidth management and priority rules. Each manageable interface on your system can optionally have a firewall, which can help you to control the flow of traffic to and from your network. The purpose of a firewall is to decide which packets are allowed to pass through the network and which packets are not allowed. The default is to allow all traffic. So, if you have no firewall rules enabled, all traffic will pass through the firewall. Typically, you will add rules for traffic that you want to "firewall", or filter, from getting into your network. For example, suppose you don't want anyone on the outside world to access your server whose IP address is 207.11.14.1. You could do the following: bwmgr em0 -fw -addr 207.11.14.1 -priority fw-deny the above syntax selects interface em0 (which would have to be the interface connected to the outside world), uses the -fw flag to specify a firewall rule, and selects the address as the match criteria. The "priority" for firewall rules can be fw-deny, fw-allow or log-only. log-only rules will be discussed later. For now, you can either set a rule to allow, or to deny passage through the firewall. The above rule will cause all traffic to or from 207.11.14.1 to be discarded. This results in this address being inaccessable from outside of interface em0. Firewall CriteriaFirewall criteria can be selected based on IP address or MAC address (source, destination or either), port, port range or protocol. Combinations are also allowed, so you can do thing like "allow all traffic if the source IP is X and the source MAC is Y, or allow traffic from IP A to IP B but not from IP C to IP B. You can use combinations of rules to achieve your more complex goals. For example, suppose you wanted to deny access to all ports over 1024 on a particular system but allow access to port 4718. You could use the following: bwmgr em0 -x 99 -addr 207.11.14.2 -port 4718 -priority FW-Allow Because rule 99 is before rule 100, it will be checked before rule 100, so you have effectively excluded port 4718 from the range in rule 100. Firewall rules use the same criteria as all other rules, except that bandwidth management and statistical parameters are not allowed. Viewing Firewall Rules with bwmgrUse the "showfw" command with bwmgr to display firewall rules: bwmgr em0 showfw Packets Per Second Firewall RulesA special firewall rule allows you to limit the packets per second (PPS) of any type of traffic to prevent overloading of your network and also to twart DOS (Denial of Service) attacks.When the PPS of the traffic matching a PPS rule exceeds the setting, all addition traffic will be dropped for the current time window. The syntax of a PPS rule is specified with the bwmgr utility with the -ppsin -ppsout -ppsboth options bwmgr em0 -fw -ppsin 5000 -ppsout 5000 -priority fw-deny The above setting would limit the PPS incoming to 5000pps and outgoing to 5000pps individually. To limit the combined PPS, use the -ppsboth option instead: bwmgr em0 -ppsboth 7000 You can also limit the PPS of specific types of traffic, or traffic to or from a specify host. For example: bwmgr em0 -ipprot ICMP -ppsin 1000 The above rule would limit imcoming ICMP packets to 1000pps, which would help thwart Ping attacks or other ICMP indications caused by other types of attacks. Positioning of Packets Per Second RulesPPS firewall rules monitor activity but will not cause a "hit", which means that other rules after them in precedence will continue to be checked. However, if they are placed after other rules that "hit" then they will not be checked. So your PPS rules must be at the beginning of your firewall ruleset, and should be before all other rules. Packets Per Second SuggestionsYou may not know what "safe" or "normal" PPS levels are on your network, so you should first use "benign" pps rules to monitor your network activity before setting your FW-Deny rules. "Benign" rules are PPS rules with a specification of FW-Allow, which means that they dont do anything even if the the specified level is exceeded. Also, when displaying PPS rules with the GUI or with "showfw", the maximum level of packets per second encountered is displayed. By using a benign rule for a few days, you could check to see what the maximum PPS levels are on your network over that time period. For example: bwmgr em0 -ppsin 50000 -ppsout 50000 -priority fw-allow sets a rule for monitoring overall packet per second on the interface. You must set the values to a number that is larger than you ever expect to see, as you will not receive counts when it hits this value. When you display this rule, it will display the "PPS-HIGH" value, which is the max number of PPS that were received since enabling the rule. #bwmgr showfw 1 1 PPS-IN: 50000 PPS-OUT: 50000 PPS-HIGH: (1278/640) Priority: FW-Deny (1234321/0) <IN OUT> When displaying the rule, it shows the setting and also indicates that the high PPS count encountered was 1278 packets per second incoming, and 640 outgoing. You can use this info to determine the normal high levels present on your network. Log-only Firewall RulesFirewall rules can be given a priority of "log-only", which means that a log entry will be written when the rule matches, but subsequent rules will still be checked. It is important to position log-only rules before allow/deny rules, because once an allow or deny rule hits, then no more rules will be checked. A good strategy is to put all of your log rules at the beginning. Example: bwmgr em0 -x 10 -fw -prot tcp -port snmp -l -priority log-only note that you must specify -l to enable logging, it is not automatic. Reverse Firewall RulesReverse firewall rules allow you to use a "trigger rule" to block host addresses based on some action. There rules are described in detail in the reverse rules section below.
Setting up Bandwidth Management RulesSetting Bandwidth Rules and Limits with the bwmgr utilityBandwidth managment rules allow you to customize the way that certain traffic flows through your network. The following section describes how to use the bwmgr utility to set up your bandwidth management criteria. Shared vs Allocated BandwidthAll bandwidth that is not guaranteed is considered by the ET/BWMGR to be "shared" bandwidth. What this means is that bandwidth that is not used by one rule or policy may be used by any other rule on a demand basis. Guaranteed bandwidth must be allocated for a specific policy and will not be available to other policies. Allocated Bandwidth vs Minimum Bandwidth"Allocating" bandwidth is a meaningless concept unless there is a finite pool from which to allocate from. If a rule with a minimum bandwidth allocation is a member of a Group, the bandwidth must be "allocated" from the Group's bandwidth pool, in order to guarantee that other members can't use it. A rule that is not a member of a group will have its bandwidth allocated from the pool of bandwidth available to the Interface. The Group or Interface is said to be the rule's "Container", because it defines the amount of bandwidth available to all of the "members" within its scope. If there is no bandwidth allotment for the rule's Container, then the bandwidth can not be "Guaranteed", because there is no reference to the amount of bandwidth available. In this case, the "guaranteed" bandwidth is simply a minimum bandwidth setting. Auto-ShapingVersion 3.23 adds an "auto-shaping" feature designed to automatically manage network congestion without any "rules" whatsoever. Auto-shaping can be used alone or in co-ordination with any other settings. To enable auto-shaping, simply set -autothresh on an interface: bwmgr em0 -ifac -autothresh 5800000 Typically you would set this to just below your upstream capacity. So if you have 6Mb/s of upstream bandwidth, set the threshold to 5800000. Whenever your network traffic is over the threshold, the auto-shaping mechanism will "kick in" and begin slowing all of the traffic on the network in a very "fair" manner.Note that auto-shaping is a pacing mechanism only and will not apply any hard limit or delay any traffic. So your bandwidth will likely be higher than the threshold, but your congestion (ie backup traffic, queue depths, etc) will be much less. Setting Hard Limits - Allocating Shared Bandwidth with a RuleThe simplest type of bandwidth management rule is the hard limit. Hard limits set a ceiling on the amount of data that a host or type of traffic can use, and will regulate it at the ceiling when operating over the limit. This effectively simulates any data rate you choose regardless of the medium. Limits can be set for incoming or outgoing traffic, or for incoming and outgoing combined. For example: bwmgr em0 -x 500 -addr 100.1.1.1 -bwin 56000 -bwout 128000 This command sets a bandwidth limit of 56000bps for incoming traffic and 128000bps for outgoing traffic. Remember that "incoming" traffic is traffic received on the interface, so if you have a 2 interface system it will be the opposite on the other interface. To set a combined setting, use -bwboth as follows: bwmgr em0 -x 500 -addr 100.1.1.1 -bwboth 64000 This setting will allow the total of incoming + outgoing traffic to be no more than 64000bps. Minimum Bandwidth Allocation"Allocating" bandwidth can be achieved by setting a bandwidth minimum, which defines the minimum data rate that a host or traffic type will get before any action will be taken on the data stream. When the rules container (ie Group tag rule or Interface) has a bandwidth setting, this setting will represent "guaranteed" bandwidth. Without an interface or Group setting, this value represents bandwidth that will be considered high priority. For example: bwmgr em0 -ipprot udp -port 15100 -bwmin 64000 Suppose you have VoIP running on udp port 15100. The above setting will set the minimum bandwidth to 64kbs for the port, giving it the highest priority until the minimum is exceeded. bwmgr em0 -ifac -bwin 1544000 -bwout 1544000 With the above 2 rules, the -bwmin represents a bandwidth guarantee out of the 1544000bps allocated for the Interface. You can mix all of the bandwidth settings in a single rule. Note that -bwmin and -bwburst (discussed below) inherit the "combined" attribute if -bwboth is specified. So, for example, if -bwboth is specified, then -bwmin and -bwburst apply to the combined (incoming + outgoing) total, if -bwboth is not set, then it applied for each direction. Burst Settings on the ET/BWMGRThe ET/BWMGR bursting feature allows 2 levels of limits for each defined rule. This allows you to throttle traffic in a precise manner only when a specific condition is met. In order to define a burst bandwidth allocation for the rule, you must define two parameters, the burst limit and the burst trigger. The burst limit is defined by the -bwburst parameter for a rule. The "trigger" is defined by the -bursttrig parameter. Defining a Burst TriggerAny rule or interface can be a burst trigger. A "burst trigger" is a bandwidth level threshold that is used as a criteria for determining whether a particular rule is allowed to "burst" to its burst setting, or whether it should be limited to its "normal" setting. You define a particular rule as a trigger by setting a burst threshold for the rule. For example: bwmgr em0 -ifac -burstthresh 1000000 This sets the interface em0 as a burst trigger. Any rule that defines fxp0 as their burst trigger will use their -bwburst setting when the traffic level on em0 is under 1Mb/s, and their regular bandwidth limit when fxp0 is above 1Mb/s. Similarly: bwmgr em0 -x 3000 -name fools -group -burstthresh 800000 This rule defines a group with a burst limit of 800000bps. So any rule that defines "fools" as their burst trigger would burst when the traffic level of Group "fools" was under 800000bps. For example: bwmgr em0 -x 100 -addr 211.14.1.1 -bwin 64000 -bwout 64000 -bwburst 256000 -bursttrig fools The above rule specifies that traffic to and from address 211.14.1.1 will be controlled at 64000bps if the usage level of the group "fools" is over 800000bps, and that 211.14.1.1 will get 256000bps when "fools" is below 800000bps. Setting the Maximum Burst DurationThe -burstmax parameter allows you to set a maximum length of time that a rule can burst. This is designed to prevent long downloads or uploads. With a burstmax setting of 10, for example, the rule with allow "bursting" (which is activity over the standard bandwidth setting) for 10 seconds, and then will not allow bursting again until the rule has activity under its normal bandwidth allotment. So with a continuous download, the rule will be limited to its regular bandwidth setting (non-burst) until the transfer is completed. Changing The Burst Reset (unburst) PeriodRules using the -burstmax setting need a criteria for determining when the traffic has subsided adaquately. The default setting is 10 seconds. What this means is that once a rule has bursted for its max burst period, the traffic must slow below its non-burst limit for at least unburst seconds before its allowed to burst again. To change the unburst setting, use the following: bwmgr unburst 20 Defining a Burst Limit for a Bandwidth RuleEach rule can be given a -bwburst setting which defines the maximum amount of bandwith the rule can use when the burst trigger is below its threshold. When traffic levels on the burst trigger are above the threshold, bursting is disabled. When traffic levels are below the threshold, bursting is enabled. Note that starting in v3.21, the "default" burst is wire speed (ie no limit). In previous versions if you didnt specify a -bwburst setting for a rule, the default was to limit to the normal bandwidth setting all the time. Now you must explicitly set the -bwburst. For example: bwmgr em0 -ifac -burstthresh 1000000 The above settings would set the burst threshold to 1000000bps on interface em0. The second setting (-x 800) would set traffic to and from address 100.1.1.1 to 56000bps when traffic on the interface is above 1Mb/s, and to 512000bps when traffic is below 1Mb/s. The third rule (-x 900) sets a hard limit on address 100.1.1.2 to 128000bps (no -bwburst setting). The third rule (-x 1000) allows bursting to wire speed (ie no bandwidth limit), with a below-threshold limit set to 128000bps, and a maximum burst duration of 20 seconds. Note that bursting is effectively disabled for a rule if no burst trigger is defined. Setting Asymetrical Burst RatesIf you want to set different burst rates from each direction, you will have to create two rules. Normally you can create a single rule which controls traffic in both directions, but bursting follows the "both" flag, that is its either the same for both directions or it uses a combined value. Typically you are really only controlling traffic in one direction (in for "client" traffic and out for "server" traffic), so it doesnt much matter. But if you want different burst rates in different directions, simply create an incoming rule with the "in" settings, and an outgoing rule for the "out" settings. For example: bwmgr em0 -o -addr 10.1.1.1 -bwout 128000 -bwburst 512000 -bwmin 32000 The above -i and -o flag tell the ET/BWMGR to only enforce the rule in the appropriate direction. Setting a Burst PeriodThe "burst period" is the window within which the BurstManager will gather bandwidth information about a trigger and enable or disable bursting. Traffic usage is continuously averaged over the period. Longer periods may increase the amount of time that rules may burst, as the longer into the period high activity begins, the longer it will take the average to reach the threshold. Note that values under 10 seconds are not recommended. Interface Level Bandwidth ControlYou may want to limit a complete interface to a specific amount of bandwidth, regardless of the traffic type. You can set a bandwidth limit for the entire interface by specifying the -ifac option. For example: bwmgr em0 -ifac -bwin 800000 -bwout 800000 The above commnad will set an overall bandwidth limit of 800000 in and out for the interface. This limit is absolute (except for pass-thru rules), so no more than 800000 would be allowed to pass regardless of other rules present. This implies that: bwmgr em0 -ifac -bwboth 800000 with the above rules, host 10.1.1.1 would not be able to get more than 800000 even though its individual limit is higher. Interface bandwidth limits are useful for defining how much actual bandwidth there is available at your network edge. For the purposed of priorities and bandwidth allocation, setting the outside interface (ie the adapter connected to your edge router's side of the network) to the bandwidth you have (such at 45Mb/s if you have a T3), or the maximum bandwidth you want to use. With an interface bandwidth limit, minimum settings become guaranteed bandwidth on the interface. Without an interface limit, you are only guaranteeing access to the local wire, which may not be what you want to do. Note that if you have no rules on an interface, you could alternatively use: bwmgr em0 -bwboth 800000 as a single rule which limits all the traffic on the interface without setting an interface limit. TCP Rate LimitingTCP rate limiting is a powerful bandwidth management technique that reduces the amount of traffic in your network and potentially slows each TCP session by reducing the TCP receive window. While some products on the market use rate limiting as their primary bandwidth management mechanism, there are undesireable results when windows are dropped too low, as overhead on your network in terms of the number of packets and bandwidth usage can significantly increase. Because of this, the ET/BWMGR uses rate limiting as one of several mechanisms to manage your network without having an adverse effect on overall traffic volumes. Specifying a Minimum Window SizeWhen you set a rule with a bandwidth limit, the ET/BWMGR will use rate limiting as well as other techniques to slow the data rate to not exceed what you specify. However most servers do not honor window "granularity" in that they want to only send full windows of data if possible. Because of this, i f you are running a single session (say a download) on an IP address rule, you will see numbers lower than the limit. This is because the proper window setting for a session may be 1800, but the effective window is 1500 because of the full-window issue. If you have many sessions on a rule (such as a NAT'd client or a server), this is exactly what you want, as you want to force the sessions below the limit until a balance occurs. However if you need a single session to be able to attain the full bandwidth limit, you can specify a minimum widow to use so that the sessions will not be pushed below the point at which they can achieve full bandwidth throughput. For example: bwmgr em0 -x 1000 -addr 10.1.1.1 -bwboth 512000 -tcpwindow 4500 The above rule will tell the rule to use not set a window below 4500 (which is 3 full packets). The ideal window size varies from connection to connection (depending on intrinsic delays), so there is no exact answer to what this setting should be. You can eliminate TCP window manipulation altogether by setting the window to 64000. While this may seem to be a good way to assure that any connection can reach any bandwidth limit specified, it also defeats one of the primary purposes of bandwidth management, which is to reduce the traffic flows in your network to reduce delays, avoid congestion and reduce the need to drop packets, so you need to weight your objectives carefully. Per Session Bandwidth Management - Rate LimitingTCP rate limiting effectively is a "per session" method of controlling traffic. Each TCP session within a container is automatically controlled. When you set a bandwidth limit, the default behavior of the software is to use an internal "adaptive window". The adaptive window algorithm attempts to reduce the window based on the traffic flows, setting it just where the traffic flows at the rate specified without excessive backup. The adaptive window will not go below 1 full packet (1500 bytes), so it will not increase the overhead on your network as some rate limiting products do. You can effectively "shape" traffic without limiting it by creating a container with a bandwidth setting that is just below your available bandwidth. So for example, if you have 3Mb/s of bandwidth, you could rate shape all traffic with : bwmgr em0 -ipprot tcp -bwlink GroupA -bwin 3000000 -bwout 3000000 While this may seem trivial, it in fact is quite powerful. The rule with Match all tcp traffic and limit it to 3Mb/s. But the effect of the adaptive window management is to slow each session equally to create overall fairness within the usage of the bandwidth limit. It will also maintain minimum flows, reduce the expectation that a drop will occur, and create a scenario with minimum delay for tcp traffic. Of course window shaping only works on TCP traffic so you'll need other rules to control other traffic. But this illustrates how you can substantially improve your network flows with a minimum of controls. Global Controls for Rate LimitingBy default, traffic is not shaped or limiting in any way unless you set a specific rule that matches the traffic type. In order to reduce overall traffic on your network, you could set an interface "default" tcp window, which would apply to all TCP traffic passing through the interface. bwmgr em0 -ifac -tcpwindow 4000 This would establish a default minimum window of 4000 for all data frames passing through em0. This default is used if no other settings apply to the data frame. You can override the interface default with a -tcpwindow setting in an individual rule, however the interface window will also override the internal rate limiting parameters. For example: bwmgr em0 -ifac -tcpwindow 4000 With these 3 settings, address 10.1.1.1 would be limited to 56000bps and have a minimum TCP window of 1500, while address 11.1.1.1 would be limited to 56000bps and have a minimum window of 4000. Packets Per Second Bandwidth RulesPacket per second rules can also be used to control users. PPS rules create a loosely-defined bandwidth limit which adjusts for the possibility that many small packets can use up resources even at low bandwidth levels. Give that a maximum packet is (usually) 1500 bytes and a minimum is usually 60 bytes, you can use a pps rule to give a wide range of capability to an end user or application without giving them unlimited bandwidth. So the following: bwmgr fxp2 -x 4000 -name AcmeCorp -addr 192.168.17.1 -ppsin 300 -ppsout 300 would limit the throughout of the specified address to 300 packets/second. This translates to a bandwidth limit of between 144000bps and 2.4Mb/s depending on the average packet size of their transactions. Note that there is no burst setting for packets per second rules. Combining Global Rules for Bandwidth ManagementUsing global rules, you can set multiple control criteria for traffic that matches multiple rules. For example: bwmgr fxp2 -x 1000 -addr 10.1.1.0 -addrmsk 255.255.255.0
-bwin 1000000 -bwout 1000000 -global The above allows you to set a limit for a class C without having to create a group. Since rule 1000 is a global rule, it will be enforced in addition to rule 1200 for traffic matching .17. Previous to version 3.24, you could only have done this in a group. Combined BW and PPS rulesBeginning with 3.24b, rules can have both bandwidth and PPS settings. This allows you to create a single rule that can control by both bandwidth volume and activity level. bwmgr em1 -x 500 -addr 10.1.1.1 -ppsin 100 -ppsout 100 -bwin 512000 -bwout 512000 The above rule would limit address 10.1.1.1 to the EITHER 100pps or 512000bps. If all packets are 1500 bytes, a setting of 100pps could allow as much as 1.2Mb/s of bandwidth, which may be more than you want. So adding the bandwidth setting will ALSO cap the rule at 512000. This rule allows both criteria to be estabished in a single rule. With 60 byte packets 100pps allows for only 48Kb/s. Using Bandwidth ProfilesBandwidth profiles are templates that allow you to apply common settings to any number of rules. What is a "Profile"A profile is a bandwidth service description that can be referenced by name. The service components are as follows:
Each "profile" has a name and a unique identifier, as well as time of day attributes. For Example:
The above profile defines a profile description named "default", which defines a profile of the same name. The Profile ID and Profile name are case-insensitive (ie Default = default). Typically, if the "When" field is "Always", it makes the most sense to have the profile ID the same as the profile name for simplicity. The bandwidth profile for this description is 256,000bps incoming, 256,000bps outgoing and no bursting. Note that all settings in profiles are K (not really Kilos, but 1000s, so 512 is 512000). Defining Bandwidth ProfilesProfiles are defined from within the HTML GUI. See the ET/BWMGR HTML manual for info on how to define profiles. Applying Bandwidth ProfilesTo apply a profile to a rule, use the -bwprofile specifier. bwmgr em0 -x 1000 -addr 192.168.17.11 -bwprofile default The above would apply the settings of the current "default" profile to the rule, as if you had entered them individually. Note: In the CLI, do NOT specify any specific bandwidth settings in the same command with -bwprofile or you may get the wrong results. In the HTML interface, other settings are ignored when a profile is specified. The Effect of Using Bandwidth ProfilesAt first glance, bandwidth profiles might just appear to be a shortcut for entering rules. But they are much more than that. Profiles are a vehicle for managing large rule sets, and also for implementing large-scale SLAs (service level agreements). Firstly, profiles are not only applied when you create the rule. If you change a profile, ALL of the rules which reference the modified profile will be changed accordingly. So if you have hundreds of customers/users who are using the "default" profile, you can modify global behavior of all of them that reference a specific profile in a single operation. Profile TransitionsService levels often (and should) have a time component, and different settings may apply at different times of day. Using the "When" setting with profiles, you can define settings for different times of day:
The above settings define "night" and "early" times of day, with different profile settings for each. A profile is "applied" to all of the rules referencing it at the start time, which is 7AM for default_early and 7PM for default_night. Note that the stop time is not used for profile transitions, it is only a reference so that it can be determined if the profile is active at any given time of day. This implies that "holes" in your time settings are simply ignored: if you had set default_early to start at 7AM and end at 1PM, it still would be applied until 7PM because that is when the next transition takes place. Profiles cannot be turned "off", they are simple overidden by other transitioning profiles. To take the service level implementation to the next level, you can define other settings that only apply on weekends. This requires that you set default_early and default_late to WDO (weekday only), and you define a third profile which references "default" to apply on weekends. For example:
Now the default service level has 3 settings, one for early times during weekdays, one for late times during weekdays, and one for weekends. Implementing Tiered SLAs with ET/BWMGR profilesA simple example of a tiered SLA (service level agreement) would involve defining profiles for various service levels, and then applying them to customers/users who subscribe to that level of service.
Using the above simplistic settings, you have 4 distinct levels of service that simplify the adding new customers. bwmgr em0 -name cust_a -addr 192.168.17.1 -bwprofile default
|
|
| Sep 10 2010 10:02 PM EDT | 4430899 requests since Sep 04 2004 12:00 AM EDT |
| Copyright © 2003-2008 Emerging Technologies |