Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- # if FORWARD chain doesnt have the rules, add them
- # Check whether chains exists
- if ! iptables -nL TRAFFIC_ACCT_IN >/dev/null 2>&1
- then
- iptables -N TRAFFIC_ACCT_IN
- fi
- if ! iptables -nL TRAFFIC_ACCT_OUT >/dev/null 2>&1
- then
- iptables -N TRAFFIC_ACCT_OUT
- fi
- iptables -C FORWARD -i pppoe-wan -j TRAFFIC_ACCT_IN
- if [ $? == 1 ]
- then
- {
- iptables -I FORWARD -i pppoe-wan -j TRAFFIC_ACCT_IN
- }
- fi
- iptables -C FORWARD -o pppoe-wan -j TRAFFIC_ACCT_OUT
- if [ $? == 1 ]
- then
- {
- iptables -I FORWARD -o pppoe-wan -j TRAFFIC_ACCT_OUT
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.101 -m comment --comment "ahmar-laptop-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.101 -m comment --comment "ahmar-laptop-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.101 -m comment --comment "ahmar-laptop-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.101 -m comment --comment "ahmar-laptop-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.102 -m comment --comment "ahmar-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.102 -m comment --comment "ahmar-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.102 -m comment --comment "ahmar-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.102 -m comment --comment "ahmar-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.103 -m comment --comment "iqra-tab-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.103 -m comment --comment "iqra-tab-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.103 -m comment --comment "iqra-tab-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.103 -m comment --comment "iqra-tab-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.104 -m comment --comment "iqra-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.104 -m comment --comment "iqra-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.104 -m comment --comment "iqra-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.104 -m comment --comment "iqra-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.111 -m comment --comment "adnan-laptop-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.111 -m comment --comment "adnan-laptop-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.111 -m comment --comment "adnan-laptop-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.111 -m comment --comment "adnan-laptop-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.112 -m comment --comment "adnan-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.112 -m comment --comment "adnan-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.112 -m comment --comment "adnan-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.112 -m comment --comment "adnan-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.113 -m comment --comment "sunara-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.113 -m comment --comment "sunara-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.113 -m comment --comment "sunara-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.113 -m comment --comment "sunara-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.114 -m comment --comment "wasim-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.114 -m comment --comment "wasim-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.114 -m comment --comment "wasim-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.114 -m comment --comment "wasim-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.115 -m comment --comment "ijaz-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.115 -m comment --comment "ijaz-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.115 -m comment --comment "ijaz-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.115 -m comment --comment "ijaz-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.116 -m comment --comment "shahbaz-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.116 -m comment --comment "shahbaz-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.116 -m comment --comment "shahbaz-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.116 -m comment --comment "shahbaz-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.117 -m comment --comment "nomi1-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.117 -m comment --comment "nomi1-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.117 -m comment --comment "nomi1-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.117 -m comment --comment "nomi1-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.118 -m comment --comment "nomi2-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.118 -m comment --comment "nomi2-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.118 -m comment --comment "nomi2-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.118 -m comment --comment "nomi2-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.119 -m comment --comment "nomi-laptop-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.119 -m comment --comment "nomi-laptop-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.119 -m comment --comment "nomi-laptop-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.119 -m comment --comment "nomi-laptop-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.120 -m comment --comment "sami-mobile-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.120 -m comment --comment "sami-mobile-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.120 -m comment --comment "sami-mobile-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.120 -m comment --comment "sami-mobile-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.131 -m comment --comment "baloch1-device-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.131 -m comment --comment "baloch1-device-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.131 -m comment --comment "baloch1-device-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.131 -m comment --comment "baloch1-device-out"
- }
- fi
- iptables -C TRAFFIC_ACCT_IN --dst 192.168.1.132 -m comment --comment "baloch2-device-in"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_IN --dst 192.168.1.132 -m comment --comment "baloch2-device-in"
- }
- fi
- iptables -C TRAFFIC_ACCT_OUT --src 192.168.1.132 -m comment --comment "baloch2-device-out"
- if [ $? == 1 ]
- then
- {
- iptables -A TRAFFIC_ACCT_OUT --src 192.168.1.132 -m comment --comment "baloch2-device-out"
- }
- fi
- /etc/init.d/luci_statistics restart
- # end of script
Add Comment
Please, Sign In to add comment