Advanced Linux Routing and Flow control: Easy Recipes

Source: Internet
Author: User
Keywords Linux easy recipes advanced routing
Tags advanced advanced routing aliyun apache bandwidth control customers different

This chapter contains a number of "convenience recipes", hoping to help you solve practical problems. Convenience recipes cannot replace the principle of understanding, so you should still focus on the inner truth.

1. Run multiple Web sites with different SLAs.

There are a number of ways you can achieve this. Http://www.aliyun.com/zixun/aggregation/14417.html ">apache Some of the modules can support this feature, but we'll show you how Linux handles the problem and can provide a variety of other services." These commands were stolen from Jamal Hadi's demo.

For example, 11545.html "> We have two customers, we need HTTP, FTP and audio streaming services, we need to sell them a certain amount of bandwidth." We do this on the server.

A customers should have up to 2Mbps of bandwidth, b customers pay 5M of money. We assign different IP addresses on the server to differentiate them.

# IP address add 188.177.166.1 dev eth0
# IP address add 188.177.166.2 dev eth0

Assigning those IP addresses to the server is entirely up to you. All current daemons support this feature.

We first attach a cbq queue rule to the eth0:

# TC Qdisc Add dev eth0 root handle 1:CBQ bandwidth 10Mbit cell 8 AVPKT 1000 \
MPU 64

Create classes for our customers:

# TC class Add dev eth0 parent 1:0 classid 1:1 CBQ bandwidth 10Mbit rate \
2MBit AVPKT 1000 prio 5 bounded isolated allot 1514 weight 1 Maxburst 21
# TC class Add dev eth0 parent 1:0 classid 1:2 CBQ bandwidth 10Mbit rate \
5Mbit AVPKT 1000 prio 5 bounded isolated allot 1514 weight 1 Maxburst 21

Then add filters for our customers:

# #求助: Why This line, what does it does, what is a divisor?:
# #求助: A divisor super-delegates something to does with a hash table, and the number of
# # Buckets-ahu
# TC Filter Add dev eth0 parent 1:0 Kyoto IP prio 5 handle 1:u32 divisor 1
# TC Filter Add dev eth0 parent 1:0 prio 5 u32 match ip src 188.177.166.1
Flowid 1:1
# TC Filter Add dev eth0 parent 1:0 prio 5 u32 match ip src 188.177.166.2
Flowid 1:2

It's done.

Help: Why no token bucket filter? Is there a default pfifo_fast fallback somewhere?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.