Rolly Maulana Awangga :: Catatan Ngoprek IT
Pakar dan Awam sama saja, sama sama belajar
Monthly Archives: Desember 2013
Transparent Proxy on Raspbery Pi
24 Desember 2013
Posted by pada Load Balancing Internet Conection
24 Desember 2013
Posted by pada
Here some command to get load balancing server as a router two, by joining two interface with internet connection based on this article.
ip link set lo up
ip link set eth0 up
ip link set eth0:0 up
#ip link set usb0 up
ip route flush table rt_dev1
ip route flush table rt_dev2
ip route flush table internetip addr add 127.0.0.1/8 brd 127.0.0.255 dev lo
ip addr add 192.168.42.83/24 brd 192.168.42.255 dev usb0
ip addr add 192.168.1.1/24 brd 192.168.1.255 dev eth0
ip addr add 192.168.1.2/24 brd 192.168.1.255 dev eth0:0ip rule add prio 10 table main
ip rule add prio 20 table rt_dev1
ip rule add prio 30 table rt_dev2
ip rule add prio 40 table internetip route del default table main
ip route del default table rt_dev1
ip route del default table rt_dev2
ip route del default table internetip rule add prio 20 from 192.168.42.0/24 table rt_dev1
ip route add default via 192.168.42.129 dev usb0 src 192.168.42.83 proto static table rt_dev1
ip route append prohibit default table rt_dev1 metric 1 proto staticip rule add prio 30 from 192.168.1.0/24 table rt_dev2
ip route add default via 192.168.1.3 dev eth0:0 src 192.168.1.2 proto static table rt_dev2
ip route append prohibit default table rt_dev2 metric 5 proto staticip rule add prio 40 table internet
ip route add default proto static table internet nexthop via 192.168.42.129 dev usb0 weight 1 nexthop via 192.168.1.3 dev eth0:0 weight 1iptables -F
iptables -P INPUT DROP
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -i usb0 -p tcp -s 0/0 –dport 25 -j ACCEPT
iptables -A INPUT -i eth0:0 -p tcp -s 0/0 –dport 25 -j ACCEPT
iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp -i usb0 -j REJECT –reject-with tcp-reset
iptables -A INPUT -p tcp -i eth0:0 -j REJECT –reject-with tcp-reset
iptables -A INPUT -p udp -i usb0 -j REJECT –reject-with icmp-port-unreachable
iptables -A INPUT -p udp -i eth0:0 -j REJECT –reject-with icmp-port-unreachable
iptables -t nat -A POSTROUTING -o eth0:0 -j SNAT –to-source 192.168.1.2
iptables -t nat -A POSTROUTING -o usb0 -j SNAT –to-source 192.168.42.83
Sending json post via curl
18 Desember 2013
Posted by pada here is example of using curl to send json using method post
curl -X POST -H “Content-Type: application/json” -d ‘{
“fee”: “$3,562.00”,
“id_user”: 0,
“phone”: “(925) 470-3826”,
“pic”: “Felecia Luna”,
“nomor”: “PROP/212/2233”,
“deliverables”: [
“quis”,
“occaecat”,
“magna”,
“labore”,
“quis”,
“culpa”,
“officia”
],
“objective”: [
“reprehenderit”,
“eu”,
“qui”
],
“program”: “Tanpa kotak excepton”,
“kepada”: “Dir. SDM Elsie Wheeler 210 Taylor Street, Clay, Indiana, 6282”,
“perusahaan”: “PT.Comtrek”,
“email”: “felecialuna@comtrek.com”,
“tgl”: “Bandung, 07.03.03”
}’ http://www.vas.web.id/
Syncronizing Database Between Two Server or More
10 Desember 2013
Posted by pada I has searching for syncronizing database between servers. There is a lot of propietary solution, so you can just buy it without worrying anymore. But sometimes for me, just have curiosity to make syncronizing database mysql tools myself. I found a open source mysql database syncronizer its called it maatkit and you can found they documentation to. But, according their website, they make it commercial release of freeware as percona-toolkit.
Backup Restore Mysql database via shell
9 Desember 2013
Posted by pada i found it very simple thinks, in this url
and im running it on my crontab every 2 hours
0 */2 * * * mysql -u
Export mysql one database to a sql file
7 Desember 2013
Posted by pada Here is a a command to export a database in your local server :
sudo mysqldump -u user -pPassword database_name > /result/of/file.sql
Done, Thx
Upload files from local pc to ftp server
7 Desember 2013
Posted by pada Still in Ubuntu 12.04, i try co use curlftpfs connecting to my ftp server using this command in terminal :
curlftpfs user%40sharedhosting:Password@host /mount/point
if you want to mount it as a network drive you can add it to end of /etc/fstab file this line :
curlftpfs#my-ftp-location.local /mnt/my_ftp fuse allow_other,uid=2001,gid=2001,umask=002 0 0
done u can make it with
mount -a
bittorrent sync ubuntu 12.04 instalation
7 Desember 2013
Posted by pada here are step for instalation btsync on ubuntu 12.04 :
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:tuxpoldo/btsync
sudo aptitude update
sudo aptitude install btsync
Adding apache user to ftp group
6 Desember 2013
Posted by pada After installing LAMPP on UBuntu server 12.04 we need to install FTP for uploading the files.
so we are adding apache user, who is running the php for my apps with this command
$sudo useradd -G ftpgroup apache
Enable Remote Access To MySQL Database Server
6 Desember 2013
Posted by pada I have ubuntu 12.04 mysql server and installed phpmyadmin to in that server. When i edit previledge of user to give remote connection to this server by editing host to become %, still cannot connect. so i search the answer of remote mysql to my database server by login via ssh or terminal if u use desktop version, and login to yout root password by command :
mysql -u root -p
so there is show mysql prompt, and select your database. ie. userhost_table
mysql>connect userhost_table
and then you can add this sql command
GRANT ALL PRIVILEGES ON `userhost\_table` . * TO ‘userhost_table’@’localhost’ IDENTIFIED BY ‘passwordnya’;
GRANT ALL PRIVILEGES ON `userhost\_table` . * TO ‘userhost_table’@’localhost.localdomain’ IDENTIFIED BY ‘passwordnya’;
FLUSH PRIVILEGES;
QUIT;
Done, u can connect to mysql server remotely now.