Lika-Liku Laboratorium Internet

November 19th, 2008 admin

Laboratourium internet, mendengar kata tersebut apa yang ada di benak anda ? Laboratorium yang membuat internet ? Tentu bukan, Laboratorium Internet (disingkat labnet) merupakan fasilitas yang diberikan oleh Fakultas DIII Ilmu Komputer Universitas Padjadjaran. Fungsi dari labnet sendiri cukup sederhana, yaitu melayani mahasiswa untuk browsing di dunia maya. Lalu bagaimanakah labnet bisa berjalan dengan semestinya ? Selain dibudidayakan oleh kampus baik kepala lab maupun asisten, labnet sendiri sangat bergantung dengan jaringan internet yang ada di Fakultas. Itulah yang akan kita bahas, bagaimana sistem yang ada di labnet hingga mampu mengakses internet secara massal ?

Local Area Network (LAN)
Laboratorium internet menggunakan konsep LAN ( Local Area Network ), LAN sendiri memiliki arti jaringan komputer lokal yang dimiliki oleh suatu insitusi dimana perangkat jaringan yang saling terhubung di dalam suatu gedung. Labnet sendiri memiliki 10 PC yang dijadikan Cient untuk mengakses internet dan satu buah PC dijadikan Router.
Internet di labnet sendiri, menggunakan provider dari jalawave menginduk dari DCISTEM UNPAD ( Dipatiukur 35) dengan alamat ip 202.51.232.114. Di Unpad sendiri, internet-nya di bagi-bagi ke berbagai tempat, baik Jatinangor maupun Dago. Saat ini, LAN di UNPAD memakai ip kelas A, yaitu 10.X.X.X. Untuk DIII Ilmu Komputer, mengacu pada router yang memiliki ip 10.2.49.1.
Bagi yang masih awam, pasti akan sedikit bingung mengapa dengan 1 ip dari jalawave (202.51.232.114) seluruh gedung UNPAD dapat mengakses internet termasuk Laboratorium Internet itu sendiri. Dengan kata lain, intenet tersebut dibagi-bagi alias Internet Sharing yang memanfaatkan kinerja dari NAT ( Network Address Translation ) dalam bahasa indonesia penerjemahan alamat ip. Dalam kasus seperti ini, dimana internet mampu dishare kita membutuhkan suatu perantar yaitu Router. Router sendiri berfungsi untuk meneruskan paket / data ke alamt tujuan, baik dari LAN maupun internet itu sendiri. Untuk jelasnya bisa ilustrasi berikut :

Gambar 1

NAT ( Network Adress Translation )
Network Address Translation atau yang biasa disebut dengan NAT adalah suatu metode untuk menghubungkan lebih dari satu komputer ke jaringan internet dengan menggunakan satu alamat IP. Banyaknya penggunaan metode ini disebabkan karena ketersediaan alamat IP yang terbatas, kebutuhan akan keamanan (security), dan kemudahan serta fleksibilitas dalam administrasi jaringan. Dengan NAT, suatu jaringan yang besar dapat dipecah-pecah menjadi jaringan yang lebih kecil. Bagian-bagian kecil tersebut masing-masing memiliki satu alamat IP, sehingga dapat menambahkan atau mengurangi jumlah komputer tanpa mempengaruhi jaringan secara keseluruhan (http://id.wikipedia.org/).
Dari teori dan gambar diatas, kita dapat menduga kalau labnet menggunakan pemanfaatan dari NAT tersebut. Faktanya adalah router fakultas hanya membaca ip labnet secara tunggal yaitu 10.2.49.16, padahal client labnet mencari alamat gateway dengan ip 192.168.11.20 (Kita asumsikan ip client satu kelas misal 192.168.11.1). Dari situ kita bisa, menilai bahwa dengan satu alamat ip, bisa dipakai secara bersamaan. Sedikit agak curang memang, seperti ingat kata pepatah maksud hati membelah gunung apadaya tangan tak terlampaui. Dalam pelaksanaannya, labnet sendiri menggunakan router berbasis redhat 9 yang telah mendukung utiliti iptables yang mampu mengimplementasikan NAT dan Filtering ( firewall ).

Iptables (Netfilter)
Iptables merupakan salah satu utiliti yang mampu melakukan NAT dan Filtering (firewall), diamana didalam penggunaanya mempunya aturan tertentu. Iptables sendiri hanya bekerja pada protokol TCP/IP. Router labnet sendiri menggunakan konsep NAT yaitu ONE to MANY, dan mempunya firewall yang hanya membuka port 21,80, dan 3128. Dalam penggunanya, iptables mampu bekerja dengan baik pada Sistem Operasi Linux yang memiliki kernel 2.4 contohnya adalah redhat 9. Untuk membuat agar ip 192.168.11.20 mampu diterjemahkan menjadi alamat 10.2.49.16 berikut aturan yang dibuat :
Iptables -t nat -A POSTROUTING -i eth1 -s 192.168.11.0/24 -j SNAT –to-s 10.2.49.16
Untuk penjelesannya yaitu:
1.-t, artinya kita menggunakan table yaitu NAT.
2.-A, artinya kita menambahkan aturan baru.
3.POSTROUTING, merupakan sebuah chain yang artinya setelah di-routing.
4.-i, interface yang dipakai yakni eth1 (ethernet 1).
5.-s, sumber ip diluar router yang akan ditranslasikan yakni client labnet dengan kelas C yang artinya semua ip yang tergabung pada network id 192.168.11.0/24 akan diterjemahkan menjadi 10.2.49.16.
6.-j, jump artinya target yang dipakai yaitu SNAT.
7.-to-s, diterjemahkan ke ip 10.2.49.16.
Sedangkan untuk firewall itu sendiri, dengan mengkombinasikan iptables dengan table filter. Berikut aturan yang dibuat :
iptables -P INPUT DROP
iptables -A INPUT -d 10.2.49.16 -m state –state ESTABLISHED,NEW -j ACCEPT
iptables -A INPUT -d 10.2.49.16 -m multiport -p tcp –dport 21,80,3128 -j ACCEPT.
Untuk penjelasannya yaitu :
1.-P, policy adalah atruran default dari chain INPUT yang men-DROP semua paket yang masuk.
2.-A, menambahkan aturan baru pada chain INPUT.
3.-d, destination atau tujuan alamat ip yang akan di-filter.
4.-m, macthes mencocokan paket dengan alamat ip dan port yang sudah ditentukan ( ESTABLISHED ) dan menciptakan koneksinya ( NEW ).
Aturan tersebut merupakan contoh kecil dalam pemanfaatan iptables, walaupu dalam penggunaannya tidak sesederhana itu, ini hanya contoh ketika menganalisa sistem yang ada.

Proxy Server
Ada beberapa kalimat yang menjelaskan apa sebenarnya proxy server itu. Proxy server adalah sebuah komputer server atau program komputer yang dapat bertindak sebagai komputer lainya untuk melakukan request terhadap content dari internet dan intranet (http://id.wikipedia.org/)
Mengapa menggunakan proxy? Ini dikarenakan fungsi proxy itu sendiri yang sangat bermanfaat.
Fungsi utama proxy yang umum ada, 3 (tiga) yaitu Web cache, Paket filtering dan Manajemen bandwith. Labnet sendiri kini hanya memakai 2 (dua) dari 3(tiga) fungsi utama tersebut yaitu Web cache dan Filtering.
a) Web Cache
Web cache merupakan suatu cara untuk menyimapan objek-objek internet baik yang melalui HTTP maupun FTP. Dengan kata lain, jika sebuah client meminta sebuah objek dia tidak harus mendapatkan layanan dari web server pusat tetapi akan dilayani oleh proxy server yang sebelumnya telah menyimpan objek tersebut. Pemanfaatan cara tersebu dapat menghemat bandwith dan mengurangi waktu dalam mengakses internet. Dalam pelaksanaanya, client tersebut tidak sadar bahwa objek yang dikirim berasal dari web server atao proxy server. Untuk lebih jelasnya kita dapat melihat ilustrasi berikut :

Gambar 2

b) Packet Filtering
Paket filtering merupakan sebuah usaha pengamanan atau pembatasan sehingga dengan adanya filtering sebuah proxy server dapat mengamankan dan membatasi hak akses client pada jaringan privat. Dalam penggunaanya, paket filtering sering digunakan untuk meblokir situs-situs tertentu. Hal tersebut dapat dilakukan dengan menambahkan daftat situs hitam pada tag ACL (Access Conenction List), yakni dengan cara :
acl hitam url dstdomain “/etc/squid/hitam.txt”
httpd deny hitam
Untuk penjelasanya yaitu :
1.acl hitam, merupakan pembuatan objek acl dengan nama hitam.
2.Url dstdomain, merupakan url yang dituju nantinya dicocokan dengan file hitam.txt yang berada di /etc/squid
Dalam hal ini proxy ( aplikasinya squid di linux ),menandai paket apa saja yang tidak boleh keluar jika terdapat dalam daftar file hitam.txt maka paker tersebut bakal dimusnahkan. Daftar file tersebut dapat berupa alamat situs terlarang, misal : www.17tahun.com.
Dari bahasan diatas, kita dapat mengambil kesimpulan bahwa dalam menciptakan sebuah jaringan internet tidaklah sulit dan tidaklah mudah. Intinya adalah kita dapat mengenal baik bagaimana situasi dan kondisi jaringan tersebut, mengingat labnet masih dibawah instansi pendidikan Universitas Padjadjaran. Lain halnya jika jaringan tersebut untuk kepentingan komersil, tidak harus aman tetapi dapat menghasilkan keuntungan yang baik dengan batas-batas nilai moral yang ada. (betsu)

referensi :
http://id.wikipedia.org/
http://www.linuxhomenetworking.com
O’Really Linux Network Admin Guide 2nd Edition
O’Really TCP-IP Administration

Bonding With Redhat 9

August 19th, 2008 admin

Bonding merupakan suatu metode untuk menggabungkan bebrapa interface jaringan menjadi satu kesatuan. Dalam hal ini bonding memiliki berbagai opsi :

Round Robin (mode=0 atau balance=rr)

Mengirimkan paket secara berurutan dari interface jaringan pertama sampai terakhir.

Active Backup (mode=1 atau active-backup)

Hanya satu interface jaringan saja yang aktif dan interface jaringan akan aktif jika interface jaringan seblumnya yang aktif menjadi non aktif.

Balance XOR (mode=2 atau balance-xor)

Mengirimkan paket berdasarkan metode alamat MAC asal XOR alamat MAC tujuan.

Broadcast (mode=3 atau broadcast)

Mengirimkan paket ke semua interface jaringan.

IEEE Dynamic Link (mode=4 atau 802.3ad)

Merupakan gabungn dari beberapa kelompok yang saling berbagi kecepatan dan konfigurasi duplex yang sama berdasarkan spesifikasi 802.3ad.

Adiptive Transmit (mode=5 atau balance-tlb)

Tidak membutuhkan dukunagn switch karena jalur keluar disebar berdasarkan pada beban pada setipa jaringan.

Adiptive (mode=6 atau balance-alb)

Merupakan balance tlb namun ditambah dengan received load balancing (rlb) untuk jalur ipv4.

Konfigurasi Manual

Langkahnya cukup mudah tinggal, misalkan terdapat dua buah interface jaringan yang ingin dipasangkan dalam modul bonding. Langkahnya sebagai berikut :

1. Buat interface untuk bonfing denagn membuat file ifcfg-bond0 pada /etc/sysconfig/network-scripts/ denagn isi sebagai berikut :

BOOTPROTO=static

DEVICE=bond0

NETMASK=255.255.255.0

IPADDR=192.168.11.20

NETWORK=192.168.11.0

BROADCAST=192.168.11.255

ONBOOT=yes

TYPE=Ethernet

USERCTL=yes

2. Lalu pada interface jaringan eth0 (ifcfg-eth0) dan eth1 (ifcfg-eth1) kita isikan seperti berikut :

BOOTPROTO=static

DEVICE=eth0 “atau eth1 sesuai device”

NETMASK=””

IPADDR=””

NETWORK=””

BROADCAST=””

ONBOOT=yes

TYPE=Ethernet

USERCTL=yes

MASTER=bond0

SLAVE=yes

3. Setelah itu kita aktifkan modul bondingnya dengan edit file di /etc/module.conf lalu isikan alias bond0 bonding dan pada /etc/rc.d/rc.local tambahkan baris berikut :

/sbin/rmod bonding

/sbin/modprobe bonding max_bonds=2 miimon=100 mode=6

4. Lalu restart networknya service network restart, jika sukses maka pada /proc/net/bonding akan terdapat file bond0 dan ketika dipanggil dengan perintah ifconfig akan menampilkan interface bond0.

Mudah khan……

Membuat Firewall dengan iptables

July 17th, 2008 admin

Iptables sangat familiar bagi yang sering share internet dengan linux, kenapa menggunakkan iptables ? tentunya karena lebih mudah dan sederhana. Iptables itu bisa menjadi firewall karena salah satu kemmpuannya untuk menyaring paket (Netfilter), atau secera kerennya kita menggunakkan tables filter.

Oh ya, iptables itu memiliki tiga tables yaitu filter untuk menyaring paket, nat untuk mentranslasikan alamat dan mangle untuk menghaluskan packet.

Secara gambar (netfilter) bisa dilihat :

Dalam gambar diatas terdapat ellipse “ keputusan routing “, disini paket harus diberi keputusan apakah akan disaring terlebih dahulu oleh router (input) atau langsung dilewatkan begitu saja melewati router (forward). Biasanya jika router ini berisi file yang penting maka Input chain akan diisikan oleh aturan, contoh :

Iptables –A INPUT –d 10.1.1.1 –p tcp –dport 22 –j REJECT, artinya semua paket yang menuju ip 10.1.1.1 dengan port 22 (ssh) ditolak. Untuk lebih jelasnya bisa lihat manual iptables di linux anda.

Saya mengutip dati ebooknya O Reilly untuk melihat indexnya.

There are a number of ways we can manipulate rules and rulesets with the iptables command. Those relevant to IP firewalling are:

-A chain

Append one or more rules to the end of the nominated chain.

If a hostname is supplied as either a source or destination and it resolves to more than one IP address, a rule will be added for each address.

-I chain rulenum

Insert one or more rules to the start of the nominated chain. Again, if a hostname is supplied in the rule specification, a rule will be added for each of the addresses to which it resolves.

-D chain

Delete one or more rules from the specified chain matching the rule specification.

-D chain rulenum

Delete the rule residing at position rulenum in the specified chain. Rule positions start at 1 for the first rule in the chain.

-R chain rulenum

Replace the rule residing at position rulenum in the specific chain with the supplied rule specification.

-C chain

Check the datagram described by the rule specification against the specific chain. This command will return a message describing how the chain processed the datagram. This is very useful for testing your firewall configuration and we will look at it in detail later.

-L [chain]

List the rules of the specified chain, or for all chains if no chain is specified.

-F [chain]

Flush the rules of the specified chain, or for all chains if no chain is specified.

-Z [chain]

Zero the datagram and byte counters for all rules of the specified chain, or for all chains if no chain is specified.

-N chain

Create a new chain with the specified name. A chain of the same name must not already exist. This is how user-defined chains are created.

-X [chain]

Delete the specified user-defined chain, or all user-defined chains if no chain is specified. For this command to be successful, there must be no references to the specified chain from any other rules chain.

-P chain policy

Set the default policy of the specified chain to the specified policy. Valid firewalling policies are ACCEPT, DROP,QUEUE, and RETURN. ACCEPT allows the datagram to pass. DROP causes the datagram to be discarded. QUEUE causes the datagram to be passed to userspace for further processing. The RETURN target causes the IP firewall

code to return to the Firewall Chain that called the one containing this rule, and continue starting at the rule after the calling rule.

Rule specification parameters

There are a number of iptables parameters that constitute a rule specification. Wherever a rule specification is required, each of these parameters must be supplied or their default will be assumed.

-p [!]protocol

Specifies the protocol of the datagram that will match this rule. Valid protocol names are tcp, udp, icmp, or a number, if you know the IP protocol number.[6] For example, you might use 4 to match the ip ip encapsulation protocol. If the ! character is supplied, the rule is negated and the datagram will match any protocol other than the

specified protocol. If this parameter isn’t supplied, it will default to match all protocols.

[6] Take a look at /etc/protocols for protocol names and numbers.

-s [!]address[/mask]

Specifies the source address of the datagram that will match this rule. The address may be supplied as a hostname, a network name, or an IP address. The optional mask is the netmask to use and may be supplied either in the traditional form (e.g., /255.255.255.0) or in the modern form (e.g., /24).

-d [!]address[/mask]

Specifies the destination address and port of the datagram that will match this rule. The coding of this parameter is the same as that of the -s parameter.

-j target

Specifies what action to take when this rule matches. You can think of this parameter as meaning “jump to.” Valid targets are ACCEPT, DROP, QUEUE, and RETURN. We described the meanings of each of these previously in the “Commands” section. You may also specify the name of a user-defined chain where processing will continue. You may also supply the name of a target supplied by an extension. We’ll talk about extensions shortly. If this parameter is omitted, no action is taken on matching datagrams at all, other than to update the datagram and byte counters of this rule.

-i [!]interface-name

Specifies the interface on which the datagram was received. Again, the ! inverts the result of the match. If the interface name ends with “+” then any interface that begins with the supplied string will match. For example, -I ppp+ would match any PPP network device and -i ! eth+ would match all interfaces except ethernet devices.

-o [!]interface-name

Specifies the interface on which the datagram is to be transmitted. This argument has the same coding as the –I argument.

[!] -f

Specifies that this rule applies only to the second and later fragments of a fragmented datagram, not to the first fragment.

Options

The following iptables options are more general in nature. Some of them control rather esoteric features of the netfilter software.

-v

causes iptables to be verbose in its output; it will supply more information.

-n

causes iptables to display IP address and ports as numbers without attempting to resolve them to their corresponding names.

-x

causes any numbers in the iptables output to be expanded to their exact values with no rounding.

- -line-numbers

causes line numbers to be displayed when listing rulesets. The line number will correspond to the rule’s position within the chain.

Extensions

We said earlier that the iptables utility is extensible through optional shared library modules. There are some standard extensions that provide some of the features ipchains provided. To make use of an extension, you must specify its name through the -m name argument to iptables. The following list shows the -m and -p options that set up the extension’s context, and the options provided by that extension.

TCP Extensions: used with -m tcp -p tcp

- -sport [!] [port[:port]]

Specifies the port that the datagram source must be using to match this rule. Ports may be specified as a range by specifying the upper and lower limits of the range using the colon as a delimiter. For example, 20:25 described all of the ports numbered 20 up to and including 25. Again, the ! character may be used to negate the values.

- -dport [!] [port[:port]]

Specifies the port that the datagram destination must be using to match this rule. The argument is coded identically to the - -sport option.

- -tcp-flags [!] mask comp

Specifies that this rule should match when the TCP flags in the datagram match those specified by mask and comp. mask is a comma-separated list of flags that should be examined when making the test. comp is a comma-separated list of flags that must be set for the rule to match. Valid flags are: SYN, ACK, FIN, RST, URG, PSH, ALL or NONE.

This is an advanced option: refer to a good description of the TCP protocol, such as RFC-793, for a description of the meaning and implication of each of these flags. The ! character negates the rule.

[!] - -syn

Specifies the rule to match only datagrams with the SYN bit set and the ACK and FIN bits cleared. Datagrams with these options are used to open TCP connections, and this option can therefore be used to manage connection requests. This option is shorthand for:

- -tcp-flags SYN,RST,ACK SYN

When you use the negation operator, the rule will match all datagrams that do not have both the SYN and ACK bitsset.

UDP Extensions: used with -m udp -p udp

- -sport [!] [port[:port]]

Specifies the port that the datagram source must be using to match this rule. Ports may be specified as a range by specifying the upper and lower limits of the range using the colon as a delimiter. For example, 20:25 describes all of the ports numbered 20 up to and including 25. Again, the ! character may be used to negate the values.

- -dport [!] [port[:port]]

Specifies the port that the datagram destination must be using to match this rule. The argument is coded identically to the - -sport option.

ICMP Extensions: used with -m icmp -p icmp

- -icmp-type [!] typename

Specifies the ICMP message type that this rule will match. The type may be specified by number or name. Some valid names are: echo-request, echo-reply, source-quench, time-exceeded,destination-unreachable, network-unreachable, host-unreachable, protocol-unreachable, and port-unreachable.

MAC Extensions: used with -m mac

- -mac-source [!] address

Specifies the host’s Ethernet address that transmitted the datagram that this rule will match. This only makes sense in a rule in the input or forward chains because we will be transmitting any datagram that passes the output chain.

Nah, dari situ kita bisa sedikit ber-eksperiment.

Contoh, jika ip kita tidak bisa di ping :

iptables -A INPUT -d 10.1.1.1 -p icmp -j REJECT.

Maka ketika di ping, akan dilaporkan bahwa port unreacheable !. Mudah khan….