Contoh Konfigurasi rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will “exit 0″ on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/sbin/ifconfig eth0 192.168.0.2 netmask 255.255.255.0
/sbin/ifconfig eth0 up
/sbin/ifconfig vboxnet0 192.168.0.1 netmask 255.255.255.0
/sbin/ifconfig vboxnet0 up

#$$$
#yang 2 ini untuk sharing internet / ics
/sbin/sysctl -w net.ipv4.ip_forward=1
/sbin/iptables –table nat –append POSTROUTING –out-interface ppp0 -j MASQUERADE
#isi DNS dengan DNS google yaitu 8.8.8.8 dan 8.8.4.4
# sharing internet / ics selesai
#$$$

#!!!
#yang 2 ini untuk memforward paket date ke eth0 dan port 3128 punya squid
/sbin/iptables -t nat -A PREROUTING -i vboxnet0 -p tcp -m tcp –dport 80 -j DNAT –to-destination 192.168.0.2:3128
/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 80 -j REDIRECT –to-ports 3128
#memforward paket date ke eth0 dan port 3128 punya squid selesai
#!!!

#untuk melakukan koneksi internet bisa pilih salah satu yang #$$$ atau yang #!!! atau bisa juga kedua-duanya
#yang #$$$ akan melakukan ics dengan IP sharing secara langsung dengan menggunakan dns yang harus disetting di client
#yang #!!! akan melakukan ics dengan melewati proxy squid di server 192.168.0.2 port 3128, dan dns client tidak perlu disetting karna otomatis ikut dns yang telah ditentukan server proxy

/etc/init.d/apache2 start
#/etc/init.d/bind9 start
/etc/init.d/mysql start
/etc/init.d/squid restart
/etc/init.d/dhcp3-server start
#/etc/init.d/avguard restart
#/etc/init.d/avgd restart

exit 0

Advertisement

~ by omlugus on May 8, 2010.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.