Friday, December 14, 2007

cara membuat Repository Sendiri


mo bkin repo buat jaringan lokal ya.... , paling gampang pake cd debiannya aja copy semua cd debianmu ke HD.trus arahkan source.list-mu ke tempat penyimpanan tadi... misal semua cdnya kamu copy ke /home/cd1 untuk cd1,maka di source.list-mu kamu tambahin deb file:///home/cd1 sarge main terusin ampe semua cd yang tercopy...pake web server kan?? ya tinggal atur2 aja konfigurasinya biar /home-mu bisa tampil di browser...trus di client-nya,source.list-nya tambahin deb http://ipyang_nyediain_repo/cd1 sarge main... mungkin bisa memban

blokir situs xxx

/ip firewall filter add chain=forward dst-address=xxx.xxx.xxx.xxx action=drop xxx.xxx.xxx.xxx=IP web parnonya. atau kalau pake winbox, dst-address bisa langsung diketik nama webnya, misal www.playboy.com

Mikrotik Sebagai Router,Firewall, Web Proxy dan Bandwith Limiter.

May 31, 2007 · Filed under Networking Technology
Mikrotik merupakan sebuah software yang berlisence yang menggunakan kernel linux. Untuk menginstal software tsb sangat lah gampang, booting dari cd room pilihlah service yang yang kita butuhkan dengan menekan tanda silang (x) lalu tekan “i “ untuk menginstall.SELESAI
I. Mikrotik Sebagai Router.
Untuk awalan konfigurasi ip kita sebagai berikut :
IP 10.168.16.10/28 —à Internet dengan gateway 10.168.16.1 dan IP : 192.168.10.1/24 —-à LAN.
Interface Ethernet Set 0 Name=Internet .
Interface Ethernet Set 1 Name=LAN
Perintah diatas untuk merubah nama interface. Default nama interface yang di berikan adalah Eth0 dan Eth1.
Lalu berikut ini perintah untuk memberi IP
ip address add address=10.168.16.10/28 interface Internet
ip address add address=192.168.10.1/24 interface LAN
Berikan gateway dari router tsb dgn perintah :
ip route add gateway 10.168.16.1
Setelah itu kita NAT kan ip LAN yaitu 192.168.10.1/24 dengan perintah sbb :
/ ip firewall nat
add chain=srcnat out-interface=Internet src-address=192.168.10.0/24 action=masquerade comment=”" disabled=no
lalu:
Selesai sudah computer anda menjadi sebuah router sengan system operasi Mikrotik.
Untuk pengujian cobalah computer anda yang lain dengan konfigurasi ip yang di sesuaikan dengan IP LAN dengan gateway ip LAN routernya.
II. Firewall di Mikrotik
Apabila mesin anda hanya dapat di aksess hanya dari ip yang anda ingin kan, itu dapat di atur di perintah firewall filter nya.
Berikut cth firewall yang saya berikan :
Sebelumnya definisikan ip yang anda inginkan untuk di permitkan dengan perintah
ip firewall add address-list=192.168.10.0/24, 10.168.16.0/28 name=ournetwork
ip firewall filter
add chain=forward connection-state=established action=accept comment=”allow \
established connections” disabled=no
add chain=forward connection-state=related action=accept comment=”allow \
related connections” disabled=no
add chain=virus protocol=udp dst-port=135-139 action=drop comment=”Drop \
Messenger Worm” disabled=no
add chain=forward connection-state=invalid action=drop comment=”drop invalid \
connections” disabled=no
add chain=virus protocol=tcp dst-port=135-139 action=drop comment=”Drop \
Blaster Worm” disabled=no
add chain=virus protocol=tcp dst-port=1433-1434 action=drop comment=”Worm” \
disabled=no
add chain=virus protocol=tcp dst-port=445 action=drop comment=”Drop Blaster \
Worm” disabled=no
add chain=virus protocol=udp dst-port=445 action=drop comment=”Drop Blaster \
Worm” disabled=no
add chain=virus protocol=tcp dst-port=593 action=drop comment=”________” \
disabled=no
add chain=virus protocol=tcp dst-port=1024-1030 action=drop comment=”________” \
disabled=no
add chain=virus protocol=tcp dst-port=1080 action=drop comment=”Drop MyDoom” \
disabled=no
add chain=virus protocol=tcp dst-port=1214 action=drop comment=”________” \
disabled=no
add chain=virus protocol=tcp dst-port=1363 action=drop comment=”ndm requester” \
disabled=no
add chain=virus protocol=tcp dst-port=1364 action=drop comment=”ndm server” \
disabled=no
add chain=virus protocol=tcp dst-port=1368 action=drop comment=”screen cast” \
disabled=no
add chain=virus protocol=tcp dst-port=1373 action=drop comment=”hromgrafx” \
disabled=no
add chain=virus protocol=tcp dst-port=1377 action=drop comment=”cichlid” \
disabled=no
add chain=virus protocol=tcp dst-port=2745 action=drop comment=”Bagle Virus” \
disabled=no
add chain=virus protocol=tcp dst-port=2283 action=drop comment=”Drop Dumaru.Y” \
disabled=no
add chain=virus protocol=tcp dst-port=2535 action=drop comment=”Drop Beagle” \
disabled=no
add chain=virus protocol=tcp dst-port=2745 action=drop comment=”Drop \
Beagle.C-K” disabled=no
add chain=virus protocol=tcp dst-port=3127 action=drop comment=”Drop MyDoom” \
disabled=no
add chain=virus protocol=tcp dst-port=3410 action=drop comment=”Drop Backdoor \
OptixPro” disabled=no
add chain=virus protocol=tcp dst-port=4444 action=drop comment=”Worm” \
disabled=no
add chain=virus protocol=udp dst-port=4444 action=drop comment=”Worm” \
disabled=no
add chain=virus protocol=tcp dst-port=5554 action=drop comment=”Drop Sasser” \
disabled=no
add chain=virus protocol=tcp dst-port=8866 action=drop comment=”Drop Beagle.B” \
disabled=no
add chain=virus protocol=tcp dst-port=9898 action=drop comment=”Drop \
Dabber.A-B” disabled=no
add chain=virus protocol=tcp dst-port=10000 action=drop comment=”Drop \
Dumaru.Y, sebaiknya di didisable karena juga sering digunakan utk vpn atau \
webmin” disabled=yes
add chain=virus protocol=tcp dst-port=10080 action=drop comment=”Drop \
MyDoom.B” disabled=no
add chain=virus protocol=tcp dst-port=12345 action=drop comment=”Drop NetBus” \
disabled=no
add chain=virus protocol=tcp dst-port=17300 action=drop comment=”Drop Kuang2″ \
disabled=no
add chain=virus protocol=tcp dst-port=27374 action=drop comment=”Drop \
SubSeven” disabled=no
add chain=virus protocol=tcp dst-port=65506 action=drop comment=”Drop PhatBot, \
Agobot, Gaobot” disabled=no
add chain=forward action=jump jump-target=virus comment=”jump to the virus \
chain” disabled=no
add chain=input connection-state=established action=accept comment=”Accept \
established connections” disabled=no
add chain=input connection-state=related action=accept comment=”Accept related \
connections” disabled=no
add chain=input connection-state=invalid action=drop comment=”Drop invalid \
connections” disabled=no
add chain=input protocol=udp action=accept comment=”UDP” disabled=no
add chain=input protocol=icmp limit=50/5s,2 action=accept comment=”Allow \
limited pings” disabled=no
add chain=input protocol=icmp action=drop comment=”Drop excess pings” \
disabled=no
add chain=input protocol=tcp dst-port=21 src-address-list=ournetwork \
action=accept comment=”FTP” disabled=no
add chain=input protocol=tcp dst-port=22 src-address-list=ournetwork \
action=accept comment=”SSH for secure shell” disabled=no
add chain=input protocol=tcp dst-port=23 src-address-list=ournetwork \
action=accept comment=”Telnet” disabled=no
add chain=input protocol=tcp dst-port=80 src-address-list=ournetwork \
action=accept comment=”Web” disabled=no
add chain=input protocol=tcp dst-port=8291 src-address-list=ournetwork \
action=accept comment=”winbox” disabled=no
add chain=input protocol=tcp dst-port=1723 action=accept comment=”pptp-server” \
disabled=no
add chain=input src-address-list=ournetwork action=accept comment=”From \
Datautama network” disabled=no
add chain=input action=log log-prefix=”DROP INPUT” comment=”Log everything \
else” disabled=no
add chain=input action=drop comment=”Drop everything else” disabled=no
III. Mikrotik sebagai Mesin Web proxy
Setelah firewall di mesin anda berjalan dengan baik maka selanjutnya kita juga bisa gunakan mesin ada tsb sebagai mesin web proxy.Yang perlu saya informasikan yaitu computer yang di butuh kan untuk menjadi mesin web proxy minimal Pentium III dengan RAM minimal 128M.Semakin tinggi spesifikasi komputer anda semakin bagus.
Untuk konfigurasinya sebagai berikut :

/ ip web-proxy
set enabled=yes src-address=0.0.0.0 port=3128 hostname=”mesin.proxy.net” transparent-proxy=yes parent-proxy=0.0.0.0:0 \
cache-administrator=”admin@mesin.proxy.net” max-object-size=4096KiB cache-drive=system max-cache-size=unlimited \
max-ram-cache-size=unlimited
/ ip web-proxy access
add dst-port=23-25 action=deny comment=”block telnet & spam e-mail relaying” disabled=no
add dst-port=443-563 action=deny comment=”" disabled=no
add dst-port=21 action=deny comment=”" disabled=no
add dst-port=21 action=deny comment=”" disabled=no
add dst-port=1025-65535 action=deny comment=”" disabled=no
add dst-port=280,488,591,777 action=deny comment=”" disabled=no
add dst-port=81,82,10000 action=deny comment=”" disabled=no
add dst-port=8291 action=allow comment=”" disabled=no
add src-address=127.0.0.1/32 action=allow comment=”localhost” disabled=no
add src-address=10.168.16.0/28 action=allow comment=”" disabled=no
add src-address=192.168.10.0/24 action=allow comment=”local address” disabled=no
add action=deny comment=”" disabled=no
/ ip web-proxy cache
add url=”:cgi-bin \\?” action=deny comment=”don’t cache dynamic http pages” disabled=no
Setelah melakukan perintah diatas lalu kita harus mentransparankan ip local nya (LAN) agar ip di bawah nya (LAN) di redirect melalui mesin proxynya.Perintah untuk transparan proxynya sebagai berikut
/ ip firewall nat
add chain=dstnat in-interface=Local protocol=tcp dst-port=80 src-address-list=iplan dst-address-list=192.168.10.0/24 action=redirect \
to-ports=3128 comment=”" disabled=no
add chain=dstnat in-interface=Local protocol=tcp dst-port=8080 src-address-list=iplan dst-address-list=192.168.10.0/24 \
action=redirect to-ports=3128 comment=”" disabled=no
add chain=dstnat protocol=tcp dst-port=80 action=accept comment=”" disabled=no
add chain=dstnat protocol=tcp dst-port=8080 action=accept comment=”" disabled=no
Setelah itu mesin anda sudah selesai menjadi mesin Web Proxy.
IV. Mikrotik sebagai Bandwith Limiter
Setelah anda berhasil mesin anda menjadi Web proxy, anda juga dapat mengkonfigurasi kan mesin anda sebagai Bandwith Limiter.Ini berguna jika anda yang mempunyai sebuah warnet selalu mengeluhkan lambatnya access. Tidak sepenuh nya access anda yang lambat di sebabkan oleh jeleknya link access ISP tempat anda berlangganan.Bisa saja salah satu user anda sedang melakukan download yang besar atw pun user anda sedang browsing dengan image/gambar yang banyak seperti situs-situs porno sehingga BW yang anda miliki terkuras oleh salah satu user yang tamak sehingga dapat menggaggu user lainnya yang sangat membutuhkan.
Dengan cara ini anda dapat mengatur BW yang anda miliki dan memberi jatah kepada user yang tamak sehingga tidak menggaggu user lainnya yang lebih membutuhkan.
Konfigurasi ini di set untuk setiap computer dengan definisi setiap IP nya.
Untuk settingan awal kita harus mendefinisikan setiap paket dari setiap ip di ip mangle nya.Berikut konfigurasinya :
/ ip firewall mangle
add chain=prerouting in-interface=Local protocol=!icmp src-address-list=192.168.10.2/32 action=mark-packet new-packet-mark=02-UP \
passthrough=no comment=”O1″ disabled=no
add chain=forward protocol=!icmp src-address-list=192.168.10.2/32 action=mark-connection new-connection-mark=02-MC passthrough=yes \
comment=”" disabled=no
add chain=forward in-interface=Internet protocol=!icmp connection-mark=02-MC src-address-list=192.168.10.2/32 action=mark-packet \
new-packet-mark=02-DOWN passthrough=no comment=”" disabled=no
add chain=output out-interface=Local protocol=!icmp dst-address-list=192.168.10.2/32 action=mark-packet new-packet-mark=02-DOWN \
passthrough=no comment=”" disabled=no
Konfigurasi diatas di set hanya untuk ip : 192.168.10.2, untuk set ip yang lainnya dapat anda ganti dan di tambahkan sesuai dengan jumlah ip yang aktif di user anda.
Setelah anda definisikan paket dan ip anda dengan perintah ip mangle di atas, lalu anda tinggal membuat konfigurasi Bandwith Limiternya dengan menggunakan queue tree.
Berikut perintahnya :
/ queue tree
add name=”DOWNLOAD” parent=Local packet-mark=”" limit-at=800000 queue=default priority=8 max-limit=800000 burst-limit=0 \
burst-threshold=0 burst-time=0s disabled=no
add name=”02″ parent=DOWNLOAD packet-mark=02-DOWN limit-at=30000 queue=default priority=8 max-limit=80000 \
burst-limit=150000 burst-threshold=78000 burst-time=2m disabled=yes
Untuk perintah diatas saya definisikan dahulu paket download secara keseluruhan, ini berguna agar kita dapat melihat pemakaian total Bandwith dari seluruh user yang aktif.. Bandwith Total maksimal yang saya set adalah 800 Kbps.
Lalu kemudian saya tambahkan BW untuk paket ip 192.168.10.2 dengan parent=DOWNLOAD dan packet-mark=02-DOWN yang telah kita definisikan sebelumnya di ip mangle diatas.
Limit Bandwith (minimal bandwith yang di dapat) untuk user 192.168.10.2 saya set hanya 30Kbps dan untuk maksimal Bandwith nya saya set mencapai 80Kbps.
Untuk burst-limit itu berfungsi jika user kita masih sedikit kita bisa set lebih dari Maksimal yang kita berikan diatas 80Kbps disini saya set mencapai 150 Kbps.
Pencapaian BW pada 150 Kbps jika BW user nya sudah mencapai 78Kbps harus di bawah Bandwith Maksimal anda 80 Kbps.Perintah ini ada pada burst-threshold.Bandwirth yang di hasilkan 150 kbps tsb kita set dengan waktu hanya 2 menit dengan perintah burst-time=2m.
Selesai sudah mesin anda telah menjadi sebuah mesin router, firewall, web-proxy dan Bandwith Limiter yang dapat di lakukan oleh 1 komputer saja.Saya sarankan agar computer anda mempunyai spesifikasi minimum Pentium III dengan RAM minimal 128M.
Namun jika anda hanya membutuh kan sebagai router dan Bandwith Limiter dapat anda lakukan di computer Pentium II atw bahkan Pentium I dengan spesifikasi RAM di bawah 128M.
Jika anda mengalami kesulitan silahkan email ke mailbox@ilham-alain.org

Traffic Monitor with Mikrotik Tools

Traffic Monitor with Mikrotik Tools

Dalam Memantau aliran paket data yang melewati antarmuka router Mikrotik, dapat digunakan fasilitas Torch. Keterangan lebih lanjut, dapat dibaca pada Manual Mikrotik, yaitu Torch Tools

Kita dapat memantau aliran paket berdasarkan jenis protokolnya, alamat asal, alamat tujuan serta tipe port. Dengan adanya fasilitas ini yang telah disediakan pada Packet System, ketika kita menginstalasi Mikrotik RouterOS, maka memudahkan kita dalam administrasi router, dari fasilitas ini, kita bisa menebak apakah Aliran data di mesin kita sedang Normal atau tidak. Memantau terjadinya Flooding, memantau aktifitas Malware dan sebagainya.

Menggunakannya cukup mudah, biasanya agar lebih nyaman dalam Monitoring, silahkan diaktifkan melalui Winbox, untuk masuk ke Routernya. Lebih jelasnya bisa dilihat gambar dibawah ini.

Fasilitas Torch ini bisa digunakan melalui Winbox pada menu Tools - Torch. Silahkan Klik menu Torch tersebut, nanti akan ditampilkan jendela Torchnya.

menu.jpg

Atau Bisa juga melalui IP - ARP. Pada jendela ARP List, silahkan dipilih IP Address, MAC address yang akan di Monitor. Klik kanan untuk masuk ke menu Torch.

arp.jpg

Perhatikan, item-item yang terdapat di jendela Torch ini, pada Manual diatas telah diberikan secara jelas keterangan terhadap item-item tersebut. Klik tombol Start untuk mengaktifkan layanan Torch ini. Sekarang kita dapat bermonitoring ria terhadap aliran paket pada mesin routernya. Jika ada trafik yang mencurigakan silahkan diambil tindakan selanjutnya.

torch.jpg

Pada List diatas, saya memantau Aliran trafik dari IP Address (Src Address) 192.168.0.13 yang melalui Interface LAN. Jika diperhatikan, pada bagian Src port terdapat port 514 (syslog) bertipe protokol UDP (17) menuju ke IP Address (Dst Address) 192.168.0.14, dan memang saya sedang menjalankan Syslog Daemon pada PC Windows XP secara Remote untuk menyimpan log router Mikrotiknya, pada PC yang memiliki IP Address 192.168.0.13, dengan router remotenya yang memiliki IP Address 192.168.0.14, aktif di port 514 (UDP). Kita bisa memilih Alamat sumber (Src Address) pada Client yang akan kita pantau, memilih Port, Alamat tujuan, serta Protokolnya

Sumber : http://primadonal.wordpress.co

Setup DNS Mikrotik

Setup DNS Mikrotik

ALTERNATIVE PROCEDURE IF YOU WANT TO INPUT A FIXED IP/GATEWAY/DNS SERVER ADDRESS
(instead of using DHCP on the ether1 port)

Caution:
Use care in selecting the DNS SERVER IP address in the setup below. You MUST select an actual DNS server or a router which provides DNS services. Some routers (such as the Hawking FR24) provide a "DNS RELAY" feature on the gateway address which redirects DNS service requests that are sent to the router Gateway Address to some downstream DNS Server. Such "dns relay" service is not always compatible with the Mikrotik system. Other routers (such as the NexLand 800 Turbo and many other router setups) do provide normal DNS Services on the gateway address. In many routers it may depend on user programming.

The Mikrotik router will NOT resolve DNS properly for the Hotspot unless the pointer to a DNS server source points to a "real" DNS Server or a router which actually provides DNS SERVICES on the Gateway address. The result of no DNS service will be that your hotspot login screen will not be loaded when "any URL" is transmitted to the ether2 (Hotspot) port via your browser. This problem can be very confusing to diagnose.

You can test what DNS address you should setup in the Mikrotik unit by running an ip configuration test on a Windows equipped computer connected to your router that you also intend your Mikrotik to use for internet access. Proceed as follows:

b) In your windows computer, in network settings, select tcp/ip properties, and select "obtain an IP address automatically" and "obtain DNS server address automatically". Click OK and exit and reboot if necessary to activate the new settings. Then execute Setup>Run>
then enter <winipcfg>, click OK, (windows 95/98), or <ipconfig>, (or perhaps wntipcfg), click OK, (windows XP/NT/2000), In Windows , you may have to download the winipcfg.exe (or similar) module from the resources folder on the install disk to get this to work. You will get a display such as the image below when you get the ip configuration display and click

Note in this example, the DNS SERVER reported is 192.168.168.1 which IS the same as the Default Gateway and the downstream router (not Mikrotik) IP address. THIS IS NOT ALWAYS SO! The DNS server found by the DHCP operation of your windows computer may be in an entirely different range from the default gateway IP address. Thus, if you use a fixed IP address/Gateway/DNS Server selection, your Mikrotik router DNS Server setup MUST use the DNS Server found by a computer with DHCP Client operating as above. You cannot assume it is the same as your router's default gateway address.

Once you have the downstream router's Gateway address and DNS Server address defined, select an IP address for your Mikrotik unit and proceed as follows. (Here, we are assuming that your Mikrotik System's IP address and mask is 128.1.1.120/255.255.255.0, Gateway of the downstream router is 128.1.1.1 and that the DNS Server's IP address is 207.69.188.186. Make any changes you deem necessary.)
29a)
[admin@MikroTik] interface>
/ip

(Note: The address 128.1.1.120 (below) represents the PUBLIC INTERNET side IP address of the Mikrotik Router. Change to your own suitable address as may be required.)
(All commands must be all in one continuous string (no carriage returns even if the red command characters are shown on multiple lines) when input and followed at the end by a carriage return. Be careful to look for parts of commands on second and even third lines in the listings below. The /24 after the IP address is equivalent to stating that the mask is 255.255.255.0)
29b) [admin@MikroTik] ip> address add address=128.1.1.120/24 comment="TechNet LAN to Internet" interface=ether1
29c) [admin@MikroTik] ip> route add gateway=128.1.1.1
(The following test will locate your public ethernet port . Proceed as follows. You may PING your gateway address (128.1.1.1 in the example) which pinging will occur out the ether1 NIC port. Notes: You may also ping some other address if you wish. You can stop the PING command by entering at any time.) Now we test to see that we are connected to the internet by pinging "some" known IP address such as:)

(Note: This next command normally sets your system up so that all DNS calls go directly to the ISP's DNS servers. If you are behind another router/firewall you could (probably) use the gateway address of your router (as is done in the example) as many do provide DNS service. However, pointing directly to the ISP's DNS servers is usually faster.)
29d) [admin@MikroTik] ip> /ip dns set primary-dns=128.1.1.1 (Change to YOUR ISPs DNS servers. Or- This may be the gateway IP address of a LAN router (as this actually is) which has DNS services. You may be able to change to YOUR ISP's recommended DNS server IP address if permitted by your router and operation will likely be faster.)
29e) [admin@MikroTik] ip> /ip dns set secondary-dns=207.69.188.186 (Add a secondary DNS server if your ISP has one. This example is one of earthlink's DNS servers.)

IF you wish to install a DNS Cache in your Hotspot router so DNS requests will be handled out of the local cache instead of going to the router (or external ISP) each time, enter the following line.
29f) [admin@MikroTik] ip> /ip dns-cache set primary-server=128.1.1.1 (This sets up the dns-cache to access from the LOCAL ROUTER’s DNS server. You may wish to change the above two IP addresses to your ISP’s DNS IP address if permitted by your router. You can also use the
/ip dns-cache set secondary-server=xxx.xxx.xxx.xxx
to set up a secondary DNS-CACHE server if you wish.
)

29g) [admin@MikroTik] ip> dns print
resolve-mode:
remote-dns
primary-dns: 128.1.1.1 (This should be your primary DNS server IP address.)
secondary-dns: 207.69.188.186 (You should setup a secondary-dns server if you have one.)
and then:
29h) [admin@MikroTik] ip> dns-cache print
enabled: no (You get to enable it later when you setup the hotspot.)
primary-server: 128.1.1.1 (This should be your primary DNS server IP address.)
secondary-dns: 0.0.0.0 (You should setup a secondary-dns server (in step #19) if you have one.)
running: no (It will start running if you enable "use DNS CACHE" when you setup the hotspot.)
usage: 0%
entries: 0

There are lot many ways to limit bandwidth for day and Night

There are lot many ways to limit bandwidth for day and Night, but personally I found this is the easiest way, Here it is.

I have used Simple Queue, Script and Scheduler.

Suppose we have one network 192.168.1.0/24 and want to limit Bandwidth for day and Night Time.

Network 192.168.1.0/24
Bandwidth = 06:00am – 18:00pm – 1Mbps.
Bandwidth = 18:00pm – 06:00am – 2Mbps.

Create two simple queues for the same network with different Bandwidth Limit.

/queue simple
#name=”Day” target-addresses=192.168.1.0/24 dst-address=0.0.0.0/0
interface= parent=none direction=both priority=8
queue=default-small/default-small limit-at=512k/512k
max-limit=1M/1M total-queue=default-small

#name=”Night” target-addresses=192.168.1.0/24 dst-address=0.0.0.0/0
interface= parent=none direction=both priority=8
queue=default-small/default-small limit-at=1M/1M
max-limit=2M/2M total-queue=default-small

Now, write scripts

/system script
#name=”Day” source=/queue simple enable Day; /queue simple disable Night

#name=”Night” source=/queue simple enable Night; /queue simple disable Day

Finally, Schedule it

/system scheduler
#name=”Day” on-event=Day start-date=oct/13/2007 start-time=06:00:00 interval=1d

#name=”Night” on-event=Night start-date=oct/13/2007 start-time=18:00:00 interval=1d

Block Web Sites” & “How to Stop Downloading

From MikroTik Wiki

This example will explain you “How to Block Web Sites” & “How to Stop Downloading”. I have use Web-Proxy test Package.

First, Configure Proxy.

/ip proxy
enabled: yes
src-address: 0.0.0.0
port: 8080
parent-proxy: 0.0.0.0:0
cache-drive: system
cache-administrator: "ASHISH PATEL"
max-disk-cache-size: none
max-ram-cache-size: none
cache-only-on-disk: no
maximal-client-connections: 1000
maximal-server-connections: 1000
max-object-size: 512KiB
max-fresh-time: 3d

Now, Make it Transparent

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

Make sure that your proxy is NOT a Open Proxy

/ip firewall filter
chain=input in-interface= src-address=0.0.0.0/0 protocol=tcp dst-port=8080 action=drop

Now for Blocking Websites

/ip proxy access
dst-host=www.vansol27.com action=deny

It will block website http://www.vansol27.com, We can always block the same for different networks by giving src-address. It will block for particular source address.

We can also stop downloading files like.mp3, .exe, .dat, .avi,…etc.

/ip proxy access
path=*.exe action=deny
path=*.mp3 action=deny
path=*.zip action=deny
path=*.rar action=deny.

Try with this also

/ip proxy access
dst-host=:mail action=deny

This will block all the websites contain word “mail” in url.

Example: It will block www.hotmail.com, mail.yahoo.com, www.rediffmail.com

ref:http://wiki.mikrotik.com

Filter MAC di Mikrotik dan Linux

Berhubung ada beberapa rekan yang bertanya via Japri, maka saya mencoba untuk membagi sedikit pengalaman, tentang topik di atas. Paparan berikut ini, juga hasil percobaan sendiri melalui Referensi yang di peroleh ketika Googling. Saya tidak menuliskan siapa sumber aslinya, karena saya lupa dimana ketemu Linksnya. Kalau ada yang merasa, paparan dibawah ini, hasil pemikirannya, dengan senang hati, saya akan menuliskan nama anda.

Di Mikrotik

Setingan memakai interface GUI via Winbox.

Tambahkan IP Client dan Mac Address di ‘/ip arp’, biasanya, di menu ip arp tersebut telah ada Interface, mac address dan ip address client secara dinamis, tinggal di Statis kan saja. Di Winbox klik kanan, ambil Make Statik.

Setelah IP address dan Mac Address client tersebut di statiskan, sekarang ke menu Interface. Pada Terminal ‘/interface’.

arp.gif

Pada submenu Interface List, Klik aja Interface yang ada disitu. Perhatikan di bagian ARP. Ambil option, reply-only, atau arp=reply-only.

Untuk mainin di Firewall silahkan telaah script berikut.

/ ip firewall filter
add chain=forward action=drop src-address=x.x.x.x \
src-mac-address=!yy:yy:yy:yy:yy:yy comment=”" disabled=no

/ ip firewall filter
add chain=forward action=drop src-address=!x.x.x.x \
src-mac-address=yy:yy:yy:yy:yy:yy comment=”" disabled=no

Di Linux dengan IP Tables

Sumber asli http://mujie.blog.palangkaraya.net/

Skrip berikut di tulis via Bash di Linux, yang sudah mendukung untuk banyak Client (Mac dan IP Address).

Berikut langkah-langkahnya :

1. Buat file bernama rc.iplock didalam directory /etc/rc.d/ dengan isi sebagai berikut:

#!/bin/bash
# Bash script Lock IP Address dan MAC Address
iptables=”/sbin/iptables” #path ke iptables
files=”/etc/rc.d/list.txt” #path ke list IP Address dan MAC Address
device=”eth1″ #ethernet devices ke client
lockall=”yes” #yes|no ,yes jika mendaftarkan semua IP & MAC Address
#jika tidak, tulis no.
#yes untuk metode pertama, no untuk metode kedua

if [ $lockall = "yes" ]; then
$iptables -I PREROUTING -t nat -i $device -j DROP
cat $files | while read ip_address mac_address; do
$iptables -I PREROUTING -t nat -i $devices -s $ip_address
-m mac –mac-source $mac_address -j ACCEPT
$iptables -I FORWARD -i $device -s ! $ip_address
-m mac –mac-source $mac_address -j DROP
$iptables -I PREROUTING -t nat -s ! $ip_address
-m mac –mac-source $mac_address -j DROP
done
elif [ $lockall = “no” ]; then
$iptables -I PREROUTING -t nat -i $device -j ACCEPT
cat $files | while read ip_address mac_address; do
$iptables -I FORWARD -i $device -s ! $ip_address
-m mac –mac-source $mac_address -j DROP
$iptables -I PREROUTING -t nat -s ! $ip_address
-m mac –mac-source $mac_address -j DROP
done
fi

echo “Locking IP Address and Mac Address…”
#end script

2. Buat file bernama list.txt didalam directory /etc/rc.d/ dengan format penulisan sebagai berikut :

Peringatan!! Jangan tambahkan baris apapun atau kalimat apapun selain format diatas!

Contoh isi file /etc/rc.d/list.txt untuk 3 client:

192.168.1.5 00:89:CD:64:01:EF
192.168.1.20 00:90:DD:14:11:CF
192.168.1.14 00:40:EE:21:26:GE

3. Set file rc.iplock agar dapat di eksekusi :

chmod +x /etc/rc.d/rc.iplock

4. Tambahkan didalam file /etc/rc.d/rc.local agar dapat di eksekusi pada saat start up :

/etc/rc.d/rc.iplock

5. Jalankan :

/etc/rc.d/rc.iplock

6. Selesai!
————————-
a) add the -s a.b.c.d -m mac –mac aa:bb:cc:dd:ee:ff to each rule which you
only want to match a specific machine

or

b) put all your rules into a user-defined chain, and then jump to that chain
only for packets which match the required IP/MAC combination:

iptables -N myrules
iptables -A myrules -p tcp –dport 21 -j ACCEPT
iptables -A myrules -p tcp –dport 23 -j ACCEPT
etc
iptables -A INPUT -s a.b.c.d -m mac –mac aa:bb:cc:dd:ee:ff -j myrules

With this design you can also easily allow more than one machine to connect if
you wish, by adding another INPUT rule:

iptables -A INPUT -s w.x.y.z -m mac –mac uu:vv:ww:xx:yy:zz -j myrules

Selamat mencoba,

Thursday, December 13, 2007

Intalasi Mikrotik

1. Intallasi

Booting melalui CD-ROM

Atur di BIOS agar, supaya boot lewat CD-ROM, kemudian tunggu beberapa
saat di monitor akan muncul proses Instalasi.

????????????????????????-

ISOLINUX 2.08 2003-12-12 Copyrigth (C) 1994-2003 H. Peter Anvin
Loading linux??????
Loading initrd.rgz????.
Ready
Uncompressing Linux? Ok, booting the kernel

????????????????????????

Memilih paket software

Setelah proses booting akan muncul menu pilihan software yang
mau di install, pilih sesuai kebutuhan yang akan direncanakan.

Paket yang tersedia di Mikrotik

advanced-tools-2.9.27.npk
arlan-2.9.27.npk
dhcp-2.9.27.npk
gps-2.9.27.npk
hotspot-2.9.27.npk
hotspot-fix-2.9.27.npk
isdn-2.9.27.npk
lcd-2.9.27.npk
ntp-2.9.27.npk
ppp-2.9.27.npk
radiolan-2.9.27.npk
routerboard-2.9.27.npk
routing-2.9.27.npk
routing-test-2.9.27.npk
rstp-bridge-test-2.9.27.npk
security-2.9.27.npk
synchronous-2.9.27.npk
system-2.9.27.npk
telephony-2.9.27.npk
ups-2.9.27.npk
user-manager-2.9.27.npk
web-proxy-2.9.27.npk
webproxy-test-2.9.27.npk
wireless-2.9.27.npk
wireless-legacy-2.9.27.npk

?????????????????????????

Welcome to Mikrotik Router Software Installation

Move around menu using ?p? and ?n? or arrow keys, select with ?spacebar?.
Select all with ?a?, minimum with ?m?. Press ?i? to install locally or ?r? to
install remote router or ?q? to cancel and reboot.

[X] system [ ] lcd [ ] telephony
[ ] ppp [ ] ntp [ ] ups
[ ] dhcp [ ] radiolan [ ] user-manager
[X] andvanced-tools [ ] routerboard [X] web-proxy
[ ] arlan [ ] routing [ ] webproxy-test
[ ] gps [ ] routing-test [ ] wireless
[ ] hotspot [ ] rstp-bridge-test [ ] wireless-legacy
[ ] hotspot [X] security
[ ] isdn [ ] synchronous

?????????????????????????

Umumnya Paket Mikrotik untuk Warnet, Kantor atau SOHO adalah :

a. SYSTEM : Paket ini merupakan paket dasar, berisi Kernel dari
Mikrotik

b. DHCP : Paket yang berisi fasilitas sebagai DHCP Server, DHCP
client, pastikan memilih paket ini jika Anda menginginkan
agar Client diberikan IP address otomatis dari DHCP Server

c. SECURITY : Paket ini berisikan fasilitas yang mengutamakan Keamanan
jaringan, seperti Remote Mesin dengan SSH, Remote via MAC
Address

d. WEB-PROXY : Jika Anda memilih paket ini, maka Mikrotik Box anda telah
dapat menjalan service sebagai Web proxy yang akan menyimpan
cache agar traffik ke Internet dapat di reduksi serta browsing
untuk Web dapat dipercepat.

e. ADVANCED TOOLS : Paket yang berisi Tool didalam melakukan Admnistrasi jaringan,
seperti Bandwidth meter, Scanning, Nslookup, dan lain sebagainya.

Instalasi Paket

ketik ?i? setelah selesai memilih software, lalu akan muncul menu
pilihan seperti ini :

- Do you want to keep old configuration ? [y/n] ketik Y
- continue ? [y/n] ketik Y

Setelah itu proses installasi system dimulai, disini kita tidak
perlu membuat partisi hardsik karena secara otomatis mikrotik akan
membuat partisi sendiri.

?????????????????????????-

wireless-legacy (depens on system):
Provides support for Cisco Aironet cards and for PrismlI and Atheros wireless
station and AP.

Do you want to keep old configuraion? [y/n]:y

Warning: all data on the disk will be erased!

Continue? [y/n]:y

Creating partition???.
Formatting disk?????????????

Installing system-2.9.27 [################## ]

?????????????????????????

Proses installasi

?????????????????????????

Continue? [y/n]:y

Creating partition???????..
Formatting disk?????????.

Installed system-2.9.27
Installed advanced-tools-2.9.27
Installed dhcp-2.9.27
Installed security-2.9.27
installed web-proxy-2.9.27

Software installed.
Press ENTER to reboot

??????????????????????????

2. Konfigurasi

Setelah selesai restart, maka akan muncul form login

Mikrotik login = admin
Password = (kosong, enter saja)

Setelah muncul tampilan awal, masukkan beberapa perintah untuk menset IP Address,Gateway,NAT,DNS

IP Address yang pertama
[admin@Mikrotikl] > ip address add address=192.168.1.2
netmask=255.255.255.0 interface=Ether0 comment=?IP ke Internet?

IP Address yang kedua
[admin@Mikrotikl] > ip address add address=192.168.0.30
netmask=255.255.255.224 interface=Ether1 comment = ?IP ke LAN?

Perintah mengecek IP address
[admin@Mikrotik] >ip address print
Flags: X - disabled, I - invalid, D - dynamic
# ADDRESS NETWORK BROADCAST INTERFACE
0 ;;; IP Address ke Internet
192.168.0.30/27 192.168.0.0 192.168.0.31 ether0
1 ;;; IP Address ke LAN
192.168.1.2/24 192.168.0.0 192.168.1.255 ether1
[admin@Mikrotik]>

Setelah itu menset Gateway,Bentuk Perintah Konfigurasi gateway

ip route add gateway={ip gateway}

Memberikan default Gateway, diasumsikan gateway untuk koneksi internet adalah 192.168.1.1

[admin@Mikrotik] > /ip route add gateway=192.168.1.1

Melihat Tabel routing pada Mikrotik Routers

[admin@Mikrotik] > ip route print

Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf
# DST-ADDRESS PREFSRC G GATEWAY DISTANCE INTERFACE
0 ADC 192.168.0.0/24 192.168.0.30 Local
1 ADC 192.168.0.0/27 192.168.1.2 Public
2 A S 0.0.0.0/0 r 192.168.1.1 Public
[admin@Mikrotik]>

Tes Ping ke Gateway untuk memastikan konfigurasi sudah benar

[admin@Mikrotik] > ping 192.168.1.1
192.168.1.1 64 byte ping: ttl=64 time<1 ms
192.168.1.1 64 byte ping: ttl=64 time<1 ms
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0/0.0/0 ms
[admin@Mikrotik]>

Mensetting NAT (Network Address Translation),Bentuk Perintah Konfigurasi

ip firewall nat add chain=srcnat action=masquerade out-inteface={ethernet yang langsung terhubung ke Internet atau Public}

[admin@Mikrotik] > ip firewall nat add chain=scrnat out-interface=ether0 action=masquerade
[admin@Mikrotik]>

Melihat konfigurasi Masquerading

[admin@Mikrotik] ip firewall nat print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=srcnat out-interface=Public action=masquerade
[admin@Mikrotik]>

Bentuk Perintah Konfigurasi DNS

ip dns set primary-dns={dns utama} secondary-dns={dns ke dua}

Setup DNS pada Mikrotik Routers, misalkan DNS dengan Ip Addressnya Primary = 202.134.0.155, Secondary = 202.134.2.5

[admin@Mikrotik] > ip dns set primary-dns=202.134.0.155 allow-remoterequests=no
[admin@Mikrotik] > ip dns set secondary-dns=202.134.2.5 allow-remoterequests=no

Melihat konfigurasi DNS

[admin@Mikrotik] > ip dns print
primary-dns: 202.134.0.155
secondary-dns: 202.134.2.5
allow-remote-requests: no
cache-size: 2048KiB
cache-max-ttl: 1w
cache-used: 16KiB

[admin@mikrotik]>

Tes untuk akses domain, misalnya dengan ping nama domain

[admin@Mikrotik] > ping yahoo.com
216.109.112.135 64 byte ping: ttl=48 time=250 ms
10 packets transmitted, 10 packets received, 0% packet loss
round-trip min/avg/max = 571/571.0/571 ms
[admin@Mikrotik]>

3. Melimit Kecepatan Akses Client

Bentuk perintah konfigurasi:

queue simple add name={ nama }
target-addresses={ ip address yang dituju }
interface={ interface yang digunakan untuk melewati data }
max-limit={ out/in }

Dibawah ini terdapat konfigurasi Trafik shaping atau bandwidth management dengan metode Simple Queue. Diasumsikan Client ada sebanyak 5 client, dan masing-masing client diberi jatah bandwidth minimum sebanyak 8kbps, dan maksimum 48kbps. Sedangkan Bandwidth totalnya sebanyak 192kbps. Untuk upstream tidak diberi rule, berarti masing-masing client dapat menggunakan bandwidth uptream secara maksimum. Perhatikan perintah priority, range priority di Mikrotik sebanyak delapan. Berarti dari 1 sampai 8, priority 1 adalah priority tertinggi, sedangkan priority 8 merupakan priority terendah.

Berikut Contoh kongirufasinya.
???????????????????????????
/ queue simple
add name=?trafikshaping? target-addresses=192.168.0.0/27 dst-address=0.0.0.0/0
interface=all parent=none priority=1 queue=default/default
limit-at=0/64000 max-limit=0/192000 total-queue=default disabled=no
add name=?01″ target-addresses=192.168.0.1/32 dst-address=0.0.0.0/0
interface=all parent=trafikshaping priority=1 queue=default/default
limit-at=0/8000 max-limit=0/48000 total-queue=default disabled=no
add name=?02″ target-addresses=192.168.0.2/32 dst-address=0.0.0.0/0
interface=all parent=trafikshaping priority=1 queue=default/default
limit-at=0/8000 max-limit=0/48000 total-queue=default disabled=no
add name=?03″ target-addresses=192.168.0.3/32 dst-address=0.0.0.0/0
interface=all parent=trafikshaping priority=1 queue=default/default
limit-at=0/8000 max-limit=0/48000 total-queue=default disabled=no
add name=?04″ target-addresses=192.168.0.4/32 dst-address=0.0.0.0/0
interface=all parent=trafikshaping priority=1 queue=default/default
limit-at=0/8000 max-limit=0/48000 total-queue=default disabled=no
add name=?10″ target-addresses=192.168.0.25/32 dst-address=0.0.0.0/0
interface=all parent=trafikshaping priority=1 queue=default/default
limit-at=0/8000 max-limit=0/48000 total-queue=default disabled=no
add name=?05″ target-addresses=192.168.0.5/32 dst-address=0.0.0.0/0
interface=all parent=trafikshaping priority=1 queue=default/default
limit-at=0/8000 max-limit=0/48000 total-queue=default disabled=no