OpenWRT (Backfire)

#SET PASSWORD UNTUK ROOT
#AKTIFKAN WIFI
#GANTI REPO LOKAL
root@OpenWrt:~# vi /etc/opkg.conf
src/gz packages http://192.168.1.2/backfire/10.03.1/ar71xx/packages
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
#UPDATE LIST REPO
root@OpenWrt:~# opkg update
Downloading http://192.168.1.2/backfire/10.03.1/ar71xx/packages/Packages.gz.
Inflating http://192.168.1.2/backfire/10.03.1/ar71xx/packages/Packages.gz.
Updated list of available packages in /var/opkg-lists/packages.
#INSTALL KEBUTUHAN
root@OpenWrt:~# opkg install vim bash coreutils-nohup curl nmap
#INSTALL MODEM
root@OpenWrt:~# opkg install comgt chat kmod-usb-core kmod-usb-uhci ppp kmod-usb-serial-option usb-modeswitch usb-modeswitch-data luci-proto-3g
#MENAMBAHKAN KONFIGURASI BARU UNTUK MODEM
root@OpenWrt:~# vim /etc/config/network
config 'interface' '3g'
option 'ifname' 'ppp0'
option 'proto' '3g'
option 'service' 'evdo'
option 'device' '/dev/ttyUSB0'
option 'username' 'm8'
option 'password' 'm8'
option 'dns' '8.8.8.8 8.8.4.4'
#MENAMBAHKAN RULE WAN UNTUK INTERFACE 3G
root@OpenWrt:~# vim /etc/config/firewall
config zone
option name wan
option network 'wan 3g'
option input REJECT
option output ACCEPT
option forward REJECT
option masq 1
option mtu_fix 1
#INSTALL STORAGE
root@OpenWrt:~# opkg install kmod-usb2 usbutils kmod-usb-storage kmod-usb-storage-extras block-mount block-hotplug block-extroot blkid kmod-scsi-generic kmod-fs-ext4 kmod-fs-ntfs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-utf8 ntfs-3g e2fsprogs sdparm
#MEMBUAT HOME FOLDER
root@OpenWrt:~# mkdir /home
#FORMAT FLASHDISK
EXT4 70% PRIMARY
SWAP 25% PRIMARY
{SISA KOSONG} 5%
#KUNCI FLASHDISK DENGAN ID
root@OpenWrt:~# blkid
/dev/sda1: LABEL="ARIE" UUID="feff87d4-9a03-ce01-f06e-86d49a03ce01"
#SETTING STORAGE AUTO-MOUNT
root@OpenWrt:~# vim /etc/config/fstab
config global automount
option from_fstab 1
option anon_mount 1
config global autoswap
option from_fstab 1
option anon_swap 0
config mount
option target /home
#option device /dev/sda1
option uuid feff87d4-9a03-ce01-f06e-86d49a03ce01
option fstype ext4
option options rw,sync
option enabled 1
option enabled_fsck 0
option is_rootfs 0
config swap
option device /dev/sda2
option enabled 1
root@OpenWrt:~# /etc/init.d/fstab enable
root@OpenWrt:~# /etc/init.d/fstab start
#INSTALL PACKAGE ARDUINO
root@OpenWrt:~# opkg install kmod-usb-serial-ftdi coreutils-stty kmod-usb-acm
#INSTALL PACKAGE SMS GATEWAY
root@OpenWrt:~# opkg install gnokii bluez-libs libpcsclite
#SETTING SMS GATEWAY
root@OpenWrt:~# ls /dev/ttyUSB*
/dev/ttyUSB0 #UNTUK INTENET ALIAS MODEM
/dev/ttyUSB1 #UNTUK SMS SMSGATEWAY
root@OpenWrt:~# vim /etc/gnokiirc
[global]
model = AT
port = /dev/ttyUSB1
connection = serial
root@OpenWrt:~# vim /root/.gnokiirc
[global]
model = AT
port = /dev/ttyUSB1
connection = serial
#CEK SETTING SMS GATEWAY
root@OpenWrt:~# gnokii --identify
GNOKII Version 0.6.21
IMEI : 358093021456721
Manufacturer : QUALCOMM INCORPORATED
Model : C-180
Product name : C-180
Revision : 120016_062_001
#TES KIRIM SMS
echo "TES SMS GATEWAY DENGAN GNOKII" | tr '+' ' ' | gnokii --sendsms +6288217134491
#LIHAT SMS MASUK
gnokii --getsms SM 0 #LIHAT SMS DENGAN ID 0
gnokii --getsms SM 0 end #LIHAT SEMUA SMS
#HAPUS SMS MASUK
gnokii --deletesms SM 0 #HAPUS SMS DENGAN ID 0
gnokii --deletesms SM 0 end #HAPUS SEMUA SMS
#EXTROOT
root@OpenWrt:~# mkdir -p /tmp/cproot
root@OpenWrt:~# mount --bind / /tmp/cproot
root@OpenWrt:~# tar -C /tmp/cproot -cvf - . | tar -C /home -xf -
root@OpenWrt:~# umount /tmp/cproot
#AKTIFKAN EXTROOT
root@OpenWrt:~# vim /etc/config/fstab
config global automount
option from_fstab 1
option anon_mount 1
config global autoswap
option from_fstab 1
option anon_swap 0
config mount
option target /home
#option device /dev/sda1
option uuid feff87d4-9a03-ce01-f06e-86d49a03ce01
option fstype ext4
option options rw,sync
option enabled 1
option enabled_fsck 0
option is_rootfs 1 #UBAH DARI 0 MENJADI 1
config swap
option device /dev/sda2
option enabled 1
#RESTART ROUTER
root@OpenWrt:~# reboot
#CEK EXTROOT & SWAP
root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 1.9M 1.9M 0 100% /rom
tmpfs 14.4M 112.0K 14.3M 1% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
/dev/sda1 5.6G 22.0M 5.3G 0% /overlay <<< EXTROOT SUDAH JALAN
mini_fo:/overlay 1.9M 1.9M 0 100% /
root@OpenWrt:~# free
total used free shared buffers
Mem: 29428 22856 6572 0 2996
Swap: 1048568 0 1048568 <<< SWAP SUDAH JALAN
Total: 1077996 22856 1055140
#INSTALL PYTHON
root@OpenWrt:~# opkg install python pyserial
#INSTALL APACHE & PHP5
root@OpenWrt:~# opkg install apache php5 php5-cgi
#EDIT PHP.INI
root@OpenWrt:~# vim /etc/php.ini
memory_limit = 128M
post_max_size = 1024M
upload_max_filesize = 1024M
doc_root =
extension = gd.so
#EDIT HTTPD.CONF
root@OpenWrt:~# vim /etc/apache/httpd.conf
Listen 192.168.1.1:81
ServerName 192.168.1.1:81
---TAMBAHKAN---
<Directory "/usr/bin">
AllowOverride None
Options none
Order allow,deny
Allow from all
</Directory>
---------------
<IfModule alias_module>
DirectoryIndex index.php index.html
<IfModule>
<IfModule alias_module>
ScriptAlias /php/ "/usr/bin/"
<IfModule>
<IfModule mime_module>
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php-cgi"
<IfModule>
#INSTALL PHP5 EXTENSION
root@OpenWrt:~# opkg install php5-mod-ctype php5-mod-curl php5-mod-dom php5-mod-exif php5-mod-fileinfo php5-mod-ftp php5-mod-gd php5-mod-gettext php5-mod-gmp php5-mod-hash php5-mod-iconv php5-mod-json php5-mod-ldap php5-mod-mbstring php5-mod-mcrypt php5-mod-mysql php5-mod-openssl php5-mod-pcntl php5-mod-pdo php5-mod-pdo-mysql php5-mod-pdo-pgsql php5-mod-pdo-sqlite php5-mod-pgsql php5-mod-session php5-mod-simplexml php5-mod-soap php5-mod-sockets php5-mod-sqlite php5-mod-sqlite3 php5-mod-sysvmsg
root@OpenWrt:~# opkg install php5-mod-sysvsem php5-mod-sysvshm php5-mod-tokenizer php5-mod-xml php5-mod-xmlreader php5-mod-xmlwriter
root@OpenWrt:~# opkg install php5-mod-apc
#BUAT SCRIPT AUTOSTART APACHE WEBSERVER
root@OpenWrt:~# vim /etc/init.d/apache
#!/bin/sh /etc/rc.common
START=10
STOP=15
start() {
echo Starting apache...
apachectl start
}
restart() {
echo Restarting apache...
apachectl restart
}
stop() {
echo Stopping apache...
apachectl stop
}
#JALANKAN SCRIPT AUTOSTART APACHE WEBSERVER
root@OpenWrt:~# /etc/init.d/apache start
root@OpenWrt:~# /etc/init.d/apache enable
#INSTALL MYSQL
root@OpenWrt:~# opkg install mysql-server
root@OpenWrt:~# sed -i 's,^datadir.*,datadir = "/srv/mysql",g' /etc/my.cnf
root@OpenWrt:~# sed -i 's,^tmpdir.*,tmpdir = "/tmp",g' /etc/my.cnf
root@OpenWrt:~# mkdir -p /srv/mysql
root@OpenWrt:~# mysql_install_db --force
root@OpenWrt:~# /etc/init.d/mysqld start
root@OpenWrt:~# /etc/init.d/mysqld enable
#SET PASSWORD MYSQL
root@OpenWrt:~# mysqladmin -u root password asdf1234
#MASUK MYSQL
root@OpenWrt:~# mysql -u root -p
#SUPAYA MYSQL BISA DIAKSES DARI LUAR
root@OpenWrt:~# vim /etc/my.cnf
#bind-address = 127.0.0.1 #TAMBAHKAN TANDA PAGAR DIDEPANNYA
#CEK PORT MYSQL
root@OpenWrt:~# nmap 192.168.1.1
Starting Nmap 5.51 ( http://nmap.org ) at 2014-08-04 11:04 UTC
Nmap scan report for OpenWrt.lan (192.168.1.1)
Host is up (0.00023s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
22/tcp open ssh
53/tcp open domain
80/tcp open http
3306/tcp open mysql <<< SUDAH SUKSES
#BUAT FOLDER BARU WWW2
root@OpenWrt:~# mkdir /www2
#TAMBAH WEBSERVER UHTTPD
root@OpenWrt:~# vim /etc/config/uhttpd
config uhttpd secondary
list listen_http 0.0.0.0:82
option listen_http 82
option home /www2
#index_page index.php,index.html,index.htm
#list interpreter ".php=/usr/bin/php-cgi"
#TWEAKING KONEKSI KHUSUS MODEM CDMA
root@OpenWrt:~# vim /etc/chatscripts/evdo.chat
# This is a simple chat script based off of the one provided by Sierra Wireless
# for CDMA connections. It should work for both Sprint and Verizon networks.
ABORT BUSY
ABORT 'NO CARRIER'
ABORT ERROR
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT DELAYED
REPORT CONNECT
TIMEOUT 10
'' AT
OK ATZ
OK 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0' #TAMBAH BARIS INI
SAY 'Calling CDMA/EVDO'
TIMEOUT 30
OK ATDT#777
CONNECT ''
root@OpenWrt:~# vim /etc/config/network
config 'interface' '3g'
option 'ifname' 'ppp0'
option 'proto' '3g'
option 'device' '/dev/ttyUSB0'
option 'service' 'evdo'
option 'apn' 'smartfren'
option 'username' 'smartfren'
option 'password' 'smartfren'
option 'dns' '8.8.8.8 8.8.4.4'
option 'pppd_options' 'noipdefault' #JIKA CHAP AUTHENTICATION SUKSES TAPI PUTUS TIBA-TIBA
#option 'pppd_options' 'noipdefault refuse-chap refuse-mschap refuse-mschap-v2 refuse-eap' #JIKA PROVIDER HANYA SUPPORT PAP AUTHENTICATION
#NOTE: PILIH SALAH SATU "option 'pppd_options'" DIATAS
#TWEAKING TRANSFER RATE USB DRIVE
root@OpenWrt:~# vim /etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
echo 1024 > /sys/block/sdX/device/max_sectors #TAMBAHKAN BARIS INI
#NOTE: PADA "sdX" DIATAS, GANTI DENGAN USB DRIVE YANG TERSEDIA. CO: sda, sdb, dll.
exit 0
view raw openwrt.txt hosted with ❤ by GitHub

1 komentar:

Anonim mengatakan...

Mas mu tnya
Bisa mnta cntoh penulisan curl yg benar??
Untuk post data dari openwrt ke web...