tc

 

 

 

 

 

[root@evpn2 ~]# tc qdisc add dev p0a ingress
-bash: tc: command not found
[root@evpn2 ~]# yum install iproute-tc

 

[root@localhost ~]# tc filter show dev enahisic2i0 root
[root@localhost ~]# tc filter show dev enahisic2i0 

 

[root@localhost ~]# tc filter show dev enahisic2i0 root
[root@localhost ~]# tc filter show dev enahisic2i0 
[root@localhost ~]# tc filter add dev enahisic2i0 parent ffff: protocol ip pref 33 flower  src_ip 10.10.16.82 action drop
[root@localhost ~]# tc filter show dev enahisic2i0 
[root@localhost ~]# 
[root@localhost ~]# tc filter show dev enahisic2i0 
[root@localhost ~]# tc filter show dev enahisic2i0 
[root@localhost ~]# tc filter show dev enahisic2i0 
[root@localhost ~]# tc filter show dev enahisic2i0 
[root@localhost ~]# tc filter show dev enahisic2i0 
[root@localhost ~]# tc filter show dev enahisic2i0 root
filter parent ffff: protocol ip pref 33 flower 
filter parent ffff: protocol ip pref 33 flower handle 0x1 
  eth_type ipv4
  src_ip 10.10.16.82
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1
 
[root@localhost ~]# 
 
[root@localhost ~]# tc filter del dev enahisic2i0 parent ffff: protocol ip pref 33 flower  src_ip 10.10.16.82 action drop
[root@localhost ~]#

 

[root@localhost ~]# tc filter show dev enahisic2i0 ingress root 
Error: "root" is duplicate parent ID
[root@localhost ~]# tc filter show dev enahisic2i0  ingress
filter parent ffff: protocol ip pref 33 flower 
filter parent ffff: protocol ip pref 33 flower handle 0x1 
  eth_type ipv4
  src_ip 10.10.16.82
  not_in_hw
        action order 1: gact action drop
         random type none pass val 0
         index 1 ref 1 bind 1
 
[root@localhost ~]# 

 

 

 

 

 

 

 

[root@localhost ~]# tc qdisc add dev enahisic2i0  root handle 1: htb

[root@localhost ~]# tc class add dev enahisic2i0  parent 1: classid 1:100 htb rate 100kbit

[root@localhost ~]# tc class add dev enahisic2i0 parent 1: classid 1:100 htb rate 100kbit
[root@localhost ~]# tc filter show dev enahisic2i0 root
filter parent ffff: protocol ip pref 33 flower
filter parent ffff: protocol ip pref 33 flower handle 0x1
eth_type ipv4
src_ip 10.10.16.82
not_in_hw
action order 1: gact action drop
random type none pass val 0
index 1 ref 1 bind 1

[root@localhost ~]#



#! /bin/bash
#
# Restore the tc configuration
# This Traffic Control configuration allows a better use of the ADSL outbound
# traffic.
#
 
 
# Router configuration
DEV=eth1
QLEN=100
MTU=1492
RATEUP=420      # kbit
RATEMIN=10      # kbit
DEFAULT_PRIO=15
 
 
# Get lsb functions
. /lib/lsb/init-functions
 
 
# Flush current configuration
log_begin_msg "Flushing tc configuration..."
tc qdisc del dev $DEV root
log_end_msg $?
 
 
# Set new configuration
log_begin_msg "Setting tc configuration..."
 
ip link set dev $DEV qlen $QLEN mtu $MTU
 
tc qdisc add dev $DEV root handle 1: htb default $DEFAULT_PRIO
  tc class add dev $DEV parent 1: classid 1:1 htb rate ${RATEUP}kbit
 
    tc class add dev $DEV parent 1:1 classid 1:10 htb rate ${RATEMIN}kbit ceil ${RATEUP}kbit prio 0
    tc class add dev $DEV parent 1:1 classid 1:11 htb rate ${RATEMIN}kbit ceil ${RATEUP}kbit prio 1
    tc class add dev $DEV parent 1:1 classid 1:12 htb rate ${RATEMIN}kbit ceil ${RATEUP}kbit prio 2
    tc class add dev $DEV parent 1:1 classid 1:13 htb rate ${RATEMIN}kbit ceil ${RATEUP}kbit prio 3
    tc class add dev $DEV parent 1:1 classid 1:14 htb rate ${RATEMIN}kbit ceil ${RATEUP}kbit prio 4
    tc class add dev $DEV parent 1:1 classid 1:15 htb rate ${RATEMIN}kbit ceil ${RATEUP}kbit prio 5
    tc class add dev $DEV parent 1:1 classid 1:16 htb rate ${RATEMIN}kbit ceil ${RATEUP}kbit prio 6
    tc class add dev $DEV parent 1:1 classid 1:17 htb rate ${RATEMIN}kbit ceil ${RATEUP}kbit prio 7
 
      tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
      tc qdisc add dev $DEV parent 1:11 handle 11: sfq perturb 10
      tc qdisc add dev $DEV parent 1:12 handle 12: sfq perturb 10
      tc qdisc add dev $DEV parent 1:13 handle 13: sfq perturb 10
      tc qdisc add dev $DEV parent 1:14 handle 14: sfq perturb 10
      tc qdisc add dev $DEV parent 1:15 handle 15: sfq perturb 10
      tc qdisc add dev $DEV parent 1:16 handle 16: sfq perturb 10
      tc qdisc add dev $DEV parent 1:17 handle 17: sfq perturb 10
 
tc filter add dev $DEV parent 1: prio 0 protocol ip handle 10 fw flowid 1:10
tc filter add dev $DEV parent 1: prio 0 protocol ip handle 11 fw flowid 1:11
tc filter add dev $DEV parent 1: prio 0 protocol ip handle 12 fw flowid 1:12
tc filter add dev $DEV parent 1: prio 0 protocol ip handle 13 fw flowid 1:13
tc filter add dev $DEV parent 1: prio 0 protocol ip handle 14 fw flowid 1:14
tc filter add dev $DEV parent 1: prio 0 protocol ip handle 15 fw flowid 1:15
tc filter add dev $DEV parent 1: prio 0 protocol ip handle 16 fw flowid 1:16
tc filter add dev $DEV parent 1: prio 0 protocol ip handle 17 fw flowid 1:17
 
log_end_msg $?

 

posted on 2020-04-29 15:17  tycoon3  阅读(588)  评论(0编辑  收藏  举报

导航