Minggu, 06 Juni 2010

AGLET

Mobile Agent


Mobile agent ialah agen yang mempunyai kemampuan berpindah-pindah dalam jaringan (contohnya pada jaringan World Wide Web), berinteraksi dengan host-host asing, mengumpulkan informasi berdasarkan pengguna, dan mengembalikannya ke pengirim setelah melakukan tugasnya. Mobile agent ini diimplementasikan oleh remote program. Hal-hal yang berkenaan dengan pemrograman remote juga dapat diterapkan pada mobile agent seperti :
• Penamaan Program – memberikan nama kepada agen untuk membedakannya dengan agen yang lain.
• Autentifikasi program – autentifikasi implementor dari program agen.
• Migrasi Program – memindahkan program dari satu mesin ke mesin lainnya.
• Keamanan Program – memastikan program tidak merusak mesin pengeksekusinya.
Salah satu contoh mobile agent ialah agen monitoring data stok dan penjualan yaitu agen yang secara mandiri bertugas untuk memonitor perubahan data, melaporkan kepada pengirimnya jika terjadi perubahan data pada basis data yang dimonitor. Agen monitoring sangat berguna bagi sistem yang mengalami perubahan secara dinamis, dimana perubahan data tersebut mempunyai pengaruh yang besar pada sistem secara keseluruhan. Dalam implementasinya agen jenis ini dapat menggunakan protokol HTTP (Hypertext Transfer Protocol) maupun ATP (Aglets Transfer Protocol) untuk mengakses informasi di dalam basis data yang terhubung dalam jaringan web. Sedangkan untuk mengakses ke basis data dapat digunakan KQML atau bahasa komunikasi agen lainnya untuk komunikasi antar agen.



III.1. Keuntungan Mobile Agent
Dibandingkan dengan teknologi agen statis, mobile agent mempunyai beberapa keuntungan yaitu :
- Mengurangi Beban Jaringan.
Pada sistem yang terdistribusi komunikasi antar bagian sistem sangat tergantung pada protokol komunikasi yang melibatkan banyak interaksi untuk menyelesaikan tugas yang diberikan. Hal ini menyebabkan, trafic jaringan tinggi. Dengan mobile agent dapat dimungkinkan untuk mengemas suatu aplikasi, mengirimkannya ke host tujuan dan kemudian interaksi dapat terjadi secara lokal.


Gambar 2.14. Mobile Agent mengurangi trafik jaringan

- Efisiensi sumber daya.
Konsumsi sumber daya (CPU dan memori) dapat dihemat, sebab mobile agent bekerja sesuai dengan tugas yang diberikan yaitu pada satu node pada satu waktu. Node yang lain tidak menjalankan agen sampai node tersebut memerlukannya.

- Menanggulangi latency jaringan.
Sistem real-time yang kritis perlu tanggap terhadap perubahan lingkungannya secara real-time. Keterlambatan tanggapan yang diakibatkan oleh masalah jaringan harus dihindari. Mobile agent menawarkan suatu pemecahan dengan mengirimkan agen ke tujuan dan dieksekusi secara lokal.

- Eksekusi secara Asynchronous dan Autonomous.
Untuk menjaga koneksi dengan sistem lainnya diperlukan sarana komunikasi yang baik. Sayangnya dalam kenyataan seringkali banyak ditemukan jaringan yang mahal dan mudah putus, sehingga untuk mempertahankan koneksivitas menjadi tidak feasible, baik secara ekonomis maupun teknis. Dengan mobile agent hal ini dapat diminimasi karena mobile agent mampu bekerja secara mandiri dan dapat beroperasi secara asynchronous dan autonomous.. Gambar 2.5 menunjukan urutan peristiwa tersebut.

Gambar 2.15. eksekusi agen secara asyncronous & autonomous
- Adaptasi secara dinamis.
Mobile agent dapat mendeteksi adanya perubahan di lingkungannya dan dapat bereaksi secara autonomous melakukan perubahan.

- Andal dan Toleran terhadap Kesalahan.
Kemampuan mobile agent untuk beraksi secara dinamis pada situasi dan keadaan yang tak menguntungkan menjadikan mobile agent mudah untuk membuat sistem terdistribusi yang andal dan toleran terhadap kesalahan.
- Multiplatform.
Dalam komputasi berbasis web sangat dimungkinkan penggunaan berbagai sistem yang berbeda baik pada sisi hardware maupun software. Mobile agent tidak tergantung pada komputer dan jaringan, tetapi hanya tergantung pada lingkungannya. Sebagai contoh, mobile agent Java dapat ditujukan ke segala sistem yang mempunyai JVM (Java Virtual Machine) dan dapat beroperasi pada berbagai sistem operasi.

III.2 Sistem Multi Agen
Lange (1998) menjelaskan sistem multi agent dapat didefinisikan sebagai kumpulan jaringan agen yang mempunyai tugas khusus yang saling berinteraksi dan bekerja sama untuk memecahkan masalah global melalui bagian-bagian otonomi sistem. Karakteristik dari sistem multi agent menurut Lange (1998) adalah sebagai berikut :
- Setiap agen mempunyai tugas khusus untuk memecahkan masalah di bagian masing-masing, dan daya pandang yang terbatas.
- Tidak ada sistem kontrol global.
- Data terdistribusi pada masing-masing bagian.
Sistem ini secara tradisional mempunyai keunggulan pada bidang pemecahan masalah secara konkuren dan terdistribusi, dan juga memiliki keunggulan dalam pola-pola interaksi yang canggih. Tipe-tipe interaksi pada sistem multi agen ialah sebagi berikut (Parunak, 1998) :
- Cooperation (bekerja sama menuju satu tujuan yang sama).
- Coordination (mengorganisasikan aktivitas pemecahan masalah sehingga dapat bersama-sama mencapai tujuan).
- Negotiation (mencapai suatu kesepakatan yang dapat diterima berbagai pihak yang terlibat).
Sistem multi agent memperluas cakupan agen cerdas setidak-tidaknya dalam dua bagian yaitu :
- Agen user mendelegasikan tugasnya kepada agen lain dalam mencapai tujuannya
- Agen didesain secara eksplisit untuk berkomunikasi dan berinteraksi dengan agen lainnya.
Salah satu aplikasi yang menarik dari sistem multi agen ini ialah dalam sistem monitoring data stok dan penjualan karena data stok dan penjualan di tiap distributor mempunyai sifat yang dinamis dimana perubahan datanya sangat cepat. Sistem agen ini dapat membantu perusahaan manufaktur untuk memonitor secara simultan dan real time kondisi stok dan penjualan di masing-masing distributor yang memasarkan produknya.

III. Perancangan Sistem Mobile Agent
Sistem mobile agent yang akan dibangun adalah agent untuk melakukan monitoring dan updating data stok di sebuah distributor dalam jaringan berbasis web. Secara lengkap sistem yang akan dibangun pada penelitian ini dapat dijelaskan seperti pada gambar 1. Masing-masing komputer mempunyai tugas fungsi sebagai berikut :
• Web server
• Server basis data
• Klien



Gambar 1. Rancangan sistem

Secara blok diagram, perancangan sistem terdiri dari 3 blok utama, yaitu sisi klien atau client side, sisi server atau server side dan remote side. Sisi klien berupa internet browser yang dapat mengakses suatu web server. Sisi server terdiri dari web server dan aglet server. Sedang remote side berupa server basis data. Detail mengenai sub blok ini akan dijelaskan pada sub berikutnya. Secara lengkap blok diagram sistem dapat dilihat pada gambar 2.


Gambar 2. Diagram blok arsitektur sistem

Arsitektur sistem yang dikembangkan pada penelitian ini dapat dijelaskan sebagai berikut.
•Aglet server, merupakan rumah agen atau tempat hidup agen dimana agen dibuat, bekerja dan bertukar informasi dengan agen lainnya.
• Apache merupakan HTTP server yang mampu menangani permintaan browser untuk menampilkan halaman web baik dalam format html maupun php.
• MySQL merupakan basis data server yang berada di web server tempat penyimpanan data yang bisa diakses user menggunakan web browser.
Web browser merupakan interface bagi user sekaligus access point ke dalam sistem.

Minggu, 30 Mei 2010

Instalasi dan Konfigurasi DNS Server Menggunakan Bind 9

Domain Name System (DNS) adalah sebuah sistem yang berfungsi menerjemahkan alamat IP menjadi nama domain. Misalnya, sebuah komputer/server dengan IP (public) 209.131.36.158 memiliki nama domain www.yahoo.com, sehingga end user tidak perlu mengingat alamat IP dari server tersebut yang pasti lebih sulit untuk diingat. Cukup dulu penjelasan singkat mengenai DNS server, keterangan lebih lanjut silahkan baca di sini.

Step 1: Edit File /etc/apt/sources.list:

sudo nano /etc/apt/sources.list

Repository yang digunakan pada tutorial kali ini adalah :

deb http://archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ dapper main universe restricted multiverse

deb http://security.ubuntu.com/ubuntu/ dapper-security universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu/ dapper-updates universe main multiverse restricted

deb http://archive.ubuntu.com/ubuntu/ dapper-proposed universe main multiverse restri

Step2: Install bind 9:

sudo apt-get install bind9

Step 3: Konfigurasi Bind. Jika instalasi Bind menggunakan paket source maka file konfigurasi akan terletak pada named.conf. Berbeda dengan Ubuntu yang telah melakukannya untuk kita. Jadi file yang akan kita edit adalah named.conf.local

sudo vi /etc/bind/named.conf.local

Disini kita akan memasukkan zones. Zones adalah suatu nama domain yang me-refer ke DNS server.
Edit file /etc/bind/named.conf.local :

# This is the zone definition. replace example.com with your domain name

zone "example.com" {

type master;

file "/etc/bind/zones/example.com.db";

};


 

# This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse notation - e.g my network address is 192.168.0

zone "0.168.192.in-addr.arpa" {

type master;

file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";

};

Edit file /etc/bind/named.conf.options:

sudo nano /etc/bind/named.conf.options

Kita harus mengubah nilai forwarder. Ketika request tak dapat dipenuhi oleh DNS server kita, maka request tersebut akan di forward ke DNS server berikut.

forwarders {

# Replace the address below with the address of your provider's DNS server

10.14.1.37;

10.14.203.7

};

Kemudian lihat file zones ganti example.com dengan nama domain:

sudo mkdir /etc/bind/zones

sudo vi /etc/bind/zones/example.com.db

File zone berisi padanan ip dengan nama domain yang diberikan, seperti contoh berikut.

// replace example.com with your domain name. do not forget the . after the domain name!// Also, replace ns1 with the name of your DNS server

example.com. IN SOA ns1.example.com. admin.example.com. (

// Do not modify the following lines!

2006081401

28800

3600

604800

38400

)


 

// Replace the following line as necessary:

// ns1 = DNS Server name

// mta = mail server name

// example.com = domain name

example.com. IN NS ns1.example.com.

example.com. IN MX 10 mta.example.com.


 

// Replace the IP address with the right IP addresses.


 

www IN A 192.168.0.2

mta IN A 192.168.0.3

ns1 IN A 192.168.0.1

Kemudian buat file reverse DNS zone:

sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa

Copy dan paste teks berikut:

//replace example.com with yoour domain name, ns1 with your DNS server name.

// The number before IN PTR example.com is the machine address of the DNS server. in my case, it's 1, as my IP address is 192.168.0.1.

@ IN SOA ns1.example.com. admin.example.com. (

2006081401;

28800;

604800;

604800;

86400

)


 

IN NS ns1.example.com.

1 IN PTR example.com

Selesai, restart DNS server:

sudo /etc/init.d/bind9 restart

Step 4: Edit file resolv.conf seperti berikut:

sudo vi /etc/resolv.conf

masukkan baris berikut:

// replace example.com with your domain name, and 192.168.0.1 with the address of your new DNS server.search example.com

nameserver 192.168.0.1

Test DNS server:

dig example.com

Sumber : http://hemaya.wordpress.com



 

Senin, 17 Mei 2010

Remote Accsess Dan FTP

FTP (singkatan dari File Transfer Protocol) adalah sebuah protokol Internet yang berjalan di dalam lapisan aplikasi yang merupakan standar untuk pentransferan berkas (file) komputer antar mesin-mesin dalam sebuah internetwork.
FTP merupakan salah satu protokol Internet yang paling awal dikembangkan, dan masih digunakan hingga saat ini untuk melakukan pengunduhan (download) dan penggugahan (upload) berkas-berkas komputer antara klien FTP dan server FTP. Sebuah Klien FTP merupakan aplikasi yang dapat mengeluarkan perintah-perintah FTP ke sebuah server FTP, sementara server FTP adalah sebuah Windows Service atau daemon yang berjalan di atas sebuah komputer yang merespons perintah-perintah dari sebuah klien FTP. Perintah-perintah FTP dapat digunakan untuk mengubah direktori, mengubah modus transfer antara biner dan ASCII, menggugah berkas komputer ke server FTP, serta mengunduh berkas dari server FTP.
Sebuah server FTP diakses dengan menggunakan Universal Resource Identifier (URI) dengan menggunakan format ftp://namaserver. Klien FTP dapat menghubungi server FTP dengan membuka URI tersebut.
Untuk melakukan kegiatan remote ataupun ftp pertama – tama kita harus mengatur ip kita agar dapat terkoneksi dengan server

  • Konfigurasi ip menjadi 192.168.0.111

    root@lab-2-desktop:/home/lab-2# mii-tool
    eth0: no link
    eth1: negotiated 100baseTx-FD flow-control, link ok
    eth2: no link
    root@lab-2-desktop:/home/lab-2# ifconfig eth1 192.168.0.111

  • Coba ping ip sendiri dan server dengan ip 192.168.0.1

    root@lab-2-desktop:/home/lab-2# ping 192.168.0.1
    PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
    64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=1.69 ms
    64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.126 ms
    64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.131 ms
    64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.132 ms
    ^Z
    [23]+ Stopped ping 192.168.0.1
    root@lab-2-desktop:/home/lab-2# ping 192.168.0.111
    PING 192.168.0.111 (192.168.0.111) 56(84) bytes of data.
    64 bytes from 192.168.0.111: icmp_seq=1 ttl=64 time=0.039 ms
    64 bytes from 192.168.0.111: icmp_seq=2 ttl=64 time=0.017 ms
    64 bytes from 192.168.0.111: icmp_seq=3 ttl=64 time=0.014 ms
    ^Z
    [24]+ Stopped ping 192.168.0.111

  • Coba ping ke pc yg lain

    root@lab-2-desktop:/home/lab-2# ping 192.168.0.110
    PING 192.168.0.110 (192.168.0.110) 56(84) bytes of data.
    64 bytes from 192.168.0.110: icmp_seq=1 ttl=64 time=0.152 ms
    64 bytes from 192.168.0.110: icmp_seq=2 ttl=64 time=0.140 ms
    64 bytes from 192.168.0.110: icmp_seq=3 ttl=64 time=0.139 ms
    ^Z
    [26]+ Stopped ping 192.168.0.110
    root@lab-2-desktop:/home/lab-2# ping 192.168.0.109
    PING 192.168.0.109 (192.168.0.109) 56(84) bytes of data.
    64 bytes from 192.168.0.109: icmp_seq=1 ttl=64 time=4.26 ms
    64 bytes from 192.168.0.109: icmp_seq=2 ttl=64 time=0.147 ms
    64 bytes from 192.168.0.109: icmp_seq=3 ttl=64 time=0.142 ms
    64 bytes from 192.168.0.109: icmp_seq=4 ttl=64 time=0.147 ms
    ^Z
    [27]+ Stopped ping 192.168.0.109
    root@lab-2-desktop:/home/lab-2# ping 192.168.0.110
    PING 192.168.0.110 (192.168.0.110) 56(84) bytes of data.
    64 bytes from 192.168.0.110: icmp_seq=1 ttl=64 time=0.155 ms
    64 bytes from 192.168.0.110: icmp_seq=2 ttl=64 time=0.146 ms
    64 bytes from 192.168.0.110: icmp_seq=3 ttl=64 time=0.143 ms
    64 bytes from 192.168.0.110: icmp_seq=4 ttl=64 time=0.144 ms
    ^Z
    [28]+ Stopped ping 192.168.0.110

  • Masuk kedalam editor

root@lab-2-desktop:/home/lab-2# sudo nano /etc/apt/sources.list

  • Edit isi dari editor menjadi

    deb http://security.ubuntu.com/ubuntu intrepid-security main restricted
    deb-src http://security.ubuntu.com/ubuntu intrepid-security main restricted
    deb http://security.ubuntu.com/ubuntu intrepid-security universe
    deb-src http://security.ubuntu.com/ubuntu intrepid-security universe
    deb http://security.ubuntu.com/ubuntu intrepid-security multiverse
    deb-src http://security.ubuntu.com/ubuntu intrepid-security multivers
    deb ftp://192.168.0.1/repo ./

  • Update apt

    Pastikan terdapat :
    Get:1 ftp://192.168.0.1 ./ Release.gpg
    Ign ftp://192.168.0.1 ./ Release.gpg
    Get:2 ftp://192.168.0.1 ./ Translation-en_US
    Ign ftp://192.168.0.1 ./ Translation-en_US
    Get:3 ftp://192.168.0.1 ./ Release
    Ign ftp://192.168.0.1 ./ Release
    Get:4 ftp://192.168.0.1 ./ Packages
    Ign ftp://192.168.0.1 ./ Packages
    Get:5 ftp://192.168.0.1 ./ Packages [4475kB]

  • Install openssh

root@lab-2-desktop:/home/lab-2# sudo apt-get install openssh-server

  • Setelah itu coba untuk melakukan remote pada pc teman


    root@lab-2-desktop:/home/lab-2# sudo ssh 192.168.0.110
    root@192.168.0.110's password:
    Linux lab-2-desktop 2.6.27-7-generic #1 SMP Fri Oct 24 06:42:44 UTC 2008 i686

    The programs included with the Ubuntu system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.

    Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
    applicable law.

    To access official Ubuntu documentation, please visit:
    http://help.ubuntu.com/
    root@lab-2-desktop:~# eject
    root@lab-2-desktop:~# exit
    logout
    Connection to 192.168.0.110 closed.
    ** Perintah eject digunakan untuk mengeluarkan tray disk pc yang kita remote dan perintah exit untuk keluar dari aplikasi remote
    Setelah itu kita akan melalukan ftp antar pc dan juga server

  • Install ftp

root@lab-2-desktop:/home/lab-2# sudo apt-get install vsftpd

  • Coba lakukan ftp pada pc sendiri

    root@lab-2-desktop:/home/lab-2# ftp 192.168.0.111
    Connected to 192.168.0.111.
    220 (vsFTPd 2.0.7)
    Name (192.168.0.111:lab-2): anonymous
    331 Please specify the password.
    Password:
    230 Login successful.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> ls
    200 PORT command successful. Consider using PASV.
    150 Here comes the directory listing.
    226 Directory send OK.
    ftp> exit
    221 Goodbye.

  • Edit editor ftp untuk menentukan file yang akan dibuka

root@lab-2-desktop:/home/lab-2# sudo nano /etc/vsftpd.conf

  • Editor ftp

    # Allow anonymous FTP? (Beware - allowed by default if you comment this out).
    anonymous_enable=YES
    anon_root=/home/ftp

  • Restart

    root@lab-2-desktop:/home/lab-2# sudo /etc/init.d/vsftpd restart
    * Stopping FTP server: vsftpd [ OK ]
    Starting FTP server: vsftpd [ OK ]

Minggu, 16 Mei 2010

Seluk beluk TCP dan UDP

Pembahasan TCP dan UDP ini mungkin tidak masuk dalam kategori yang popular , tapi yang namanya ilmu tak ada salahnya di lihat dan dipelajari bukan ? Soal TCP dan UDP ini saya posting berkenaan dengan munculnya sebuah koneksi “aneh” di software bandwidth control, dimana ketika beberapa kali koneksi UDP ini muncul, maka koneksi internet pun langsung sperti “tak bergigi” alias Lemoottt. Nah.. setelah saya telusuri di google dan mendapatkan pembahasan yg lumayan disini : http://www.skullbox.net/tcpudp.php . Akhirnya saya tahu bahwa UDP ini lah penyebab lemotnya koneksi .

Dan lalu saya memutuskan untuk menterjemahkannya dan mempublish nya disini . Di Artikel ini menjelaskan cara kerja TCP dan UDP , perbedaan antara keduanya , dan mengapa Anda akan memilih salah satu dari yang lainnya .

Apa itu TCP ?
TCP (Transmission Control Protocol) adalah protokol yang paling umum digunakan di Internet . Alasan nya karena TCP menawarkan koreksi kesalahan . Ketika protokol TCP digunakan ada klausul “pengiriman terjamin . ” Hal ini disebabkan adanya bagian untuk sebuah metode yang disebut “flow control . ” Flow control menentukan kapan data harus dikirim kembali , dan kapan menghentikan aliran data paket sebelumnya , sampai berhasil ditransfer . Hal ini karena jika paket data berhasil dikirim , tabrakan dapat terjadi . Ketika ini terjadi , maka klien meminta kembali paket dari server sampai seluruh paket lengkap di transfer dan identik dengan aslinya .

Apa itu UDP ?
UDP (User Datagram Protocol) adalah protokol umum lainnya yang digunakan di Internet . Namun UDP tidak pernah digunakan untuk mengirim data penting seperti halaman web , informasi database, dll; UDP biasanya digunakan untuk streaming audio dan video . Streaming media seperti Windows Media audio file ( . WMA) , Real Player ( . RM) , dan lain-lain menggunakan UDP karena menawarkan kecepatan! Alasannya UDP lebih cepat daripada TCP adalah karena tidak ada bentuk kontrol aliran atau koreksi kesalahan . Data yang dikirim melalui Internet dipengaruhi oleh tabrakan , dan kesalahan yang muncul . Ingatlah bahwa UDP hanya berkaitan dengan kecepatan . Ini adalah alasan utama mengapa media streaming tidak berkualitas tinggi .

Berita buruknya UDP telah digunakan di beberapa virus trojan horse. Hacker mengembangkan skrip dan trojan untuk menjalankan UDP dalam rangka untuk menutupi kegiatan mereka . Paket-paket UDP juga digunakan dalam serangan DoS (Denial of Service). Penting untuk mengetahui perbedaan antara TCP port 80 dan UDP port 80 . Lebih jelas tentang port silahkan lihat pembahasannya dibawah .

Struktur frame TCP dan UDP
Sebagai data yang bergerak di sepanjang jaringan , berbagai atribut ditambahkan ke file untuk membuat bingkai . Proses ini disebut enkapsulasi . Ada beberapa metode yang berbeda dari enkapsulasi tergantung pada protokol dan topologi yang sedang digunakan . Akibatnya , paket struktur rangka ini berbeda juga . Gambar berikut ini menunjukkan struktur bingkai TCP dan UDP. ( lihat gambarnya disini dan disini )

Payload area berisi data sebenarnya . Perhatikan bahwa TCP memiliki struktur bingkai yang lebih kompleks . Hal ini terutama disebabkan oleh fakta bahwa TCP merupakan protokol berorientasi koneksi . Bidang tambahan yang perlu untuk memastikan “jaminan pengiriman” yang ditawarkan oleh TCP

IP Ports

Port dikembangkan agar komputer dapat menerima data dari berbagai sumber melalui alamat IP yang sama . Pikirkan seperti ini; Anda adalah layanan TV Internet , dan port adalah saluran Anda . Anda memiliki banyak bentuk hiburan , berita , dan informasi yang tersedia melalui berbagai saluran yang berbeda . Pikirkan tentang hal ini , katakanlah MTV adalah saluran 35 di TV . Hal yang sama berlaku untuk web server yang berjalan pada port 80 . Setiap port memiliki tujuan khusus melayani masing-masing saluran program televisi yang berbeda . Meskipun Anda hanya punya 1 kabel TV berlangganan , Anda masih dapat menerima beberapa saluran .

Dua jenis utama port: TCP dan UDP . TCP singkatan dari Transmission Control Protocol . UDP adalah singkatan dari User Data Protocol . Beberapa program di komputer Anda akan menggunakan port TCP untuk komunikasi dan lainnya dapat menggunakan UDP . Penting untuk mengetahui perbedaan bagaimana cara keduanya beroperasi .

Ada 65.535 TCP dan UDP port yang tersedia untuk mengirimkan data . Port 0-1.023 dicadangkan untuk penggunaan umum . Port ini ditugaskan oleh IANA (Internet Assigned Numbering Authority) . Ini berarti , bahwa setiap port 0-1.023 akan sama pada setiap sistem . Sebagai contoh , katakanlah server di New York menggunakan port 80 , dan lainnya adalah server Texas . Karena port 80 jatuh di kisaran reserved Port , kita tahu kedua server menggunakan port 80 untuk koneksi HTTP . Melihat daftar port yang diketahui dapat membantu Anda menentukan jenis koneksi yang terdapat pada mesin Anda . Untuk melihat daftar nomor port yang umum digunakan dan penjelasannya klik di sini .

Server atau mesin dalam hal “mengakses” port tertentu . Sebagai contoh , menjalankan server web , FTP , dan layanan Telnet akan mengakses pada port masing-masing . Tindakan mengakses ini berarti mesin sedang menunggu perangkat lain tersambung. Lihat ilustrasi di sini:

Anda dapat melihat bagaimana server mengakses 3 port lebih dari satu alamat IP (192.168.0.15). Anda juga harus tahu bahwa adalah mungkin untuk beberapa perangkat untuk terhubung ke satu port. Artinya , telnet server mungkin menerima lebih dari 100 koneksi simultan ke port 23.

Sumber asli artikel : http://www.skullbox.net/tcpudp.php ; http://www.skullbox.net/ports.php

Sumber : www.gogle.com, www.wikipedia.com

Senin, 10 Mei 2010

LINUX ROUTER DENGAN 3 CLIENT


 

PC ROUTER

lab-2@lab-2-desktop:~$ sudo su

[sudo] password for lab2:

root@lab-2-desktop:/home/lab-2# lspci

00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 02)

00:02.0 VGA compatible controller: Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02)

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)

00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)

00:1c.2 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 3 (rev 01)

00:1c.3 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 4 (rev 01)

00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)

00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)

00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)

00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)

00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)

00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)

00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)

04:00.0 Ethernet controller: D-Link System Inc RTL8139 Ethernet (rev 10)

04:01.0 Ethernet controller: D-Link System Inc Gigabit Ethernet Adapter (rev 11)

04:08.0 Ethernet controller: Intel Corporation PRO/100 VE Network Connection (rev 01)

root@lab-2-desktop:/home/lab-2# ifconfig eth0 192.168.0.254

root@lab-2-desktop:/home/lab-2# ifconfig eth1 10.255.255.254

root@lab-2-desktop:/home/lab-2# ifconfig eth2 172.16.255.254

root@lab-2-desktop:/home/lab-2# ifconfig

eth0 Link encap:Ethernet HWaddr 00:17:9a:3a:1c:90

inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::217:9aff:fe3a:1c90/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:58 errors:0 dropped:0 overruns:0 frame:0

TX packets:138 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:8197 (8.1 KB) TX bytes:22898 (22.8 KB)

Interrupt:21 Base address:0x1100

eth1 Link encap:Ethernet HWaddr 00:19:d1:18:dd:b0

inet addr:10.255.255.254 Bcast:10.255.255.255 Mask:255.0.0.0

inet6 addr: fe80::219:d1ff:fe18:ddb0/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:56 errors:0 dropped:0 overruns:0 frame:0

TX packets:87 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:12906 (12.9 KB) TX bytes:16379 (16.3 KB)

eth2 Link encap:Ethernet HWaddr 00:11:95:c7:09:e0

inet addr:172.16.255.254 Bcast:172.16.255.255 Mask:255.255.0.0

inet6 addr: fe80::211:95ff:fec7:9e0/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:57 errors:0 dropped:0 overruns:0 frame:0

TX packets:125 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:9383 (9.3 KB) TX bytes:27622 (27.6 KB)

Interrupt:22

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:436 errors:0 dropped:0 overruns:0 frame:0

TX packets:436 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:35176 (35.1 KB) TX bytes:35176 (35.1 KB)

root@lab-2-desktop:/home/lab-2# mii-tool

eth0: negotiated 100baseTx-FD, link ok

eth1: negotiated 100baseTx-FD flow-control, link ok

eth2: negotiated 100baseTx-FD, link ok

root@lab-2-desktop:/home/lab-2# ping 192.168.0.1

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.

64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=3.19 ms

64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.110 ms

64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.105 ms

^C

--- 192.168.0.1 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2006ms

rtt min/avg/max/mdev = 0.105/1.136/3.193/1.454 ms

root@lab-2-desktop:/home/lab-2# ping 10.0.0.1

PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.

64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=3.53 ms

64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.126 ms

64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.124 ms

64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.120 ms

^C

--- 10.0.0.1 ping statistics ---

7 packets transmitted, 4 received, 42% packet loss, time 6006ms

rtt min/avg/max/mdev = 0.120/0.975/3.532/1.476 ms

root@lab-2-desktop:/home/lab-2# ping 172.16.0.1

PING 172.16.0.1 (172.16.0.1) 56(84) bytes of data.

64 bytes from 172.16.0.1: icmp_seq=1 ttl=64 time=1.42 ms

64 bytes from 172.16.0.1: icmp_seq=2 ttl=64 time=0.107 ms

64 bytes from 172.16.0.1: icmp_seq=3 ttl=64 time=0.099 ms

64 bytes from 172.16.0.1: icmp_seq=4 ttl=64 time=0.123 ms

^C

--- 172.16.0.1 ping statistics ---

4 packets transmitted, 4 received, 0% packet loss, time 3004ms

rtt min/avg/max/mdev = 0.099/0.438/1.423/0.568 ms

root@lab-2-desktop:/home/lab-2# route add default gw 192.168.0.254

root@lab-2-desktop:/home/lab-2# route add default gw 10.255.255.254

root@lab-2-desktop:/home/lab-2# route add default gw 172.16.255.254

root@lab-2-desktop:/home/lab-2# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

172.16.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth2

10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1

0.0.0.0 172.16.255.254 0.0.0.0 UG 0 0 0 eth2

0.0.0.0 10.255.255.254 0.0.0.0 UG 0 0 0 eth1

0.0.0.0 192.168.0.254 0.0.0.0 UG 0 0 0 eth0

root@lab-2-desktop:/home/lab-2# sysctl -w net.ipv4.ip_forward=1

net.ipv4.ip_forward = 1

root@lab-2-desktop:/home/lab-2# iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.255.0 -d 0/0 -j MASQUERADE


 

PC CLIENT 1

lab-2@lab-2-desktop:~$ sudo su

[sudo] password for lab2:

root@lab-2-desktop:/home/lab-2# ifconfig eth0 192.168.0.1

root@lab-2-desktop:/home/lab-2# route add default gw 192.168.0.254

root@lab-2-desktop:/home/lab-2# ping 10.0.0.1

PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.

64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=3.53 ms

64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.126 ms

64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.124 ms

64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.120 ms

^C

--- 10.0.0.1 ping statistics ---

7 packets transmitted, 4 received, 42% packet loss, time 6006ms

rtt min/avg/max/mdev = 0.120/0.975/3.532/1.476 ms


 

PC CLIENT 2

lab-2@lab-2-desktop:~$ sudo su

[sudo] password for lab2:

root@lab-2-desktop:/home/lab-2# ifconfig eth0 10.0.0.1

root@lab-2-desktop:/home/lab-2# route add default gw 10.255.255.254

root@lab-2-desktop:/home/lab-2# ping 172.16.0.1

PING 172.16.0.1 (172.16.0.1) 56(84) bytes of data.

64 bytes from 172.16.0.1: icmp_seq=1 ttl=64 time=1.42 ms

64 bytes from 172.16.0.1: icmp_seq=2 ttl=64 time=0.107 ms

64 bytes from 172.16.0.1: icmp_seq=3 ttl=64 time=0.099 ms

64 bytes from 172.16.0.1: icmp_seq=4 ttl=64 time=0.123 ms

^C

--- 172.16.0.1 ping statistics ---

4 packets transmitted, 4 received, 0% packet loss, time 3004ms

rtt min/avg/max/mdev = 0.099/0.438/1.423/0.568 ms


 

PC CLIENT 3

lab-2@lab-2-desktop:~$ sudo su

[sudo] password for lab2:

root@lab-2-desktop:/home/lab-2# ifconfig eth0 172.16.0.1

root@lab-2-desktop:/home/lab-2# route add default gw 172.16.255.254

root@lab-2-desktop:/home/lab-2# ping 192.168.0.1

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.

64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=3.19 ms

64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.110 ms

64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.105 ms

^C

--- 192.168.0.1 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2006ms

rtt min/avg/max/mdev = 0.105/1.136/3.193/1.454 ms

LINUX ROUTER DENGAN 2 CLIENT

lab2@lab2-desktop:~$ sudo su

[sudo] password for lab2:

root@lab2-desktop:/home/lab2# lspci

00:00.0 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge

00:00.1 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge

00:00.2 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge

00:00.3 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge

00:00.4 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge

00:00.5 PIC: VIA Technologies, Inc. P4M890 I/O APIC Interrupt Controller

00:00.6 Host bridge: VIA Technologies, Inc. P4M890 Security Device

00:00.7 Host bridge: VIA Technologies, Inc. P4M890 Host Bridge

00:01.0 PCI bridge: VIA Technologies, Inc. VT8237/VX700 PCI Bridge

00:02.0 PCI bridge: VIA Technologies, Inc. P4M890 PCI to PCI Bridge Controller

00:03.0 PCI bridge: VIA Technologies, Inc. P4M890 PCI to PCI Bridge Controller

00:0f.0 IDE interface: VIA Technologies, Inc. Device 5337 (rev 80)

00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 07)

00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)

00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)

00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)

00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev a0)

00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)

00:11.0 ISA bridge: VIA Technologies, Inc. VT8237A PCI to ISA Bridge

00:11.7 Host bridge: VIA Technologies, Inc. VT8251 Ultra VLINK Controller

00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 7c)

00:13.0 Host bridge: VIA Technologies, Inc. VT8237A Host Bridge

00:13.1 PCI bridge: VIA Technologies, Inc. VT8237A PCI to PCI Bridge

01:00.0 VGA compatible controller: VIA Technologies, Inc. P4M890 [S3 UniChrome Pro] (rev 01)

04:03.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone]

80:01.0 Audio device: VIA Technologies, Inc. VT1708/A [Azalia HDAC] (VIA High Definition Audio Controller) (rev 10)

root@lab2-desktop:/home/lab2# ifconfig eth0 192.168.0.254

root@lab2-desktop:/home/lab2# ifconfig eth1 10.255.255.254

root@lab2-desktop:/home/lab2# ifconfig

eth0 Link encap:Ethernet HWaddr 00:e0:4d:3d:8c:c2

inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Interrupt:23 Base address:0x4000

eth1 Link encap:Ethernet HWaddr 00:10:4b:66:ca:49

inet addr:10.255.255.254 Bcast:10.255.255.255 Mask:255.0.0.0

UP BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Interrupt:16 Base address:0x8000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:254 errors:0 dropped:0 overruns:0 frame:0

TX packets:254 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:18016 (18.0 KB) TX bytes:18016 (18.0 KB)

root@lab2-desktop:/home/lab2# mii-tool

eth0: no link

eth1: no link

root@lab2-desktop:/home/lab2# ping 10.0.0.1

PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.

64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.898 ms

64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.097 ms

64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.107 ms

64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.105 ms

64 bytes from 10.0.0.1: icmp_seq=5 ttl=64 time=0.098 ms

64 bytes from 10.0.0.1: icmp_seq=6 ttl=64 time=0.091 ms

^C

--- 10.0.0.1 ping statistics ---

6 packets transmitted, 6 received, 0% packet loss, time 5004ms

rtt min/avg/max/mdev = 0.091/0.232/0.898/0.298 ms

root@lab2-desktop:/home/lab2# ping 192.168.0.1

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.

64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=3.92 ms

64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.098 ms

64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.093 ms

64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.100 ms

^C

--- 192.168.0.1 ping statistics ---

4 packets transmitted, 4 received, 0% packet loss, time 3007ms

rtt min/avg/max/mdev = 0.093/1.053/3.921/1.655 ms

root@lab2-desktop:/home/lab2# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

root@lab2-desktop:/home/lab2# ifconfig

eth0 Link encap:Ethernet HWaddr 00:e0:4d:3d:8c:c2

inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::2e0:4dff:fe3d:8cc2/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:23 errors:0 dropped:0 overruns:0 frame:0

TX packets:28 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:3462 (3.4 KB) TX bytes:3558 (3.5 KB)

Interrupt:23 Base address:0x4000

eth1 Link encap:Ethernet HWaddr 00:10:4b:66:ca:49

inet6 addr: fe80::210:4bff:fe66:ca49/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:76 errors:0 dropped:0 overruns:0 frame:0

TX packets:54 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:10944 (10.9 KB) TX bytes:8897 (8.8 KB)

Interrupt:16 Base address:0x8000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:254 errors:0 dropped:0 overruns:0 frame:0

TX packets:254 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:18016 (18.0 KB) TX bytes:18016 (18.0 KB)

root@lab2-desktop:/home/lab2# ifconfig eth1 10.255.255.254

root@lab2-desktop:/home/lab2# ifconfig

eth0 Link encap:Ethernet HWaddr 00:e0:4d:3d:8c:c2

inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::2e0:4dff:fe3d:8cc2/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:25 errors:0 dropped:0 overruns:0 frame:0

TX packets:31 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:4146 (4.1 KB) TX bytes:4584 (4.5 KB)

Interrupt:23 Base address:0x4000

eth1 Link encap:Ethernet HWaddr 00:10:4b:66:ca:49

inet addr:10.255.255.254 Bcast:10.255.255.255 Mask:255.0.0.0

inet6 addr: fe80::210:4bff:fe66:ca49/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:76 errors:0 dropped:0 overruns:0 frame:0

TX packets:62 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:10944 (10.9 KB) TX bytes:11117 (11.1 KB)

Interrupt:16 Base address:0x8000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:254 errors:0 dropped:0 overruns:0 frame:0

TX packets:254 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:18016 (18.0 KB) TX bytes:18016 (18.0 KB)

root@lab2-desktop:/home/lab2# ping 10.0.0.1

PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.

64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.123 ms

64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.099 ms

64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.120 ms

64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.119 ms

^C

--- 10.0.0.1 ping statistics ---

4 packets transmitted, 4 received, 0% packet loss, time 2997ms

rtt min/avg/max/mdev = 0.099/0.115/0.123/0.012 ms

root@lab2-desktop:/home/lab2# ping 192.168.0.1

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.

64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.506 ms

64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.098 ms

64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.097 ms

64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.091 ms

64 bytes from 192.168.0.1: icmp_seq=5 ttl=64 time=0.100 ms

64 bytes from 192.168.0.1: icmp_seq=6 ttl=64 time=0.082 ms

64 bytes from 192.168.0.1: icmp_seq=7 ttl=64 time=0.098 ms

64 bytes from 192.168.0.1: icmp_seq=8 ttl=64 time=0.100 ms

64 bytes from 192.168.0.1: icmp_seq=9 ttl=64 time=0.099 ms

64 bytes from 192.168.0.1: icmp_seq=10 ttl=64 time=0.094 ms

64 bytes from 192.168.0.1: icmp_seq=11 ttl=64 time=0.113 ms

^C

--- 192.168.0.1 ping statistics ---

11 packets transmitted, 11 received, 0% packet loss, time 10000ms

rtt min/avg/max/mdev = 0.082/0.134/0.506/0.118 ms

root@lab2-desktop:/home/lab2# mii-tool

eth0: negotiated 100baseTx-FD, link ok

eth1: negotiated 100baseTx-FD, link ok

root@lab2-desktop:/home/lab2# route add default gw 192.168.254

root@lab2-desktop:/home/lab2# route add default gw 192.168.0.254

SIOCADDRT: File exists

root@lab2-desktop:/home/lab2# route add default gw 10.255.255.254

root@lab2-desktop:/home/lab2# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1

0.0.0.0 10.255.255.254 0.0.0.0 UG 0 0 0 eth1

0.0.0.0 192.168.0.254 0.0.0.0 UG 0 0 0 eth0

root@lab2-desktop:/home/lab2# sysctl -w net.ipv4.ip_forward=1

net.ipv4.ip_forward = 1

root@lab2-desktop:/home/lab2# iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.255.0 -d 0/0 -j MASQUERADE

root@lab2-desktop:/home/lab2# iptables -L

Chain INPUT (policy ACCEPT)

target prot opt source destination

Chain FORWARD (policy ACCEPT)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

root@lab2-desktop:/home/lab2# ping 192.168.0.1

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.

64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=2.69 ms

64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.142 ms

64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.134 ms

64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.138 ms

64 bytes from 192.168.0.1: icmp_seq=5 ttl=64 time=0.136 ms

64 bytes from 192.168.0.1: icmp_seq=6 ttl=64 time=0.116 ms

64 bytes from 192.168.0.1: icmp_seq=7 ttl=64 time=0.134 ms

^C

--- 192.168.0.1 ping statistics ---

7 packets transmitted, 7 received, 0% packet loss, time 6006ms

rtt min/avg/max/mdev = 0.116/0.498/2.692/0.895 ms

root@lab2-desktop:/home/lab2# ping 10.0.0.1

PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.

64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=5.43 ms

64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.138 ms

64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.136 ms

64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.135 ms

64 bytes from 10.0.0.1: icmp_seq=5 ttl=64 time=0.137 ms

64 bytes from 10.0.0.1: icmp_seq=6 ttl=64 time=0.123 ms

^C

--- 10.0.0.1 ping statistics ---

6 packets transmitted, 6 received, 0% packet loss, time 5005ms

rtt min/avg/max/mdev = 0.123/1.017/5.433/1.974 ms

root@lab2-desktop:/home/lab2# ifconfig

eth0 Link encap:Ethernet HWaddr 00:e0:4d:3d:8c:c2

inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::2e0:4dff:fe3d:8cc2/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:61 errors:0 dropped:0 overruns:0 frame:0

TX packets:65 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:10938 (10.9 KB) TX bytes:10620 (10.6 KB)

Interrupt:23 Base address:0x4000

eth1 Link encap:Ethernet HWaddr 00:10:4b:66:ca:49

inet addr:10.255.255.254 Bcast:10.255.255.255 Mask:255.0.0.0

inet6 addr: fe80::210:4bff:fe66:ca49/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:114 errors:0 dropped:0 overruns:0 frame:0

TX packets:86 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:18664 (18.6 KB) TX bytes:13692 (13.6 KB)

Interrupt:16 Base address:0x8000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:254 errors:0 dropped:0 overruns:0 frame:0

TX packets:254 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:18016 (18.0 KB) TX bytes:18016 (18.0 KB)

root@lab2-desktop:/home/lab2# mii-tool

eth0: negotiated 100baseTx-FD, link ok

eth1: negotiated 100baseTx-FD, link ok

root@lab2-desktop:/home/lab2# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1

0.0.0.0 10.255.255.254 0.0.0.0 UG 0 0 0 eth1

0.0.0.0 192.168.0.254 0.0.0.0 UG 0 0 0 eth0

root@lab2-desktop:/home/lab2# ifconfig

eth0 Link encap:Ethernet HWaddr 00:e0:4d:3d:8c:c2

inet addr:192.168.0.254 Bcast:192.168.0.255 Mask:255.255.255.0

inet6 addr: fe80::2e0:4dff:fe3d:8cc2/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:70 errors:0 dropped:0 overruns:0 frame:0

TX packets:83 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:14016 (14.0 KB) TX bytes:16776 (16.7 KB)

Interrupt:23 Base address:0x4000

eth1 Link encap:Ethernet HWaddr 00:10:4b:66:ca:49

inet addr:10.255.255.254 Bcast:10.255.255.255 Mask:255.0.0.0

inet6 addr: fe80::210:4bff:fe66:ca49/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:146 errors:0 dropped:0 overruns:0 frame:0

TX packets:105 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:24896 (24.8 KB) TX bytes:15478 (15.4 KB)

Interrupt:16 Base address:0x8000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:254 errors:0 dropped:0 overruns:0 frame:0

TX packets:254 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:18016 (18.0 KB) TX bytes:18016 (18.0 KB)