[root@centos5 ~]# cp /root/tuzfal.scp /root/tuzfal.scp.old |
# NAT GEP1, GEP2, GEP3 ---------------------------------------------------------------- $IPTABLES -A FORWARD -s $GEPIP1 -j ACCEPT #$IPTABLES -t nat -A POSTROUTING -s $GEPIP1 -o $IFACE_EXT -j LOG --log-prefix "NAT-gep1 " $IPTABLES -t nat -A POSTROUTING -s $GEPIP1 -o $IFACE_EXT -j SNAT --to-source $IP_EXT # $IPTABLES -A FORWARD -s $GEPIP2 -j ACCEPT #$IPTABLES -t nat -A POSTROUTING -s $GEPIP2 -o $IFACE_EXT -j LOG --log-prefix "NAT-gep2 " $IPTABLES -t nat -A POSTROUTING -s $GEPIP2 -o $IFACE_EXT -j SNAT --to-source $IP_EXT # $IPTABLES -A FORWARD -s $GEPIP3 -j ACCEPT #$IPTABLES -t nat -A POSTROUTING -s $GEPIP3 -o $IFACE_EXT -j LOG --log-prefix "NAT-gep3 " $IPTABLES -t nat -A POSTROUTING -s $GEPIP3 -o $IFACE_EXT -j SNAT --to-source $IP_EXT |
# Csomagok megjelolese # Letoltes $IPTABLES -t mangle -A FORWARD -s ! $NET_INT -d $GEPIP1 -j MARK --set-mark 4 $IPTABLES -t mangle -A FORWARD -s ! $NET_INT -d $GEPIP2 -j MARK --set-mark 6 $IPTABLES -t mangle -A FORWARD -s ! $NET_INT -d $GEPIP3 -j MARK --set-mark 8 # # Feltoltes $IPTABLES -t mangle -A FORWARD -s $GEPIP1 -j MARK --set-mark 3 $IPTABLES -t mangle -A FORWARD -s $GEPIP2 -j MARK --set-mark 5 $IPTABLES -t mangle -A FORWARD -s $GEPIP3 -j MARK --set-mark 7 # |
#!/bin/sh # Simple init.d shell script that can to modified to fit your favorite distro # All Rates are in Kbits, so in order to gets Bytes divide by 8 # e.g. 25Kbps == 3.125KB/s # TC=/sbin/tc ETH_BE=eth0 ETH_KI=eth1 # DNLD1=396Kbit # DOWNLOAD Limit1 DWEIGHT1=40Kbit # DOWNLOAD Weight Factor ~ 1/10 of DOWNLOAD Limit UPLD1=196KBit # UPLOAD Limit UWEIGHT1=25Kbit # UPLOAD Weight Factor # DNLD2=256Kbit # DOWNLOAD Limit2 DWEIGHT2=25Kbit # DOWNLOAD Weight Factor ~ 1/10 of DOWNLOAD Limit UPLD2=96KBit # UPLOAD Limit2 UWEIGHT2=20Kbit # UPLOAD Weight Factor # DNLD3=128Kbit # DOWNLOAD Limit3 DWEIGHT3=12Kbit # DOWNLOAD Weight Factor ~ 1/10 of DOWNLOAD Limit UPLD3=32KBit # UPLOAD Limit3 UWEIGHT3=15Kbit # UPLOAD Weight Factor # tc_start() { $TC qdisc add dev $ETH_KI root handle 11: cbq bandwidth 100Mbit avpkt 1000 mpu 64 $TC class add dev $ETH_KI parent 11:0 classid 11:1 cbq rate $DNLD1 weight $DWEIGHT1 allot 1514 prio 1 avpkt 1000 bounded $TC class add dev $ETH_KI parent 11:0 classid 11:2 cbq rate $DNLD2 weight $DWEIGHT2 allot 1514 prio 1 avpkt 1000 bounded $TC class add dev $ETH_KI parent 11:0 classid 11:3 cbq rate $DNLD3 weight $DWEIGHT3 allot 1514 prio 1 avpkt 1000 bounded $TC filter add dev $ETH_KI parent 11:0 protocol ip handle 4 fw flowid 11:1 $TC filter add dev $ETH_KI parent 11:0 protocol ip handle 6 fw flowid 11:2 $TC filter add dev $ETH_KI parent 11:0 protocol ip handle 8 fw flowid 11:3 $TC qdisc add dev $ETH_BE root handle 10: cbq bandwidth 10Mbit avpkt 1000 mpu 64 $TC class add dev $ETH_BE parent 10:0 classid 10:1 cbq rate $UPLD1 weight $UWEIGHT1 allot 1514 prio 1 avpkt 1000 bounded $TC class add dev $ETH_BE parent 10:0 classid 10:2 cbq rate $UPLD2 weight $UWEIGHT2 allot 1514 prio 1 avpkt 1000 bounded $TC class add dev $ETH_BE parent 10:0 classid 10:3 cbq rate $UPLD3 weight $UWEIGHT3 allot 1514 prio 1 avpkt 1000 bounded $TC filter add dev $ETH_BE parent 10:0 protocol ip handle 3 fw flowid 10:1 $TC filter add dev $ETH_BE parent 10:0 protocol ip handle 5 fw flowid 10:2 $TC filter add dev $ETH_BE parent 10:0 protocol ip handle 7 fw flowid 10:3 } tc_stop() { $TC qdisc del dev $ETH_KI root $TC qdisc del dev $ETH_BE root } tc_restart() { tc_stop sleep 1 tc_start } tc_show() { echo "" echo "$ETH_KI:" $TC qdisc show dev $ETH_KI $TC class show dev $ETH_KI $TC filter show dev $ETH_KI echo "" echo "$ETH_BE:" $TC qdisc show dev $ETH_BE $TC class show dev $ETH_BE $TC filter show dev $ETH_BE echo "" } case "$1" in start) echo -n "Starting bandwidth shaping: " tc_start echo "done" ;; stop) echo -n "Stopping bandwidth shaping: " tc_stop echo "done" ;; restart) echo -n "Restarting bandwidth shaping: " tc_restart echo "done" ;; show) tc_show ;; *) echo "Az alabbi parameterek lehetsegesek: /etc/init.d/tc.sh {start|stop|restart|show}" ;; esac exit 0 |
[root@centos5 ~]# chmod +x /root/savszel.scp |
[root@centos ~]# cat /etc/rc.d/rc.local #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local /root/tuzfal.scp start /root/savszel.scp start |
[root@centos5 ~]# /root/tuzfal.scp start |
[root@centos5 ~]# /root/savszel.scp start |