Ruter Debian 5


1) pico  /etc/network/interfaces
                   # The primary network interface
                  allow-hotplug eth0
                  iface eth0 inet static
                  address 192.168.1.1
                  netmask 255.255.255.192
                  network 192.168.1.0
                  broadcast 192.168.1.63
                  gateway 192.168.1.62
                  # dns-* options are implemented by the resolvconf package, if installed
                  dns-nameservers 192.168.1.62
                  dns-search situstkj.co.cc
# The secondary network interface
auto eth1
iface eth1 inet static
address                   172.16.1.62
netmask                   255.255.255.192
network                   72.16.1.0
broadcast                172.16.1.63

2) /etc/init.d/networking  restart

3) pico /etc/sysctl.conf

                  # Uncomment the next line to enable packet forwarding for IPv4
                  net.ipv4.ip_forward=1

4) iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
5) iptables -t nat -n –L

                 Chain PREROUTING (policy ACCEPT)
                 target prot opt source destination


                 Chain POSTROUTING (policy ACCEPT)
                 target prot opt source destination
                 MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0

 
                 Chain OUTPUT (policy ACCEPT)
                 target prot opt source destination


6) iptables-save  >  /etc/network/iptables.conf
7) echo "iptables-restore  <  /etc/network/iptables.conf"  >>  /etc/network/if-up.d/iptables"
8) pico /etc/network/if-up.d/iptables
#!/bin/sh
iptables-restore < /etc/network/iptables.conf
9) chmod  +x  /etc/network/if-up.d/iptables
10) reboot
11) ifconfig | less
                 eth0 Link encap:Ethernet HWaddr 00:0c:29:32:97:44
                 inet addr:192.168.1.1 Bcast:192.168.1.63 Mask:255.255.255.192
                 inet6 addr: fe80::20c:29ff:fe32:9744/64 Scope:Link
                 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
                 RX packets:5 errors:0 dropped:0 overruns:0 frame:0
                 TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
                 collisions:0 txqueuelen:1000
                 RX bytes:400 (400.0 B) TX bytes:3660 (3.5 KiB)
                 Interrupt:19 Base address:0x2000

                 eth1 Link encap:Ethernet HWaddr 00:0c:29:32:97:4e
                 inet addr:172.16.1.62 Bcast:172.16.1.63 Mask:255.255.255.192
                 inet6 addr: fe80::20c:29ff:fe32:974e/64 Scope:Link
                 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
                 RX packets:148 errors:0 dropped:0 overruns:0 frame:0
                 TX packets:100 errors:0 dropped:0 overruns:0 carrier:0
                 collisions:0 txqueuelen:1000
                 RX bytes:12617 (12.3 KiB) TX bytes:9610 (9.3 KiB)
                 Interrupt:16 Base address:0x2080

                 lo Link encap:Local Loopback
                 inet addr:127.0.0.1 Mask:255.0.0.0
                 inet6 addr: ::1/128 Scope:Host

12) iptables -t nat -n –L

                 Chain PREROUTING (policy ACCEPT)
                 target prot opt source destination
                 Chain POSTROUTING (policy ACCEPT)
                 target prot opt source destination
                 MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
                 Chain OUTPUT (policy ACCEPT)
                 target prot opt source destination
(Jika terdapat kata Masquerade all berarti konfigurasi Anda Sudah Berhasil)
13) Kita check koneksinya. Pada windows ubah Settingan TCP/IP Menjadi Seperti ini:
                 IP Address                   : 172.16.1.2
                 Subnet Mask                : 255.255.255.192
                 Default Gateway           : 172.16.1.62
                 Preferred DNS Server  : 172.16.1.62

14) Setelah settingan diubah, Bukalah Command Prompt computer client dan cek koneksi ke server.
C:\Users\antoro>ping 172.16.1.62
Pinging 172.16.1.62 with 32 bytes of data:
Reply from 172.16.1.62: bytes=32 time<1ms TTL=64
Reply from 172.16.1.62: bytes=32 time<1ms TTL=64
Reply from 172.16.1.62: bytes=32 time<1ms TTL=64
Reply from 172.16.1.62: bytes=32 time=1ms TTL=64
Ping statistics for 172.16.1.62:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms


C:\Users\antoro>ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=1ms TTL=64
Reply from 192.168.1.1: bytes=32 time<1ms TTL=64
Reply from 192.168.1.1: bytes=32 time<1ms TTL=64
Reply from 192.168.1.1: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
 

15) Jika Reply, Maka konfurasi router anda bisa dikatakan berhasil.

Proxy Server Debian 5


1) apt-get install squid
2) rm /etc/squid/squid.conf
3) pico /etc/squid/squid.conf
         acl all src all
         acl localnet src 200.110.10.0/24
         acl situs url_regex -i "/etc/squid/blokir.txt"
         http_access deny situs
         http_access allow localnet
         http_access allow all
         http_port 3128 transparent
         cache_mem 8 mb
         memory_replacement_policy heap GDSF
         cache_replacement_policy heap LFUDA
         store_dir_select_algorithm round-robin
         cache_dir aufs /cache 10000 24 256
         cache_store_log none
         cache_access_log /var/log/squid/access.log
         cache_effective_user proxy
         cache_effective_group proxy
         visible_hostname febry.com
3) pico /etc/squid/blokir.txt
    
     www.google.co.id

4) mkdir /cache
5) chown –R proxy:proxy /etc/squid/blokir.txt
6) chown –R proxy:proxy /cache
7) /etc/init.d/squid stop
8) squid –z
      2010/10/16 19:43:30| Creating Swap Directories

9) /etc/init.d/squid start
10) pico /etc/rc.local

        iptables -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 3128

11) /etc/init.d/squid restart