Bandwidth control script for some ips


#!/bin/bash

BANDWIDTH_KBIT=7000
BANDWIDTH_INTERFACE=eth0
FINAL_IPs_WITH_BANDWIDTH_CONTROL=(7 8 50 111)
LAN_IP=$( ip addr show $BANDWIDTH_INTERFACE | grep -Eo '([0-9]{1,3}\.){3}' | sed -n 1p )

# clear all tc rules
tc qdisc del dev $BANDWIDTH_INTERFACE root

# create tc rules
tc qdisc add dev $BANDWIDTH_INTERFACE root handle 1: htb

for i in ${FINAL_IPs_WITH_BANDWIDTH_CONTROL[*]}; do
  tc class add dev $BANDWIDTH_INTERFACE classid 1:${i} htb rate ${BANDWIDTH_KBIT}kbit
  tc filter add dev $BANDWIDTH_INTERFACE parent 1: protocol ip prio 1 u32 match ip dst $LAN_IP${i} flowid 1:${i}
done

to list only machines that have traffic
tc -s -d class show dev eth0 | awk '$1 == "Sent" && $2 { print "\n"x; print } { x=$0 }'

to list only machines that have traffic order by traffic usage
tc -s -d class show dev eth0 | awk 'BEGIN{ ORS=" " } $1 == "Sent" && $2 { print "\n"x; print } { x=$0 }' | cut -d' ' -f1,3,9,10,29,30 | sort -k6n

Mobile Access SSL Network Extender (SNX) remote users with Windows 11 24H2 fail to connect

  Cause The conflict resolution mechanism in Windows 11 24H2 is different than in earlier versions of Windows. Solution On the Windows endpo...

Mais vistos