Showing posts with label Networking. Show all posts
Showing posts with label Networking. Show all posts
Tuesday, July 20, 2010
Twitter on Blogger!
If you want to embed your Twitter updates in Blogger, you can use this application to create the code and put it in a HTML/JavaScript widget. Click here if you want to see my generated code.
Saturday, May 08, 2010
Web server's DocumentRoot
Actually this is a old problem for me, i can't set Apache or Lighttpd document root's to a mounted FAT filesystem, i got
DocumentRoot must be a directory
After googling for some pages, i found that SELinux cause this. Then disable SELinux by editing /etc/selinux/config file on Fedora 12, set mounted device with Apache's or Lighttpd's UID and GID.
[root@thinkpad /]# cat /etc/passwd | grep lighttpd
lighttpd:x:491:480:lighttpd web server:/var/www/lighttpd:/sbin/nologin
[root@thinkpad /]# mount -t /dev/the_device_name -t vfat -o rw,nosuid,nodev,uid=491,gid=480 /mount_place
Small changes to appropriate server's configuration, and the web server are ready to be my local repository.
DocumentRoot must be a directory
After googling for some pages, i found that SELinux cause this. Then disable SELinux by editing /etc/selinux/config file on Fedora 12, set mounted device with Apache's or Lighttpd's UID and GID.
[root@thinkpad /]# cat /etc/passwd | grep lighttpd
lighttpd:x:491:480:lighttpd web server:/var/www/lighttpd:/sbin/nologin
[root@thinkpad /]# mount -t /dev/the_device_name -t vfat -o rw,nosuid,nodev,uid=491,gid=480 /mount_place
Small changes to appropriate server's configuration, and the web server are ready to be my local repository.
Saturday, April 24, 2010
IM2 Broadband with Motorola V3
This is wvdial configuration script for use on IM2 Broadband and Motorola V3 phone as modem. I am using Fedora 12 with Linux 2.6.32.11, the phone enumerated as USB device and assigned with device name /dev/ttyACM0. NetworkManager lacks capabilities with modem settings such as initialization strings. Don't forget to add extra init string (assigned by Init2 in this example) when using IM2 Broadband.
[Dialer Defaults]
Modem = /dev/ttyACM0
Baud = 9600
Init = ATZ
Init2 = AT+CGDCONT=1,IP,indosatgprs
Phone = *99#
Username = gprs
Password = im3
[Dialer Defaults]
Modem = /dev/ttyACM0
Baud = 9600
Init = ATZ
Init2 = AT+CGDCONT=1,IP,indosatgprs
Phone = *99#
Username = gprs
Password = im3
Thursday, April 22, 2010
RPM Fusion repository
Sorry for being vacum, okay i want to write a bash script that i used for mirroring RPM Fusion repository, for you who aren't familiar with RPM Fusion, here a descriptions
This clear right?, i need to mirroring RPM Fusion repository. The bad news is they not provide a mechanism for mirroring their repository in this case by serving rsync. We have GNU Wget, it is a powerful network utility from the GNU Project. I won't tell you what Wget offers here, so many ;p. And here the script i used to mirroring RPM Fusion's repository.
http://pastebin.com/raw.php?i=QWtnumMn
RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and Red Hat Enterprise Linux 5; you can use the RPM Fusion repositories with tools like yum and PackageKit.
RPM Fusion is a merger of Dribble, Freshrpms, and Livna; our goal is to simplify end-user experience by grouping as much add-on software as possible in a single location. Also see our FoundingPrinciples.
This clear right?, i need to mirroring RPM Fusion repository. The bad news is they not provide a mechanism for mirroring their repository in this case by serving rsync. We have GNU Wget, it is a powerful network utility from the GNU Project. I won't tell you what Wget offers here, so many ;p. And here the script i used to mirroring RPM Fusion's repository.
http://pastebin.com/raw.php?i=QWtnumMn
Monday, April 05, 2010
Fedora 12: mirroring scripts
This is a script i used for mirroring Fedora 12 packages and updates, see previous post for Using Rsync. This script using flock program for synchronization mechanism. It was written by a Linux's Kernel hacker H. Peter Anvin. He was also famous as syslinux writer and maintainer.
http://pastebin.com/raw.php?i=7qsARenC
http://pastebin.com/raw.php?i=7qsARenC
Friday, April 02, 2010
Kernel IP Routing
Today i use a old-school IBM Thinkpad T30 with Slax, this laptop has several connection devices such as irda, ethernet and a wireless ethernet adapter. After assign an IP address, gateway and nameservers for wireless adapter (wlan0) then connecting to my access point it seem the default routing was altered. So i do it manually with this routing command
slax@root:~# route add default gw 172.16.1.118 dev wlan0
Now look at routing table output
http://pastebin.com/raw.php?i=pceQuWjc
slax@root:~# route add default gw 172.16.1.118 dev wlan0
Now look at routing table output
http://pastebin.com/raw.php?i=pceQuWjc
Thursday, November 05, 2009
Sierra's AirCard 875U Modem
This is wvdial.conf configuration with Sierra's AirCard 875U USB Modem, it works on Debian Lenny (kernel-2.6.26)
[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 9600
Init = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Phone = *99#
Username = www.xlgprs.net
Password = proxl
New PPPD = yes
lsusb output:
Bus 004 Device 002: ID 1199:6812 Sierra Wireless, Inc. MC8775 Device
Thursday, October 15, 2009
Routing
This is a basic routing command, we want to add 192.168.128.0 network with gateway 172.16.1.34, when a client from network 192.168.128.0 request, they will route to 172.16.1.34
route add -net 192.168.128.0 netmask 255.255.240.0 gw 172.16.1.34
route add -net 192.168.128.0 netmask 255.255.240.0 gw 172.16.1.34
Friday, September 25, 2009
iptables
iptables is a administration tool for IPv4 packet filtering and NAT, it's mainly in UNIX like operating system including, of course Linux. Here my iptables commands collection based on my own purposes:
- List applied filters
#iptables -L
- Blocking specific IP address
#iptables -I INPUT -s <address> -j DROP
- Unblocking specific IP address
#iptables -D INPUT -s <address> -j DROP
- List applied filters
#iptables -L
- Blocking specific IP address
#iptables -I INPUT -s <address> -j DROP
- Unblocking specific IP address
#iptables -D INPUT -s <address> -j DROP
Sunday, March 29, 2009
Socket Programming: Dynamic sized data
I have been posted on linux-c-programming@vger.kernel.org regarding receiving dynamic size data using TCP/IP socket, and now resolved:
struct foo {
char *name;
unsigned int id;
};
int ret, len;
struct foo *bar = malloc (sizeof(struct foo));
/* fill bar */
len = strlen (name);
send (s, &len, sizeof(len), 0);
send (s, bar->name, len, 0);
send (s, &bar->id, sizeof(bar->id), 0);
And for the receiver:
recv (s, &len, sizeof(len), 0);
/* allocate bar->name for len bytes */
recv (s, bar->name, len, 0);
Notice there are no error checking and network byte ordering here.
struct foo {
char *name;
unsigned int id;
};
int ret, len;
struct foo *bar = malloc (sizeof(struct foo));
/* fill bar */
len = strlen (name);
send (s, &len, sizeof(len), 0);
send (s, bar->name, len, 0);
send (s, &bar->id, sizeof(bar->id), 0);
And for the receiver:
recv (s, &len, sizeof(len), 0);
/* allocate bar->name for len bytes */
recv (s, bar->name, len, 0);
Notice there are no error checking and network byte ordering here.
pfSense: Load balance + squid
Di kamar, dua koneksi: ADSL dan WAN ingin disatukan. Load balance dengan pfSense, karena squid tidak bekerja untuk load balance di pfSense, kemudian buat box Linux. Router (pfSense) yang saya konfigurasi untuk tidak melayani semua koneksi LAN kecuali box Linux dengan squid (10.0.0.1/8)
10.0.0.1/8 --> ALL PROTO --> DMZ share
192.168.100.1/24 --> TCP --> WAN (ADSL)
172.16.10.1/16 --> TCP --> OPT1 (WAN)
Sekarang hanya squid yang bisa mengakses (gateway) langsung router, hanya untuk mengingat-ingat lagi waktu di ISP dulu ;).
pfSense
Squid
Saturday, March 28, 2009
Squid Cache: Filtering
Kernel & Firewall:
#echo 1 > /proc/sys/net/ipv4/ip_forward
#/sbin/iptables -t nat -A POSTROUTING -s [network]/[subnet] -o [interface] -j MASQUERADE
#/sbin/iptables -t nat -A PREROUTING -p tcp -s [network]/[subnet] --dport [http_port] -j REDIRECT --to-ports [squid_port]
squid.conf:
http_port [squid_port] transparent
acl allowed_client src "/path/to/allowed_client"
acl blocked_url url_regex "/path/to/blocked_url"
acl blocked_file url_regex -i "/path/to/blocked_file"
http_access deny !allowed_client
http_access deny blocked_url
http_access deny blocked_file
http_access allow allowed_client
Squid's log rotate with crontab:
0 0 1 * * /path/to/squid -k rotate
this will rotate squid's log for 1 month interval.
Reconfigure Squid
#/patch/to/squid -k reconfigure
Happy caching...
Squid
Saturday, February 21, 2009
GNet: GLib base network library
GNet adalah library network yang ditulis dengan C berbasis GLib, fitur-fitur GNet adalah sebagai berikut:
- TCP "client" and "server" sockets
- UDP and IP Multicast sockets
- High-level TCP connection and server objects
- Asynchronous socket IO
- Internet address abstraction
- Asynchronous DNS lookup
- IPv4 and IPv6 support
- Byte packing and unpacking
- URI parsing
- SHA and MD5 hashes
- Base64 encoding and decoding
- SOCKS support
GNet telah di porting ke banyak sistem: Linux, BSD, Solaris, HP dan Windows. Dengan lisensi LGPL.
Pertama kali memakai library ini ketika mengakses data kamera IP untuk proyek Jagorawi. Vendor kamera ini memakai Microsoft ActiveX untuk streaming melalui browser, tentu saja dengan Internet Explorer atau browser lain yang mempunyai dukungan ActiveX. Karena ActiveX ini produk Microsoft, tidak ada cara untuk menjalankan aplikasi embedded browser di Linux (saya tahu dengan Wine). Untungnya kamera ini mempunyai aplikasi server side CGI agar request bisa dilakukan sebagai perintah, misalnya untuk mengambil gambar dan kontrol-kontrol kamera lainnya. Cara streaming disini dengan mengambil gambar per-interval waktu dengan http library GNet. Bukankah ini adalah prinsip streaming? ;p.
- TCP "client" and "server" sockets
- UDP and IP Multicast sockets
- High-level TCP connection and server objects
- Asynchronous socket IO
- Internet address abstraction
- Asynchronous DNS lookup
- IPv4 and IPv6 support
- Byte packing and unpacking
- URI parsing
- SHA and MD5 hashes
- Base64 encoding and decoding
- SOCKS support
GNet telah di porting ke banyak sistem: Linux, BSD, Solaris, HP dan Windows. Dengan lisensi LGPL.
Pertama kali memakai library ini ketika mengakses data kamera IP untuk proyek Jagorawi. Vendor kamera ini memakai Microsoft ActiveX untuk streaming melalui browser, tentu saja dengan Internet Explorer atau browser lain yang mempunyai dukungan ActiveX. Karena ActiveX ini produk Microsoft, tidak ada cara untuk menjalankan aplikasi embedded browser di Linux (saya tahu dengan Wine). Untungnya kamera ini mempunyai aplikasi server side CGI agar request bisa dilakukan sebagai perintah, misalnya untuk mengambil gambar dan kontrol-kontrol kamera lainnya. Cara streaming disini dengan mengambil gambar per-interval waktu dengan http library GNet. Bukankah ini adalah prinsip streaming? ;p.
Thursday, January 15, 2009
Debian Networking
Konfigurasi network debian, konfigurasi ini seharusnya bisa diterapkan juga untuk distro-distro turunan. File konfigurasi ethernet debian berada di /etc/interface/network dengan format seperti berikut:
auto eth0Script untuk kontrol interface berada di /etc/init.d/network, file ini sama saja dengan file-file .rc lainnya (System V).
iface eth0 inet static
address 10.0.0.10
netmask 255.0.0.0
network 10.0.0.0
broadcast 10.255.255.255
gateway 10.0.0.20
Subscribe to:
Posts (Atom)