วันอาทิตย์ที่ 3 สิงหาคม พ.ศ. 2557

Load Balance using PCC method in mikrotik

Load Balance using PCC method in mikrotik


load balancing is to share Internet access via two or more internet connections are balanced (balance), do not have to wait a full connection and then just move to the next connection.


During this time many of us who think wrong, that by using loadbalance two connection lines, the large bandwidth that we'll get double the bandwidth before using loadbalance (accumulation of both the bandwidth). This needs to be clear first, that loadbalance will not add much bandwidth we get, but only served to divide the traffic from both the bandwidth so they can be used in a balanced manner.


With this article, we will prove that the use of mathematical formulas loadbalancing does not like 512 + 256 = 768, but 512 + 256 = 512 + 256, or 512 + 256 = 256 + 256 + 256.


In this article we use RB433UAH with conditions as follows:

  1. Ether1 and ether2 connected to different ISPs with large bandwdith different. ISP1 and ISP2 at 512kbps at 256kbps.
  2. We will use an internal web-proxy and use OpenDNS.
  3. RouterOS you are using version 4.5 because the PCC has become a popular feature at the 3:24 version.



If the above condition is different from the network conditions at your house, then the configuration that we describe here will have to match you with the configuration for the network at your house.


If we have configure like this:

with command in the mikrotik:

/ip address
add address=192.168.101.2/30 interface=ether1
add address=192.168.102.2/30 interface=ether2


add address=10.10.10.1/24 interface=wlan2
/ip dns
set allow-remote-requests=yes primary-dns=208.67.222.222 secondary-dns=208.67.220.220


For client connections, we use a wireless connection at wlan2 by client IP range 10.10.10.2 s / d 10.10.10.254 netmask 255.255.255.0, which matched the IP 10.10.10.1 on wlan2 serves as a gateway and dns server from the client. If you use DNS from one of your isp, then there will be additional mangle shall we give sign of thickness

After pengkonfigurasian IP and DNS are correct, we must pair the default route to each of our ISP gateway IP for the router to forward all traffic that does not connect him to the gateway. Here we use feature check-gateway and gateway is useful if one of us dropped out, then the connection will be diverted to other gateways.

/ip route
add dst-address=0.0.0.0/0 gateway=192.168.101.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.102.1 distance=2 check-gateway=ping

For Access Point settings so the PC can connect to the wireless client, we use the command

/interface wireless
set wlan2 mode=ap-bridge band=2.4ghz-b/g ssid=Mikrotik disabled=no

In order for the client pc can connect to the internet, we also have to change the private IP to public IP client that is in our public interface that is ether1 and ether2.


/ip firewall nat 
add action=masquerade chain=srcnat out-interface=ether1 
add action=masquerade chain=srcnat out-interface=ether2

router and pc clients are able to do an internet connection. Ping the router or pc both from the client to the Internet. If not successful, check your configuration again.


Internal Webproxy

In particular RouterBoard, like RB450G, RB433AH, RB433UAH, RB800 and RB1100 has an expansion slot (USB, MicroSD, CompactFlash) for additional storage. In the next example, we will use the usb flash is attached to a USB slot. For the first time installation, this additional storage will be read status invalid in the / system store. To be used as storage media cache, then the storage must be formatted in advance and activated Later we live webproxy activate and set the cache-on-disk = yes to use our storage media. Do not forget to redirect HTTP traffic (tcp port 80) into our webproxy.


/store disk format-drive usb1 
/store 
add disk=usb1 name=cache-usb type=web-proxy 
activate cache-usb 

/ip proxy 
set cache-on-disk=yes enabled=yes max-cache-size=200000KiB port=8080 

/ip firewall nat 
add chain=dstnat protocol=tcp dst-port=80 in-interface=wlan2 action=redirect to-ports=8080


Setting Mangle

In loadbalancing this time we will use a feature called PCC (Per Connection Classifier). With the PCC we can categorize traffic or outgoing connection through a router entry into several groups. These groupings can be distinguished on the basis of src-address, dst-address, src or dst-port and-port. The router will remember the beginning of the path through which the traffic gateway connections, so that the subsequent packets that are still associated with the connection initially will be passed on the same gateway route. The advantages of this PCC is to answer many complaints often break the connection on the other loadbalancing techniques prior to the PCC because of the displacement gateway. Before making mangle loadbalance, to prevent routing loops in the traffic, then all client traffic to the networks that connect directly to the router, should we bypass the loadbalancing. We can make a list of IP that are still in a network router and install the first time following mangle


/ip firewall address-list 
add address=192.168.101.0/30 list=lokal 
add address=192.168.102.0/30 list=lokal 
add address=10.10.10.0/24 list=lokal 

/ip firewall mangle 
add action=accept chain=prerouting dst-address-list=lokal in-interface=wlan2 comment=”trafik lokal” 
add action=accept chain=output dst-address-list=lokal


In certain cases, the first traffic can come from the Internet, such as the use of remote Winbox or telnet from the internet and so, therefore we also need to mark the mark-connection traffic so that traffic can pass through it also the interface where the incoming traffic.



/ip firewall mangle 
add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether1 new-connection-mark=con-from-isp1 passthrough=yes comment=”traffic from isp1” 

add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether2 new-connection-mark=con-from-isp2 passthrough=yes comment=”traffic from isp2”


Generally, an ISP (Internet Service Provider) will restrict access to DNS server of the IP which is only known for, so if you use the DNS from one ISP, you must add mangle for traffic control through the respective ISP gateway rather than through any other ISP gateway. Here we provide mangle DNS ISP1 through ISP1 gateway. If you are using a public DNS independent, such as OpenDNS, you do not need a mangle below.



/ip firewall mangle 
add action=mark-connection chain=output comment=dns dst-address=202.65.112.21 dst-port=53 new-connection-mark=dns passthrough=yes protocol=tcp comment=”taffic DNS” 

add action=mark-connection chain=output dst-address=202.65.112.21 dst-port=53 new-connection-mark=dns passthrough=yes protocol=udp 

add action=mark-routing chain=output connection-mark=dns new-routing-mark=route-to-isp1 passthrough=no

วันพฤหัสบดีที่ 17 เมษายน พ.ศ. 2557

Limit Download WAN RouterOS 5


จัดไปอีก V 5

/queue simple
add name="Wan1" interface=WAN1 max-limit=64M/8M priority=8 comment="Limit Download-Upload"
add name="Wan2" interface=WAN2 max-limit=16M/2M priority=8
add name="Wan3" interface=WAN3 max-limit=7M/512k priority=8
/

MIKROTIK 4 WAN PCC LOADBALANCE

#Simple Pcc Loadbalance 4Wan
#Rename ether as WAN1,WAN2,WAN3,WAN4,Local


/ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
add address=192.168.1.2/24 network=192.168.1.0 broadcast=192.168.1.255 interface=WAN1
add address=192.168.2.2/24 network=192.168.2.0 broadcast=192.168.2.255 interface=WAN2
add address=192.168.3.2/24 network=192.168.3.0 broadcast=192.168.3.255 interface=WAN3
add address=192.168.4.2/24 network=192.168.4.0 broadcast=192.168.4.255 interface=WAN4

/ip firewall mangle
add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn
add chain=input in-interface=WAN3 action=mark-connection new-connection-mark=WAN3_conn
add chain=input in-interface=WAN4 action=mark-connection new-connection-mark=WAN4_conn

add chain=output connection-mark=WAN1_conn action=mark-routing new-routing-mark=to_WAN1
add chain=output connection-mark=WAN2_conn action=mark-routing new-routing-mark=to_WAN2
add chain=output connection-mark=WAN3_conn action=mark-routing new-routing-mark=to_WAN3
add chain=output connection-mark=WAN4_conn action=mark-routing new-routing-mark=to_WAN4

add chain=prerouting dst-address=192.168.1.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=192.168.2.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=192.168.3.0/24 action=accept in-interface=Local
add chain=prerouting dst-address=192.168.4.0/24 action=accept in-interface=Local

add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:4/0 action=mark-connection new-connection-mark=WAN1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:4/1 action=mark-connection new-connection-mark=WAN2_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:4/2 action=mark-connection new-connection-mark=WAN3_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses-and-ports:4/3 action=mark-connection new-connection-mark=WAN4_conn passthrough=yes

add chain=prerouting connection-mark=WAN1_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN1
add chain=prerouting connection-mark=WAN2_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN2
add chain=prerouting connection-mark=WAN3_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN3
add chain=prerouting connection-mark=WAN4_conn in-interface=Local action=mark-routing new-routing-mark=to_WAN4

/ip route
add dst-address=0.0.0.0/0 gateway=192.168.1.1 routing-mark=to_WAN1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=to_WAN2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.3.1 routing-mark=to_WAN3 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.4.1 routing-mark=to_WAN4 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=192.168.1.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.2.1 distance=2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.3.1 distance=3 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=192.168.4.1 distance=4 check-gateway=ping

/ip firewall nat
add chain=srcnat src-address=192.168.0.0/24 out-interface=WAN1 action=masquerade
add chain=srcnat src-address=192.168.0.0/24 out-interface=WAN2 action=masquerade
add chain=srcnat src-address=192.168.0.0/24 out-interface=WAN3 action=masquerade
add chain=srcnat src-address=192.168.0.0/24 out-interface=WAN4 action=masquerade

/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=5000KiB max-udp-packet-size=512 servers=8.8.8.8,4.2.2.6

/ip dns static
add address=192.168.0.1 disabled=yes name=dns ttl=1d
/ip pool
add name=dhcp_pool1 ranges=192.168.0.2-192.168.0.253

/ip dhcp-server
add address-pool=dhcp_pool1 authoritative=after-2sec-delay bootp-support=static disabled=no interface=ether2 lease-time=3d name=dhcp1
/ip dhcp-server config
set store-leases-disk=never

/ip dhcp-server network
add address=192.168.0.0/24 dhcp-option="" dns-server="" gateway=192.168.0.1 ntp-server="" wins-server=""

/system clock
set time-zone-name=manual

/system clock manual
set dst-delta=+00:00 dst-end="jan/01/1970 00:00:00" dst-start="jan/01/1970 00:00:00" time-zone=+07:00

/system ntp client
set enabled=yes mode=unicast primary-ntp=203.158.118.2 secondary-ntp=116.193.170.16

2 WAN UNEQUAL LOADBALANCE PCC FOR HOTSPOT


# change ether name as WAN1,WAN2,Local
# PCC Loadbalance for hotspot only.
# After Apply this script manually run hotspot setup
# Unequal Loadbalance for wan1
 
/ip pool add name=dhcp_pool1 ranges=192.168.21.2-192.168.21.254
 
/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=Local name=dhcp1
 
/ip address
add address=192.168.1.2/24 interface=WAN1
add address=192.168.2.2/24 interface=WAN2
add address=192.168.21.1/24 interface=Local
 
/ip dhcp-server network
add address=192.168.21.0/24 gateway=192.168.21.1
 
/ip dns
set allow-remote-requests=yes cache-size=5000KiB max-udp-packet-size=2048 servers=8.8.8.8,8.8.4.4
 
/ip firewall mangle
add chain=input in-interface=WAN1 action=mark-connection new-connection-mark=WAN1_conn
add chain=input in-interface=WAN2 action=mark-connection new-connection-mark=WAN2_conn
add action=mark-routing chain=output connection-mark=WAN1_conn new-routing-mark=to_WAN1
add action=mark-routing chain=output connection-mark=WAN2_conn new-routing-mark=to_WAN2
add chain=prerouting dst-address=192.168.1.0/24 in-interface=Local
add chain=prerouting dst-address=192.168.2.0/24 in-interface=Local
add action=mark-connection chain=prerouting dst-address-type=!local hotspot=auth in-interface=Local new-connection-mark=WAN1_conn per-connection-classifier=both-addresses-and-ports:3/0
add action=mark-connection chain=prerouting dst-address-type=!local hotspot=auth in-interface=Local new-connection-mark=WAN2_conn per-connection-classifier=both-addresses-and-ports:3/1
add action=mark-connection chain=prerouting dst-address-type=!local hotspot=auth in-interface=Local new-connection-mark=WAN1_conn per-connection-classifier=both-addresses-and-ports:3/2
add action=mark-routing chain=prerouting connection-mark=WAN1_conn in-interface=Local new-routing-mark=to_WAN1
add action=mark-routing chain=prerouting connection-mark=WAN2_conn in-interface=Local new-routing-mark=to_WAN2
 
/ip firewall nat
add action=masquerade chain=srcnat out-interface=WAN1
add action=masquerade chain=srcnat out-interface=WAN2
 
/ip route
add check-gateway=ping distance=1 gateway=192.168.1.1 routing-mark=to_WAN1
add check-gateway=ping distance=1 gateway=192.168.2.1 routing-mark=to_WAN2
add check-gateway=ping distance=1 gateway=192.168.1.1
add check-gateway=ping distance=2 gateway=192.168.2.1

Limit Download File ใช้ได้เฉพาะ RouterOS 6.7 ขึ้นไป

Limit Download File ใช้ได้เฉพาะ RouterOS 6.7 ขึ้นไป


/ip firewall layer7-protocol add name="EXE" regexp="\\.(exe)"
/ip firewall layer7-protocol add name="RAR" regexp="\\.(rar)"
/ip firewall layer7-protocol add name="ZIP" regexp="\\.(zip)"
/ip firewall layer7-protocol add name="7z" regexp="\\.(7z)"
/ip firewall layer7-protocol add name="CAB" regexp="\\.(cab)"
/ip firewall layer7-protocol add name="ASF" regexp="\\.(asf)"
/ip firewall layer7-protocol add name="MOV" regexp="\\.(mov)"
/ip firewall layer7-protocol add name="WMV" regexp="\\.(wmv)"
/ip firewall layer7-protocol add name="MPG" regexp="\\.(mpg)"
/ip firewall layer7-protocol add name="MPEG" regexp="\\.(mpeg)"
/ip firewall layer7-protocol add name="MKV" regexp="\\.(mkv)"
/ip firewall layer7-protocol add name="AVI" regexp="\\.(avi)"
/ip firewall layer7-protocol add name="FLV" regexp="\\.(flv)"
/ip firewall layer7-protocol add name="WAV" regexp="\\.(wav)"
/ip firewall layer7-protocol add name="RM" regexp="\\.(rm)"
/ip firewall layer7-protocol add name="MP3" regexp="\\.(mp3)"
/ip firewall layer7-protocol add name="MP4" regexp="\\.(mp4)"
/ip firewall layer7-protocol add name="RAM" regexp="\\.(ram)"
/ip firewall layer7-protocol add name="RMVB" regexp="\\.(rmvb)"
/ip firewall layer7-protocol add name="DAT" regexp="\\.(dat)"
/ip firewall layer7-protocol add name="DAA" regexp="\\.(daa)"
/ip firewall layer7-protocol add name="ISO" regexp="\\.(iso)"
/ip firewall layer7-protocol add name="NRG" regexp="\\.(nrg)"
/ip firewall layer7-protocol add name="BIN" regexp="\\.(bin)"
/ip firewall layer7-protocol add name="VCD" regexp="\\.(vcd)"
/ip firewall layer7-protocol add name="3GP" regexp="\\.(3gp)"
/ip firewall layer7-protocol add name="AAC" regexp="\\.(aac)"
/ip firewall layer7-protocol add name="ACE" regexp="\\.(ace)"
/ip firewall layer7-protocol add name="AIF" regexp="\\.(aif)"
/ip firewall layer7-protocol add name="ARJ" regexp="\\.(arj)"
/ip firewall layer7-protocol add name="BZ2" regexp="\\.(bz2)"
/ip firewall layer7-protocol add name="GZ" regexp="\\.(gz)"
/ip firewall layer7-protocol add name="GZIP" regexp="\\.(gzip)"
/ip firewall layer7-protocol add name="IMG" regexp="\\.(img)"
/ip firewall layer7-protocol add name="LZH" regexp="\\.(lzh)"
/ip firewall layer7-protocol add name="M4A" regexp="\\.(m4a)"
/ip firewall layer7-protocol add name="M4V" regexp="\\.(m4v)"
/ip firewall layer7-protocol add name="MPA" regexp="\\.(mpa)"
/ip firewall layer7-protocol add name="MPE" regexp="\\.(mpe)"
/ip firewall layer7-protocol add name="MSI" regexp="\\.(msi)"
/ip firewall layer7-protocol add name="MSU" regexp="\\.(msu)"
/ip firewall layer7-protocol add name="OGG" regexp="\\.(ogg)"
/ip firewall layer7-protocol add name="OGV" regexp="\\.(ogv)"
/ip firewall layer7-protocol add name="PDF" regexp="\\.(pdf)"
/ip firewall layer7-protocol add name="PLJ" regexp="\\.(plj)"
/ip firewall layer7-protocol add name="PPS" regexp="\\.(pps)"
/ip firewall layer7-protocol add name="PPT" regexp="\\.(ppt)"
/ip firewall layer7-protocol add name="QT" regexp="\\.(qt)"
/ip firewall layer7-protocol add name="R0*" regexp="\\.(ro*)"
/ip firewall layer7-protocol add name="R1*" regexp="\\.(r1*)"
/ip firewall layer7-protocol add name="RA" regexp="\\.(ra)"
/ip firewall layer7-protocol add name="RM" regexp="\\.(rm)"
/ip firewall layer7-protocol add name="RMVB" regexp="\\.(rmvb)"
/ip firewall layer7-protocol add name="SEA" regexp="\\.(sea)"
/ip firewall layer7-protocol add name="SIT" regexp="\\.(sit)"
/ip firewall layer7-protocol add name="SITX" regexp="\\.(sitx)"
/ip firewall layer7-protocol add name="TAR" regexp="\\.(tar)"
/ip firewall layer7-protocol add name="TIF" regexp="\\.(tif)"
/ip firewall layer7-protocol add name="TIFF" regexp="\\.(tiff)"
/ip firewall layer7-protocol add name="WAV" regexp="\\.(wav)"
/ip firewall layer7-protocol add name="WMA" regexp="\\.(wma)"
/ip firewall layer7-protocol add name="Z" regexp="\\.(z)"
/ip firewall layer7-protocol add name="001" regexp="\\.(001)"
/ip firewall layer7-protocol add name="002" regexp="\\.(002)"
/ip firewall layer7-protocol add name="003" regexp="\\.(003)"
/ip firewall layer7-protocol add name="004" regexp="\\.(004)"
/ip firewall layer7-protocol add name="005" regexp="\\.(005)"
/
/ip firewall mangle add action=mark-packet chain=prerouting comment="EXE MARK PACKET" layer7-protocol=EXE new-packet-mark=EXE passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="RAR MARK PACKET" layer7-protocol=RAR new-packet-mark=RAR passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="ZIP MARK PACKET" layer7-protocol=ZIP new-packet-mark=ZIP passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="7z MARK PACKET" layer7-protocol=7z new-packet-mark=7z passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="CAB MARK PACKET" layer7-protocol=CAB new-packet-mark=CAB passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="ASF MARK PACKET" layer7-protocol=ASF new-packet-mark=ASF passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MOV MARK PACKET" layer7-protocol=MOV new-packet-mark=MOV passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="WMV MARK PACKET" layer7-protocol=WMV new-packet-mark=WMV passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MPG MARK PACKET" layer7-protocol=MPG new-packet-mark=MPG passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MPEG MARK PACKET" layer7-protocol=MPEG new-packet-mark=MPEG passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MKV MARK PACKET" layer7-protocol=MKV new-packet-mark=MKV passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="AVI MARK PACKET" layer7-protocol=AVI new-packet-mark=AVI passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="FLV MARK PACKET" layer7-protocol=FLV new-packet-mark=FLV passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="WAV MARK PACKET" layer7-protocol=WAV new-packet-mark=WAV passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="RM MARK PACKET" layer7-protocol=RM new-packet-mark=RM passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MP3 MARK PACKET" layer7-protocol=MP3 new-packet-mark=MP3 passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MP4 MARK PACKET" layer7-protocol=MP4 new-packet-mark=MP4 passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="RAM MARK PACKET" layer7-protocol=RAM new-packet-mark=RAM passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="RMVB MARK PACKET" layer7-protocol=RMVB new-packet-mark=RMVB passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="DAT MARK PACKET" layer7-protocol=DAT new-packet-mark=DAT passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="DAA MARK PACKET" layer7-protocol=DAA new-packet-mark=DAA passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="ISO MARK PACKET" layer7-protocol=ISO new-packet-mark=ISO passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="NRG MARK PACKET" layer7-protocol=NRG new-packet-mark=NRG passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="BIN MARK PACKET" layer7-protocol=BIN new-packet-mark=BIN passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="VCD MARK PACKET" layer7-protocol=VCD new-packet-mark=VCD passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="3GP MARK PACKET" layer7-protocol=3GP new-packet-mark=3GP passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="AAC MARK PACKET" layer7-protocol=AAC new-packet-mark=AAC passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="ACE MARK PACKET" layer7-protocol=ACE new-packet-mark=ACE passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="AIF MARK PACKET" layer7-protocol=AIF new-packet-mark=AIF passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="ARJ MARK PACKET" layer7-protocol=ARJ new-packet-mark=ARJ passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="BZ2 MARK PACKET" layer7-protocol=BZ2 new-packet-mark=BZ2 passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="GZ MARK PACKET" layer7-protocol=GZ new-packet-mark=GZ passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="GZIP MARK PACKET" layer7-protocol=GZIP new-packet-mark=GZIP passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="IMG MARK PACKET" layer7-protocol=IMG new-packet-mark=IMG passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="LZH MARK PACKET" layer7-protocol=LZH new-packet-mark=LZH passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="M4A MARK PACKET" layer7-protocol=M4A new-packet-mark=M4A passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="M4V MARK PACKET" layer7-protocol=M4V new-packet-mark=M4V passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MPA MARK PACKET" layer7-protocol=MPA new-packet-mark=MPA passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MPE MARK PACKET" layer7-protocol=MPE new-packet-mark=MPE passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MSI MARK PACKET" layer7-protocol=MSI new-packet-mark=MSI passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="MSU MARK PACKET" layer7-protocol=MSU new-packet-mark=MSU passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="OGG MARK PACKET" layer7-protocol=OGG new-packet-mark=OGG passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="OGV MARK PACKET" layer7-protocol=OGV new-packet-mark=OGV passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="PDF MARK PACKET" layer7-protocol=PDF new-packet-mark=PDF passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="PLJ MARK PACKET" layer7-protocol=PLJ new-packet-mark=PLJ passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="PPS MARK PACKET" layer7-protocol=PPS new-packet-mark=PPS passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="PPT MARK PACKET" layer7-protocol=PPT new-packet-mark=PPT passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="QT MARK PACKET" layer7-protocol=QT new-packet-mark=QT passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="R0* MARK PACKET" layer7-protocol=R0* new-packet-mark=R0* passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="R1* MARK PACKET" layer7-protocol=R1* new-packet-mark=R1* passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="RA MARK PACKET" layer7-protocol=RA new-packet-mark=RA passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="RM MARK PACKET" layer7-protocol=RM new-packet-mark=RM passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="RMVB MARK PACKET" layer7-protocol=RMVB new-packet-mark=RMVB passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="SEA MARK PACKET" layer7-protocol=SEA new-packet-mark=SEA passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="SIT MARK PACKET" layer7-protocol=SIT new-packet-mark=SIT passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="SITX MARK PACKET" layer7-protocol=SITX new-packet-mark=SITX passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="TAR MARK PACKET" layer7-protocol=TAR new-packet-mark=TAR passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="TIF MARK PACKET" layer7-protocol=TIF new-packet-mark=TIF passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="TIFF MARK PACKET" layer7-protocol=TIFF new-packet-mark=TIFF passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="WAV MARK PACKET" layer7-protocol=WAV new-packet-mark=WAV passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="WMA MARK PACKET" layer7-protocol=WMA new-packet-mark=WMA passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="Z MARK PACKET" layer7-protocol=Z new-packet-mark=Z passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="001 MARK PACKET" layer7-protocol=001 new-packet-mark=001 passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="002 MARK PACKET" layer7-protocol=002 new-packet-mark=002 passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="003 MARK PACKET" layer7-protocol=003 new-packet-mark=003 passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="004 MARK PACKET" layer7-protocol=004 new-packet-mark=004 passthrough=no
/ip firewall mangle add action=mark-packet chain=prerouting comment="005 MARK PACKET" layer7-protocol=005 new-packet-mark=005 passthrough=no
/
/queue tree add name="LIMIT FILE EXTENTION" parent=global priority=7 max-limit=50M  comment="Limit Download File"
/queue tree add name="7z" parent="LIMIT FILE EXTENTION" packet-mark=7z  queue=default priority=1 max-limit=20M
/queue tree add name="ASF" parent="LIMIT FILE EXTENTION" packet-mark=ASF  queue=default priority=1 max-limit=20M
/queue tree add name="AVI" parent="LIMIT FILE EXTENTION" packet-mark=AVI  queue=default priority=1 max-limit=20M
/queue tree add name="BIN" parent="LIMIT FILE EXTENTION" packet-mark=BIN  queue=default priority=1 max-limit=20M
/queue tree add name="CAB" parent="LIMIT FILE EXTENTION" packet-mark=CAB  queue=default priority=1 max-limit=20M
/queue tree add name="DAA" parent="LIMIT FILE EXTENTION" packet-mark=DAA  queue=default priority=1 max-limit=20M
/queue tree add name="DAT" parent="LIMIT FILE EXTENTION" packet-mark=DAT  queue=default priority=1 max-limit=20M
/queue tree add name="EXE" parent="LIMIT FILE EXTENTION" packet-mark=EXE  queue=default priority=1 max-limit=50M
/queue tree add name="FLV" parent="LIMIT FILE EXTENTION" packet-mark=FLV  queue=default priority=1 max-limit=20M
/queue tree add name="ISO" parent="LIMIT FILE EXTENTION" packet-mark=ISO  queue=default priority=1 max-limit=20M
/queue tree add name="MKV" parent="LIMIT FILE EXTENTION" packet-mark=MKV  queue=default priority=1 max-limit=20M
/queue tree add name="MOV" parent="LIMIT FILE EXTENTION" packet-mark=MOV  queue=default priority=1 max-limit=20M
/queue tree add name="MP3" parent="LIMIT FILE EXTENTION" packet-mark=MP3  queue=default priority=1 max-limit=20M
/queue tree add name="MP4" parent="LIMIT FILE EXTENTION" packet-mark=MP4  queue=default priority=1 max-limit=20M
/queue tree add name="MPEG" parent="LIMIT FILE EXTENTION" packet-mark=MPEG  queue=default priority=1 max-limit=20M
/queue tree add name="MPG" parent="LIMIT FILE EXTENTION" packet-mark=MPG  queue=default priority=1 max-limit=20M
/queue tree add name="NRG" parent="LIMIT FILE EXTENTION" packet-mark=NRG  queue=default priority=1 max-limit=20M
/queue tree add name="RAM" parent="LIMIT FILE EXTENTION" packet-mark=RAM  queue=default priority=1 max-limit=20M
/queue tree add name="RAR" parent="LIMIT FILE EXTENTION" packet-mark=RAR  queue=default priority=1 max-limit=50M
/queue tree add name="RM" parent="LIMIT FILE EXTENTION" packet-mark=RM  queue=default priority=1 max-limit=20M
/queue tree add name="RMVB" parent="LIMIT FILE EXTENTION" packet-mark=RMVB  queue=default priority=1 max-limit=20M
/queue tree add name="VCD" parent="LIMIT FILE EXTENTION" packet-mark=VCD  queue=default priority=1 max-limit=20M
/queue tree add name="WAV" parent="LIMIT FILE EXTENTION" packet-mark=WAV  queue=default priority=1 max-limit=20M
/queue tree add name="WMV" parent="LIMIT FILE EXTENTION" packet-mark=WMV  queue=default priority=1 max-limit=20M
/queue tree add name="ZIP" parent="LIMIT FILE EXTENTION" packet-mark=ZIP  queue=default priority=1 max-limit=50M
/queue tree add name="3GP" parent="LIMIT FILE EXTENTION" packet-mark=3GP  queue=default priority=1 max-limit=20M
/queue tree add name="AAC" parent="LIMIT FILE EXTENTION" packet-mark=AAC  queue=default priority=1 max-limit=20M
/queue tree add name="ACE" parent="LIMIT FILE EXTENTION" packet-mark=ACE  queue=default priority=1 max-limit=20M
/queue tree add name="AIF" parent="LIMIT FILE EXTENTION" packet-mark=AIF  queue=default priority=1 max-limit=20M
/queue tree add name="ARJ" parent="LIMIT FILE EXTENTION" packet-mark=ARJ  queue=default priority=1 max-limit=20M
/queue tree add name="BZ2" parent="LIMIT FILE EXTENTION" packet-mark=BZ2  queue=default priority=1 max-limit=20M
/queue tree add name="GZ" parent="LIMIT FILE EXTENTION" packet-mark=GZ  queue=default priority=1 max-limit=20M
/queue tree add name="GZIP" parent="LIMIT FILE EXTENTION" packet-mark=GZIP  queue=default priority=1 max-limit=20M
/queue tree add name="IMG" parent="LIMIT FILE EXTENTION" packet-mark=IMG  queue=default priority=1 max-limit=20M
/queue tree add name="LZH" parent="LIMIT FILE EXTENTION" packet-mark=LZH  queue=default priority=1 max-limit=20M
/queue tree add name="M4A" parent="LIMIT FILE EXTENTION" packet-mark=M4A  queue=default priority=1 max-limit=20M
/queue tree add name="M4V" parent="LIMIT FILE EXTENTION" packet-mark=M4V  queue=default priority=1 max-limit=20M
/queue tree add name="MPA" parent="LIMIT FILE EXTENTION" packet-mark=MPA  queue=default priority=1 max-limit=20M
/queue tree add name="MPE" parent="LIMIT FILE EXTENTION" packet-mark=MPE  queue=default priority=1 max-limit=20M
/queue tree add name="MSI" parent="LIMIT FILE EXTENTION" packet-mark=MSI  queue=default priority=1 max-limit=20M
/queue tree add name="MSU" parent="LIMIT FILE EXTENTION" packet-mark=MSU  queue=default priority=1 max-limit=20M
/queue tree add name="OGG" parent="LIMIT FILE EXTENTION" packet-mark=OGG  queue=default priority=1 max-limit=20M
/queue tree add name="OGV" parent="LIMIT FILE EXTENTION" packet-mark=OGV  queue=default priority=1 max-limit=20M
/queue tree add name="PDF" parent="LIMIT FILE EXTENTION" packet-mark=PDF  queue=default priority=1 max-limit=20M
/queue tree add name="PLJ" parent="LIMIT FILE EXTENTION" packet-mark=PLJ  queue=default priority=1 max-limit=20M
/queue tree add name="PPS" parent="LIMIT FILE EXTENTION" packet-mark=PPS  queue=default priority=1 max-limit=20M
/queue tree add name="PPT" parent="LIMIT FILE EXTENTION" packet-mark=PPT  queue=default priority=1 max-limit=20M
/queue tree add name="QT" parent="LIMIT FILE EXTENTION" packet-mark=QT  queue=default priority=1 max-limit=20M
/queue tree add name="R0*" parent="LIMIT FILE EXTENTION" packet-mark=R0*  queue=default priority=1 max-limit=20M
/queue tree add name="R1*" parent="LIMIT FILE EXTENTION" packet-mark=R1*  queue=default priority=1 max-limit=20M
/queue tree add name="RA" parent="LIMIT FILE EXTENTION" packet-mark=RA  queue=default priority=1 max-limit=20M
/queue tree add name="RM" parent="LIMIT FILE EXTENTION" packet-mark=RM  queue=default priority=1 max-limit=20M
/queue tree add name="RMVB" parent="LIMIT FILE EXTENTION" packet-mark=RMVB  queue=default priority=1 max-limit=20M
/queue tree add name="SEA" parent="LIMIT FILE EXTENTION" packet-mark=SEA  queue=default priority=1 max-limit=20M
/queue tree add name="SIT" parent="LIMIT FILE EXTENTION" packet-mark=SIT  queue=default priority=1 max-limit=20M
/queue tree add name="SITX" parent="LIMIT FILE EXTENTION" packet-mark=SITX  queue=default priority=1 max-limit=20M
/queue tree add name="TAR" parent="LIMIT FILE EXTENTION" packet-mark=TAR  queue=default priority=1 max-limit=20M
/queue tree add name="TIF" parent="LIMIT FILE EXTENTION" packet-mark=TIF  queue=default priority=1 max-limit=20M
/queue tree add name="TIFF" parent="LIMIT FILE EXTENTION" packet-mark=TIFF  queue=default priority=1 max-limit=20M
/queue tree add name="WAV" parent="LIMIT FILE EXTENTION" packet-mark=WAV  queue=default priority=1 max-limit=20M
/queue tree add name="WMA" parent="LIMIT FILE EXTENTION" packet-mark=WMA  queue=default priority=1 max-limit=20M
/queue tree add name="Z" parent="LIMIT FILE EXTENTION" packet-mark=Z  queue=default priority=1 max-limit=20M
/queue tree add name="001" parent="LIMIT FILE EXTENTION" packet-mark=001  queue=default priority=1 max-limit=20M
/queue tree add name="002" parent="LIMIT FILE EXTENTION" packet-mark=002  queue=default priority=1 max-limit=20M
/queue tree add name="003" parent="LIMIT FILE EXTENTION" packet-mark=003  queue=default priority=1 max-limit=20M
/queue tree add name="004" parent="LIMIT FILE EXTENTION" packet-mark=004  queue=default priority=1 max-limit=20M
/queue tree add name="005" parent="LIMIT FILE EXTENTION" packet-mark=005  queue=default priority=1 max-limit=20M
/

วันพุธที่ 12 มีนาคม พ.ศ. 2557

สูตรยาสมุนไพรเบาหวานจ้า

“ สูตรยาสมุนไพรเบาหวานจ้า”<<<<
สมุนไพรหาง่าย
1. ขิงแก่
2. ข่าเล็กข่าใหญ่
3. ตะไคร้ทั้งต้น+ราก
4. หัวกระชาย
5. ใบเตยทั้งราก
6. มะนาวทั้งลูก
7. มะกูดทั้งลูก
8. ขมิ้น
9. โหระพาทั้งต้น
ทุกอย่างเอา ครึ่งกิโลจ้า

วิธีทำ
1. ล้างให้สะอาดหั่นทุกอย่างแล้วนำมานึ่งให้สุก ใส่ผ้าขาวบาง ตากแดดให้แห้งสนิท
2. นำไปร้านยาไทยให้บด
3. ทานวันละ 2 มือ มื้อละ1 ช้อนชาจ้า 


เครดิต : https://www.facebook.com/phuwhknad888

วันจันทร์ที่ 27 มกราคม พ.ศ. 2557

Control bandwidth using Squid Proxy

To utilise bandwindth among the users equally and efficiently, Bandwidth should be controlled and distributed properly or else on user may downloadlarge files and that effects the browising speed of other uses. Why should others suffer because of one use.

We use delay_pools to control bandwidth in squid, of course delay_pools has 3 classes.  1,2,3 but for now we use class 2 since we want to control bandwindth.


Controlling Bandwidth per system/ip :

[root@squid ~]#  vim  /etc/squid/squid.conf

acl  10k_users  src "/etc/squid/10k_user_pcs.txt"
delay_pools  1
delay_class  1  2
delay_parameters  1  -1/-1  10000/10000
delay_access  1  allow   10k_user_pcs

10k_userlist contains all the ips of the user systems to whom we assign 10kb bandwidth.
-1/-1 is  actual bandwidth of the connections from isp

you can check downloading any file from any of the systems listed in the 10k_userlist.txt file.

Controlling Bandwidth per username :

If you assign bandwidth per system, you have to download the updates at the same speed and you'll be stuck there. so assign it to userid, so that you can use your id while updating and downloading updates and do it fast.


acl  10k_users  src "/etc/squid/10k_user_ids.txt"delay_pools  1
delay_class  1  2
delay_parameters  1  -1/-1  10000/10000
delay_access  1  allow   10k_useri_ds

same like 1st acl 10k_user_ids.txt contains proxy user names list.