Tuesday, December 24, 2019
Sunday, December 22, 2019
Tuesday, December 10, 2019
Limit Android
:foreach i in=[ip dhcp-server lease find host-name~"android"] do={:local hostIP value=[/ip dhcp-server lease get $i value-name=active-address ]Tambah list2 IP android ke /firewall > address list
ip firewall address-list add address=$hostIP disabled=no list=android-ip}
:foreach i in=[ip dhcp-server lease find host-name~"Galaxy"] do={:local hostIP value=[/ip dhcp-server lease get $i value-name=active-address ]
ip firewall address-list add address=$hostIP disabled=no list=android-ip}
:foreach i in=[ip dhcp-server lease find host-name~"vivo"] do={:local hostIP value=[/ip dhcp-server lease get $i value-name=active-address ]
ip firewall address-list add address=$hostIP disabled=no list=android-ip}
:foreach i in=[ip dhcp-server lease find host-name~"Redmi"] do={:local hostIP value=[/ip dhcp-server lease get $i value-name=active-address ]
ip firewall address-list add address=$hostIP disabled=no list=android-ip}
:foreach i in=[ip dhcp-server lease find host-name~"OPPO"] do={:local hostIP value=[/ip dhcp-server lease get $i value-name=active-address ]
ip firewall address-list add address=$hostIP disabled=no list=android-ip}
:foreach i in=[ip dhcp-server lease find host-name~"realme"] do={:local hostIP value=[/ip dhcp-server lease get $i value-name=active-address ]
ip firewall address-list add address=$hostIP disabled=no list=android-ip}
@MikroTik] > ip firewall mangle add chain=forward action=mark-packet new-packet-mark=android-up passthrough=no src-address-list=android-ip log=no log-prefix="" comment="android-up"Tambah Mangle untuk traffic android upload download
@MikroTik] > ip firewall mangle add chain=forward action=mark-packet new-packet-mark=android-download passthrough=no dst-address-list=android-ip log=no log-prefix="" comment="android-download"
@MikroTik] > queue type add name="PCQ User" kind=pcq pcq-rate=0 pcq-limit=50 pcq-classifier=src-address,dst-address pcq-total-limit=2k pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-src-address-mask=32 pcq-dst-address-mask=32 pcq-src-address6-mask=64 pcq-dst-address6-mask=6tambah PCQ User dan tambah limit di limit tree
@MikroTik] > queue tree add name="User Limit" parent=global packet-mark=user-limit-down,user-limit-up limit-at=6M queue=PCQ User priority=8 max-limit=6M burst-limit=0 burst-threshold=0 burst-time=0s
Limit Android di Mikrotik
penggabungan dari TAMBAH HOSTNAME ANDROID ke ADDRESS LIST>> MANGLE >> LIMIT QUEUE
http://scubyx.blogspot.com/2015/03/tutorial-mikrotik-script-untuk.html
https://medium.com/@kura1420/membuat-limitasi-bandwidth-di-mikrotik-menggunakan-pcq-e3b5feb8cf32
Untuk antisipasi jika ada perangkat android baru yang konek, maka bisa ditambahkan script berikut untuk menghapus address list android-ip dan jalankan lagi script sebelumnya untuk menambahkan data yang lebih baru.
mikrotik memang perangkat yang istimewa, harganya tidak terlampau mahal jika disbanding kan dengan router-router branded lainnya, tapi fungsi yang didalamnya tidak kalah, sangat fleksibel dan bisa bisa digunakan dengan berbagai cara.
http://scubyx.blogspot.com/2015/03/tutorial-mikrotik-script-untuk.html
https://medium.com/@kura1420/membuat-limitasi-bandwidth-di-mikrotik-menggunakan-pcq-e3b5feb8cf32
LIMIT BANDWIDTH ANDROID DI MIKROTIK
kali ini gue mau share tutorial tentang mikrotik, beberapa hal yang menarik (buat gue :p ) bakal dibagi di sini, kali ini tentang perangkat android yang ikut pada jaringan mikrotik. Tentunya pada kebingungan ga sih kalo ada perangkat android banyak, semua pada donlot or main game, kebayang gat uh bandwidth kantor diabisin semua ama hape2 android tidak dikenal.
Untuk jaringan yang menggunakan DHCP server, pasti terlihat di DHCP leases hostname perangkat yang mendapatkan IP dari mikrotik, hal ini dapat dimanfaatkan untuk mengelompokkan berdasarkan hostname android untuk ditambahkan secara otomatis di address list. Yang nantinya address list ini akan menjadi sumber segalanya, mau langsung di limit simple queue, atau dilakukan packet marking, atau dirubah jalur routingnya, semuanya bisa asal harus menambah address list.
Jika perangkat android selalu berganti-ganti, maka akan menyulitkan admin jaringan untuk menambahkan IP android tersebut di address list. Nah gue ada script sederhana untuk menambahkan hostname android di DHCP leases untuk dimasukkan kedalam address list.
#untuk menemukan dan memindahkan ke addreas list
:foreach i in=[/ip dhcp-server lease find host-name~"android"] do={
:local hostIP value=[/ip dhcp-server lease get $i value-name=active-address]
/ip firewall address-list add address=$hostIP disabled=no list=android-ip
}
Naah..script itu bisa di jalankan di new terminal, seharusnya semua hostname dengan label android akan dipindahkan ke address list android-ip, untuk pelabelan nama sudah ane kasih warna merah, bisa diganti sesuka kalian.
#untuk menemukan dan menghapus
ip firewall address-list remove [find list~"android-ip"]
sekian tutorial ini, semoga bisa membantu, jika ada masukan atau sharing tentang mikrotik dll bisa di komenkan di sini atau email juga boleh :
mikrotik tambah firewall rule 11 desember 2019
Add these commands to your terminal:
/ip firewall filter add action=drop chain=forward port=5228 protocol=tcp
/ip firewall filter add action=drop chain=forward port=5228 protocol=udp
And move on top of your ip firewall list, these rules will block all 5228 port packets
/ip firewall filter add action=drop chain=forward port=5228 protocol=tcp
/ip firewall filter add action=drop chain=forward port=5228 protocol=udp
And move on top of your ip firewall list, these rules will block all 5228 port packets
Monday, December 9, 2019
Cara Mudah Blokir Google Play Store di MikroTik Groove A-52 HPn
Memblokir Google Play Store sekarang bisa menggunakan fungsi Firewall di MikroTik dengan menambahkan kata kunci pada kolom Content kata berikut:
gvt1
Selanjutnya dapat dilihat pada gambar berikut:
Perhatikan pada gambar terakhir. Baris yang disorot warna biru menampilkan besar data yang berhasil diblokir oleh MikroTik. Berikut tampilan Google Play Store yang diblokir:
Kualitas sinyal WiFi baik, penuh tetapi, Play Store mengalami error "Batas waktu koneksi berakhir". Layanan APK yang telah terinstall tidak terganggu, terlihat pada gambar diatas pada status bar, WhatsApp terhubung sempurna.
Sekian tips dari saya, jangan lupa main-main ke www.forummikrotik.com dimana tips ini saya temukan. Semoga bermanfaat, dan selalu berbagi.
Thursday, October 10, 2019
set jam waktu date linux terminal
Linux Set Date and Time From a Command Prompt
last updated in CategoriesBASH Shell, CentOS, Commands, Debian / Ubuntu, Fedora Linux, Linux, RedHat and Friends, SuseUse the date command to display the current date and time or set the system date / time over ssh session. You can also run the date command from X terminal as root user.
[donotprint][/donotprint]This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from the shell prompt.
You must login as root user to use date command.
Linux Display Current Date and Time
Just type the date command:
Sample outputs:
$ date
Sample outputs:
Mon Jan 21 01:31:40 IST 2019
Linux Display The Hardware Clock (RTC)
Type the following hwclock command to read the Hardware Clock and display the time on screen:
OR

OR show it in Coordinated Universal time (UTC):
Sample outputs:
# hwclock -r
OR
# hwclock --show
$ sudo hwclock --show --verbose

OR show it in Coordinated Universal time (UTC):
# hwclock --show --utc
Sample outputs:
2019-01-21 01:30:50.608410+05:30
Linux Set Date Command Example
Use the following syntax to set new data and time:
For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:
OR
You can also simplify format using following syntax:
date --set="STRING"
For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:
# date -s "2 OCT 2006 18:00:00"
OR
# date --set="2 OCT 2006 18:00:00"
You can also simplify format using following syntax:
# date +%Y%m%d -s "20081128"
Linux Set Time Examples
To set time use the following syntax:
Where,
# date +%T -s "10:13:13"
Where,
- 10: Hour (hh)
- 13: Minute (mm)
- 13: Second (ss)
Use %p locale’s equivalent of either AM or PM, enter:
# date +%T%p -s "6:10:30AM"
# date +%T%p -s "12:10:30PM"
How do I set the Hardware Clock to the current System Time?
Use the following syntax:
OR
# hwclock --systohc
OR
# hwclock -w
A note about systemd based Linux system
With systemd based system you need to use the timedatectl command to set or view the current date and time. Most modern distro such as RHEL/CentOS v.7.x+, Fedora Linux, Debian, Ubuntu, Arch Linux and other systemd based system need to the timedatectl utility. Please note that the above command should work on modern system too.
timedatectl: Display the current date and time
Type the following command:
$ timedatectl

How do I change the current date using the timedatectl command?
To change the current date, type the following command as root user:
OR
For example set the current date to 2015-12-01 (1st, Dec, 2015):
Sample outputs:
# timedatectl set-time YYYY-MM-DD
OR
$ sudo timedatectl set-time YYYY-MM-DD
For example set the current date to 2015-12-01 (1st, Dec, 2015):
# timedatectl set-time '2015-12-01'
# timedatectl
Sample outputs:
Local time: Tue 2015-12-01 00:00:03 EST Universal time: Tue 2015-12-01 05:00:03 UTC RTC time: Tue 2015-12-01 05:00:03 Time zone: America/New_York (EST, -0500) NTP enabled: no NTP synchronized: no RTC in local TZ: no DST active: no Last DST change: DST ended at Sun 2015-11-01 01:59:59 EDT Sun 2015-11-01 01:00:00 EST Next DST change: DST begins (the clock jumps one hour forward) at Sun 2016-03-13 01:59:59 EST Sun 2016-03-13 03:00:00 EDT
To change both the date and time, use the following syntax:
Where,
# timedatectl set-time YYYY-MM-DD HH:MM:SS
Where,
- HH : An hour.
- MM : A minute.
- SS : A second, all typed in two-digit form.
- YYYY: A four-digit year.
- MM : A two-digit month.
- DD: A two-digit day of the month.
For example, set the date ’23rd Nov 2015′ and time to ‘8:10:40 am’, enter:
# timedatectl set-time '2015-11-23 08:10:40'
# date
How do I set the current time only?
The syntax is:
Sample outputs:
# timedatectl set-time HH:MM:SS
# timedatectl set-time '10:42:43'
# date
Sample outputs:
Mon Nov 23 08:10:41 EST 2015
How do I set the time zone using timedatectl command?
To see list all available time zones, enter:
To set the time zone to ‘Asia/Kolkata’, enter:
Verify it:
$ timedatectl list-timezones
$ timedatectl list-timezones | more
$ timedatectl list-timezones | grep -i asia
$ timedatectl list-timezones | grep America/New
To set the time zone to ‘Asia/Kolkata’, enter:
# timedatectl set-timezone 'Asia/Kolkata'
Verify it:
# timedatectl
Local time: Mon 2015-11-23 08:17:04 IST
Universal time: Mon 2015-11-23 02:47:04 UTC
RTC time: Mon 2015-11-23 13:16:09
Time zone: Asia/Kolkata (IST, +0530)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
How do I synchronizing the system clock with a remote server using NTP?
Simply type the following command:
Verify it:
Sample outputs:
# timedatectl set-ntp yes
Verify it:
$ timedatectl
Sample outputs:
Local time: Mon 2015-11-23 08:18:49 IST
Universal time: Mon 2015-11-23 02:48:49 UTC
RTC time: Mon 2015-11-23 02:48:50
Time zone: Asia/Kolkata (IST, +0530)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
Conclusion
Linux users can use date command to print or set the system date and time. Systemd based Linux users can use timedatectl to control the system time and date.
- You can also set new timzone using this mini-howto.
- Man pages – timedatectl(8)
Wednesday, September 25, 2019
Permission Server untuk wordpress dll
chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
https://stackoverflow.com/questions/18352682/correct-file-permissions-for-wordpress
Thursday, April 25, 2019
Solution to Moodle Error: Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write.
Did you ever come across the following error when you try to access Moodle,
"Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write."
This usually happens when cache files are corrupted, one probable cause can be improper shutdown of Moodle system.
Here is the solution to fix the issue.
1. Go to Moodle root directory
#cd /var/www/html/moodle
2. Run the command
#php admin/cli/purge_caches.php
5. Refresh the Moodle Page. Its should work
Source : https://sjamso.blogspot.com/2018/08/solution-to-moodle-error-coding-error.html
"Coding error detected, it must be fixed by a programmer: Failed to unserialise data from file. Either failed to read, or failed to write."
This usually happens when cache files are corrupted, one probable cause can be improper shutdown of Moodle system.
Here is the solution to fix the issue.
1. Go to Moodle root directory
#cd /var/www/html/moodle
2. Run the command
#php admin/cli/purge_caches.php
3. Go to moodledata/cache directory
#cd /var/moodledata/cache
4. Remove the cache store directory, DO NOT remove of change the core_component.php file
# rm -rf cachestore_file/
5. Refresh the Moodle Page. Its should work
Source : https://sjamso.blogspot.com/2018/08/solution-to-moodle-error-coding-error.html
Monday, April 22, 2019
Cara Backup MySQL/MariaDB Secara Otomatis di Linux
Data atau konten dari aplikasi tersimpan di database, oleh karena itu sangat penting untuk melakukan backup secara rutin. Backup di Linux dapat dilakukan secara otomatis pada waktu tertentu. Nah, di tutorial kali ini saya membahas cara backup database MySQL/MariaDB secara otomatis di Linux.
Membuat Bash Script Backup
Membuat folder backup
1
2
|
sudo su
mkdir -p /root/backup/db
|
Membuat bash script di nano
1
|
nano /root/backup.sh
|
Contoh bash script backup seperti di bawah ini, sesuaikan dengan database yang teman-teman gunakan. Backup database MySQL/MariaDB menggunakan mysqldump dan dikombinasikan dengan gzip untuk mengkompres file .sql menjadi .sql.gz. Format nama file juga ditambahkan tanggal backup, %d=day/tanggal %m=month/bulan %y=year/tahun. Hasil backup tersimpan di folder yang telah dibuat sebelumnya /root/backup/db.
1
2
|
#!/bin/bash
mysqldump -uuser_db -ppass_db nama_db | gzip > /root/backup/db/nama_db-$(date +%d%m%Y).sql.gz
|
Setelah membuat bash script backup aktifkan atribut X (execute).
1
|
chmod +x /root/backup.sh
|
Menguji bash script backup, jalankan bash script backup dan cek folder backup.
1
2
|
cd /root
./backup.sh
|
Menjadwalkan Backup di Cron
Setelah bash script backup dibuat, selanjutnya adalah menjadwalkan pemanggilan bash script backup secara otomatis pada waktu tertentu melalui Cron. Misalnya backup dilakukan setiap jam 24.00.
Setiap user bisa memiliki cron, pastikan cron yang disetting adalah cron milik root.
1
|
sudo crontab -e
|
Tambahkan pada baris paling bawah.
1
|
0 0 * * * bash /root/backup.sh
|
Artikel tentang Cron baca di Crontab, Penjadwalan Secara Otomatis di Linux.
Dengan kombinasi bash script dan cron, maka database MySQL/MariaDB dapat dibackup secara otomatis.
selamat mencoba 
Sumber : https://musaamin.web.id/cara-backup-mysql-mariadb-secara-otomatis-di-linux/
Sumber : https://musaamin.web.id/cara-backup-mysql-mariadb-secara-otomatis-di-linux/