Routing Lets Get Started Routing Introduction Routing adalah

  • Slides: 77
Download presentation
Routing Let’s Get Started…

Routing Let’s Get Started…

Routing

Routing

Introduction • Routing adalah suatu protocol yang digunakan untuk mendapatkan rute dari satu jaringan

Introduction • Routing adalah suatu protocol yang digunakan untuk mendapatkan rute dari satu jaringan ke jaringan yang lain. • Rute ini disebut dengan route dan informasi route secara dinamis dapat diberikan ke router yang lain ataupun dapat diberikan secara statis router lain.

Introduction • Seorang administrator memilih suatu protocol routing dinamis berdasarkan keadaan topologi jaringannya. •

Introduction • Seorang administrator memilih suatu protocol routing dinamis berdasarkan keadaan topologi jaringannya. • Misalnya, berapa ukuran dari jaringan, bandwidth yang tersedia, proses power dalam router, merek dan model dari router, dan protocol yang digunakan dalam jaringan.

Introduction • Routing adalah proses dimana suatu router memforward paket ke jaringan yang dituju.

Introduction • Routing adalah proses dimana suatu router memforward paket ke jaringan yang dituju. • Suatu router membuat keputusan berdasarkan IP address yang dituju oleh paket. • Semua router menggunakan IP Address tujuan untuk mengirim paket.

Introduction • Agar keputusan routing tersebut benar, router harus belajar bagaimana untuk mencapai tujuan.

Introduction • Agar keputusan routing tersebut benar, router harus belajar bagaimana untuk mencapai tujuan. • Ketika router menggunakan routing dinamis, informasi ini dipelajari dari router yang lain. • Ketika menggunakan routing statis, seorang network administrator mengkonfigurasi informasi tentang jaringan yang ingin dituju secara manual.

Fungsi Dasar Routing • Routing memiliki dua fungsi dasar, yakni: 1. Fungsi penentuan jalur

Fungsi Dasar Routing • Routing memiliki dua fungsi dasar, yakni: 1. Fungsi penentuan jalur Router berfungsi menentukan jalur yang akan dilewati oleh paket-paket data agar sampai ke tujuan 2. Fungsi Switching Router berfungsi sebagai meneruskan paket switching karena dapat

Konsep Routing • Why We need Router ?

Konsep Routing • Why We need Router ?

Konsep Routing • Sebelum kita pelajari mengenai bagaimana konsep routing, perlu memahami beberapa aturan

Konsep Routing • Sebelum kita pelajari mengenai bagaimana konsep routing, perlu memahami beberapa aturan dasar routing. Salah satunya memahami sistem penomoran IP, Subnetting, Net. Mask, dan lain-lain.

Konsep Routing • Contoh Kasus : • Host X -> 128. 1. 1. 1

Konsep Routing • Contoh Kasus : • Host X -> 128. 1. 1. 1 (IP Kelas B network id 128. 1. x. x) • Host Y -> 128. 1. 1. 7 (IP Kelas B Network id 128. 1. x. x) • Host Z -> 128. 2. 2. 1 (IP Kelas B network id 128. 2. x. x) Apa yang terjadi dengan ketiga host di atas?

Konsep Routing • Pada kasus di previous slide, Host X dan Host Y dapat

Konsep Routing • Pada kasus di previous slide, Host X dan Host Y dapat berkomunikasi langsung • Tetapi baik host X maupun berkomunikasi dengan host Z, Network ID yang berbeda. Y tidak dapat karena memiliki • Bagaimana supaya Z dapat berkomunikasi dengan X dan Y?

Konsep Routing • Jadi fungsi router, secara mudah dapat dikatakan, • Menghubungkan dua buah

Konsep Routing • Jadi fungsi router, secara mudah dapat dikatakan, • Menghubungkan dua buah jaringan yang berbeda; tepatnya mengarahkan rute yang terbaik untuk mencapai network yang diharapkan

Konsep Routing • Dalam implementasinya : • Router sering dipakai untuk menghubungkan jaringan antar

Konsep Routing • Dalam implementasinya : • Router sering dipakai untuk menghubungkan jaringan antar lembaga atau perusahaan yang masing-masing telah memiliki jaringan dengan network ID yang berbeda

Static & Dinamis Routing • Jika routing yang digunakan adalah statis, maka konfigurasinya harus

Static & Dinamis Routing • Jika routing yang digunakan adalah statis, maka konfigurasinya harus dilakukan secara manual, administrator jaringan harus memasukkan atau menghapus rute statis jika terjadi perubahan topologi

Static & Dinamis Routing • Pada jaringan skala besar, jika tetap menggunakan routing statis,

Static & Dinamis Routing • Pada jaringan skala besar, jika tetap menggunakan routing statis, maka akan sangan membuang waktu administrator jaringan untuk melakukan update table routing. • Karena itu routing statis hanya mungkin dilakukan untuk jaringan skala kecil. • Sedangkan routing dinamis bisa diterapkan di jaringan skala besar dan membutuhkan kemampuan lebih dari administrator

Static & Dinamis Routing • Tipe-tipe routing

Static & Dinamis Routing • Tipe-tipe routing

Static & Dinamis Routing • Tipe-tipe routing

Static & Dinamis Routing • Tipe-tipe routing

Routing STatic • Suatu mekanisme routing yang dikonfigurasi secara manual oleh admin jaringan memalui

Routing STatic • Suatu mekanisme routing yang dikonfigurasi secara manual oleh admin jaringan memalui tabel routing dan dimaintain secara terpisah karena tidak melakukan pertukaran informasi routing tabel secara dinamis dengan router lainnya.

Routing STatic • Sebuah router akan meneruskan paket-paket data kepada alamat jaringan tujuan yang

Routing STatic • Sebuah router akan meneruskan paket-paket data kepada alamat jaringan tujuan yang ada pada tabel routing. • Jika tidak terdapat alamat jaringan tujuan pada tabel routing, maka paket data akan diteruskan melalui routing default

Routing Static • Cara kerja routing statis dapat dibagi menjadi 3 bagian : •

Routing Static • Cara kerja routing statis dapat dibagi menjadi 3 bagian : • Administrator jaringan yang mengkonfigurasi router • Router melakukan routing berdasarkan informasi dalam tabel routing • Routing statis digunakan untuk melewatkan paket data Seorang administrator harus menggunakan perintah IP Route secara manual untuk mengkonfigurasi router dengan routing statis

Routing Static • perintah IP route : Router(config)#ip route <network destination id> <subnet mask>

Routing Static • perintah IP route : Router(config)#ip route <network destination id> <subnet mask> <default gateway> <administrative distance>

Routing Static Penjelasan : <network destination id> adalah alamat jaringan yg dituju <subnet mask>

Routing Static Penjelasan : <network destination id> adalah alamat jaringan yg dituju <subnet mask> adalah subnet mask dari jaringan yg dituju <default gateway> adalah IP address Gateway, biasanya IP address router yg berhubungan langsung. <administrative distance> adalah nilai 0 -255 yg diberikan pada routing. Bertambah rendah nilai yg diberikan bertambah tinggi kegunaannya. Jika tidak diberikan, nilai default akan dipakai. Nilai default untuk directly connected (C) =0 dan statically connected (S) =1.

Routing Static • Contoh perintah IP route : Hoboken(config)#ip route 172. 16. 1. 0

Routing Static • Contoh perintah IP route : Hoboken(config)#ip route 172. 16. 1. 0 255. 0 s 0 Command destination net subnet mask outgoing int

Routing Static

Routing Static

Routing Static

Routing Static

Routing Static • Pada gambar 6. 3 dan 6. 4 di previous slide, administrator

Routing Static • Pada gambar 6. 3 dan 6. 4 di previous slide, administrator jaringan dari router Hoboken harus mengkonfigurasi routing statis ke jaringan 172. 16. 1. 0/24 dan 172. 16. 5. 0/24 • Karena itu administrator memasukkan 2 perintah ke router. • Default administrative distance saat menggunakan routing statis adalah 1, ketika interface luar di konfigurasi sebagai gateaway, routing statis ditunjukkan dalam tabel routing sebagai informasi yang “directly connected”

Routing Static • Untuk melihat informasi administrative distance digunakan perintah SHOW IP ROUTE •

Routing Static • Untuk melihat informasi administrative distance digunakan perintah SHOW IP ROUTE • Nilai distance adalah antara 0 – 255 yang diberikan setelah next-hop atau outgoing interface • Example : Waycross(config)#ip route 172. 16. 3. 0 255. 0 172. 16. 4. 1 130

Routing Static • Jika interface dari router down, rute tidak akan dimasukkan ke table

Routing Static • Jika interface dari router down, rute tidak akan dimasukkan ke table routing. • Kadang-kadang routing statis digunakan untuk tujuan backup. • Routing statis dapat dikonfigurasi dalam router yang hanya akan digunakan ketika routing dinamis mengalami kegagalan.

Routing Static • Untuk menggunakan routing statis sebagai backup, harus dilakukan seting administrative distance

Routing Static • Untuk menggunakan routing statis sebagai backup, harus dilakukan seting administrative distance ke nilai yang lebih besar daripada protokol routing dinamis yang digunakan.

Routing Static • Konfigurasi routing statis • Langkah-langkah untuk melakukan routing statis adalahs ebagai

Routing Static • Konfigurasi routing statis • Langkah-langkah untuk melakukan routing statis adalahs ebagai berikut : Langkah 1 - konfigurasi Tentukan dahulu prefix jaringan, subnet mask dan address. Address bias saja interface local atau next hop address yang menuju tujuan.

Routing Static Langkah 2 – masuk ke mode global configuration. Langkah 3 – ketik

Routing Static Langkah 2 – masuk ke mode global configuration. Langkah 3 – ketik perintah ip route dengan prefix dan mask yang diikuti dengan address seperti yang sudah ditentukan di langkah 1. Sedangkan untuk administrative distance bersifat tambahan, boleh digunakan boleh tidak.

Routing Static Langkah 4 – ulangi langkah 3 untuk semua jaringan yang dituju yang

Routing Static Langkah 4 – ulangi langkah 3 untuk semua jaringan yang dituju yang telah ditentukan pada langkah 1. Langkah 5 – keluar dai mode global configuration. Langkah 6 – gunakan perintah copy running-config startup-config untuk menyimpan konfigurasi yang sedang aktif ke NVRAM.

Routing Static Contoh jaringan sederhana dengan 3 router seperti yang ditunjukkan oleh gambar 6.

Routing Static Contoh jaringan sederhana dengan 3 router seperti yang ditunjukkan oleh gambar 6. 5 in the next slide :

Routing Static

Routing Static

Routing Static • Router Hoboken harus dikonfigurasi sehingga dapat mencapai jaringan 172. 16. 1.

Routing Static • Router Hoboken harus dikonfigurasi sehingga dapat mencapai jaringan 172. 16. 1. 0 dan jaringan 172. 16. 5. 0. • Kedua jaringan subnet masknya 255. 0.

Routing Static • Paket yang tujuannya ke jaringan 172. 16. 1. 0 harus dirutekan

Routing Static • Paket yang tujuannya ke jaringan 172. 16. 1. 0 harus dirutekan ke Sterling dan paket yang ditujuan ke jaringan 172. 16. 5. 0 harus dirutekan ke Waycross. Dalam hal ini routing statis bisa digunakan. • Kedua routing statis tersebut akan dikonfigurasi menggunakan interface local sebagai gateway ke jaringan yang dituju. Seperti yang ditunjukkan oleh gambar 6. 6.

Routing Static

Routing Static

Routing Static • Dua routing statis yang sama juga dapat dikonfigurasi dengan next-hop address

Routing Static • Dua routing statis yang sama juga dapat dikonfigurasi dengan next-hop address sebagai gateway. Seperti yang ditunjukkan oleh gambar 6. 6. • Rute pertama ke jaringan 172. 16. 1. 0 dengan gateway ke 172. 16. 2. 1. Sedangkan rute kedua ke jaringan 172. 16. 5. 0 dengan gateway ke 172. 16. 4. 2. Administrative distance tidak digunakan, sehingga defaultnya bernilai 1.

Routing Static

Routing Static

Datalink Socket Address Structure • We will encounter datalink socket address structures as return

Datalink Socket Address Structure • We will encounter datalink socket address structures as return values contained in some of the messages returned on a routing socket. • Gambar berikut menunjukkan definisi structure, yang didefinisikan dengan memasukkan <net/if_dl. h>

Datalink Socket Address Structure Struct sockaddrr_dl{ uint 8_t sdl_len; sa_family_t sdl_family; *AF_LINK uint 16_t

Datalink Socket Address Structure Struct sockaddrr_dl{ uint 8_t sdl_len; sa_family_t sdl_family; *AF_LINK uint 16_t sdl_index; *system assigned index, if>0 uint 8_t sdl_type; *IFT_ETHER, etc. from <net/if_types. h> uint 8_t sdl_nlen; *name length, startin in sdl_data[0] uint 8_t sdl_alen; *link-layer address length uint 8_t sdl_slen; *link-layer selector length char sdl_data[12]; *minimum work area, can be larger; }; contains i/f name and link-layer address

Datalink Socket Address Structure • Sdl_data member contains both the name and linklayer address

Datalink Socket Address Structure • Sdl_data member contains both the name and linklayer address (e. g. the 48 -bit MAC address for an Ethernet Interface) • The name begins at sdl_data[0] and is not nullterminated. • The link-layer address begin sdl_nlen bytes after the name

Datalink Socket Address Structure • This header defines by the following macro to return

Datalink Socket Address Structure • This header defines by the following macro to return the pointer to the link-layer address: #define LLADDR(s) >sdl_nlen)) ((caddr_t) (s)->sdl_data + (s)-

Datalink Socket Address Structure • These socket address structures are variable-length. If the link-layer

Datalink Socket Address Structure • These socket address structures are variable-length. If the link-layer address and name exceed 12 bytes, the structure will be larger than 20 bytes • The size normally rounded up to the next multiple 4 bytes on 32 -bit systems

Reading and Writing • After a process creates a routing socket, it can send

Reading and Writing • After a process creates a routing socket, it can send commands to the kernel by writing to the socket and read information from the kernel by reading from the socket. • These are 12 different routing commands, 5 of which can be issued by the process. • These commands are defined by including the <net/route. h>

Reading and Writing • These commands are defined by including the <net/route. h> header

Reading and Writing • These commands are defined by including the <net/route. h> header and are shown in next slide • Types of Messages exchanged across a routing socket

Reading and Writing

Reading and Writing

Reading and Writing • Five different structures are exchanged across a routing socket, as

Reading and Writing • Five different structures are exchanged across a routing socket, as shown in the final column of this figure: • rt_msghdr • If_announcemsghdr • If_msghdr • Ifa_msghdr • Ifma_msghdr

Reading and Writing five structures returned with routing messages. • • • • struct

Reading and Writing five structures returned with routing messages. • • • • struct rt_msghdr { /* from <net/route. h> */ u_short rtm_msglen; /* to skip over non-understood messages */ u_char rtm_version; /* future binary compatibility */ u_char rtm_type; /* message type */ u_short rtm_index; /* index for associated ifp */ int rtm_flags; /* flags, incl. kern & message, e. g. , DONE */ int rtm_addrs; /* bitmask identifying sockaddrs in msg */ pid_t rtm_pid; /* identify sender */ int rtm_seq; /* for sender to identify action */ int rtm_errno; /* why failed */ int rtm_use; /* from rtentry */ u_long rtm_inits; /* which metrics we are initializing */ struct rt_metrics rtm_rmx; /* metrics themselves */ };

Reading and Writing five structures returned with routing messages. • struct if_msghdr { /*

Reading and Writing five structures returned with routing messages. • struct if_msghdr { /* from <net/if. h> */ • u_short ifm_msglen; /* to skip over non-understood messages */ • u_char ifm_version; /* future binary compatibility */ • u_char ifm_type; /* message type */ • int ifm_addrs; /* like rtm_addrs */ • int ifm_flags; /* value of if_flags */ • u_short ifm_index; /* index for associated ifp */ • struct if_data ifm_data; /* statistics and other data about if */ • };

Reading and Writing five structures returned with routing messages. • struct ifa_msghdr { /*

Reading and Writing five structures returned with routing messages. • struct ifa_msghdr { /* from <net/if. h> */ • u_short ifam_msglen; /* to skip over non-understood messages */ • u_char ifam_version; /* future binary compatibility */ • u_char ifam_type; /* message type */ • int ifam_addrs; /* like rtm_addrs */ • int ifam_flags; /* value of ifa_flags */ • u_short ifam_index; /* index for associated ifp */ • int ifam_metric; /* value of ifa_metric */ • };

Reading and Writing five structures returned with routing messages. • struct ifma_msghdr { /*

Reading and Writing five structures returned with routing messages. • struct ifma_msghdr { /* from <net/if. h> */ • u_short ifmam_msglen; /* to skip over nonunderstood messages */ • u_char ifmam_version; /* future binary compatibility */ • u_char ifmam_type; /* message type */ • int ifmam_addrs; /* like rtm_addrs */ • int ifmam_flags; /* value of ifa_flags */ • u_short ifmam_index; /* index for associated ifp */ • };

Reading and Writing five structures returned with routing messages. • struct if_announcemsghdr { /*

Reading and Writing five structures returned with routing messages. • struct if_announcemsghdr { /* from <net/if. h> */ • u_short ifan_msglen; /* to skip over non-understood messages */ • u_char ifan_version; /* future binary compatibility */ • u_char ifan_type; /* message type */ • u_short ifan_index; /* index for associated ifp */ • char ifan_name[IFNAMSIZ]; /* if name, e. g. "en 0" */ • u_short ifan_what; /* what type of announcement */ • };

Reading and Writing • The first three members of each structure are the same:

Reading and Writing • The first three members of each structure are the same: Length, Version, and Type of Message • The type is one of the constans from the first column atau tabel sebelumnya. • The length member allows an application to skip over message types it does not understand

Reading and Writing • The members rtm_addrs, ifam_addrs, and ifmam_addrs are bitmask that specify

Reading and Writing • The members rtm_addrs, ifam_addrs, and ifmam_addrs are bitmask that specify which of eight possible socket address structures follow the messages • Next table shows the constants and values for each bitmask, whick are defined by including the <net/route. h> header

Reading and Writing • Constants used to refer to socket address structures in routing

Reading and Writing • Constants used to refer to socket address structures in routing messages

Reading and Writing • When multiple socket address structures are present, they are always

Reading and Writing • When multiple socket address structures are present, they are always in the order shown in he table

Reading and Writing • Example: Fetch and Print a Routing Table Entry • We

Reading and Writing • Example: Fetch and Print a Routing Table Entry • We now show an example using routing sockets. Our program takes a command-line argument consisting of an IPv 4 dotted-decimal addres and sends an RTM_GET message to the kernel for this address. • The kernel looks up the address in its IPv 4 routing table and returns an RTM_GET message with information about the routing table entry

Reading and Writing • For Example, if we execute: On our host freebsd, we

Reading and Writing • For Example, if we execute: On our host freebsd, we see that this destination address uses the default route (which is stored in the routing table with a destination IP address of 0. 0 and a mask of 0. 0) The next-hop router is this system’s gateaway to the Internet. If we execute

Reading and Writing • Specifying the xeondary Ethernet as the destination, the destination is

Reading and Writing • Specifying the xeondary Ethernet as the destination, the destination is the network itself. • The gateaway is now the outgoing interface, returned as a sockaddr_dl structure with an interface index of 2. • Before showing the source code, we show what we write to the routing socket in Data exchanged with kernel across routing socket for RTM_GET command along with what is returned by the kernel

Reading and Writing

Reading and Writing

Reading and Writing • We build a buffer containing an rt_msghdr structure, followed by

Reading and Writing • We build a buffer containing an rt_msghdr structure, followed by a socket address structure containing the destination address for the kernel to look up. • The rtm_type is RTM_GET and the rtm_addrs is RTA_DST (left pic), indicating that the only socket address structure following the rt_msghdr structure is one containing the destination address.

Reading and Writing • This command can be used with any protocol family (that

Reading and Writing • This command can be used with any protocol family (that provides a routing table), because the family of the address to look up is contained in the socket address structure. • After sending the message to the kernel we read back the reply, and it has the format shown at the roght of (right pic). • An rt_msghdr structure followed by up to four socket address structures

Reading and Writing • Shows the first part of our program • First half

Reading and Writing • Shows the first part of our program • First half of program to issue RTM_GET command on routing socket

Reading and Writing • route/getrt. c • 1 #include "unproute. h“ • 2 #define

Reading and Writing • route/getrt. c • 1 #include "unproute. h“ • 2 #define BUFLEN (sizeof(struct rt_msghdr) + 512) • 3 /* sizeof(struct sockaddr_in 6) * 8 = 192 */ • 4 #define SEQ 9999

Reading and Writing • • • 5 int 6 main(int argc, char **argv) 7{

Reading and Writing • • • 5 int 6 main(int argc, char **argv) 7{ 8 int sockfd; 9 char *buf; 10 pid_t pid; 11 ssize_t n; 12 struct rt_msghdr *rtm; 13 struct sockaddr *sa, *rti_info[RTAX_MAX]; 14 struct sockaddr_in *sin;

Reading and Writing • 19 rtm = (struct rt_msghdr *) buf; • 20 rtm->rtm_msglen

Reading and Writing • 19 rtm = (struct rt_msghdr *) buf; • 20 rtm->rtm_msglen = sizeof(struct rt_msghdr) + sizeof(struct sockaddr_in); • 21 rtm->rtm_version = RTM_VERSION; • 22 rtm->rtm_type = RTM_GET; • 23 rtm->rtm_addrs = RTA_DST; • 24 rtm->rtm_pid = getpid(); • 25 rtm->rtm_seq = SEQ;

Reading and Writing • • 26 27 28 29 • 30 sin = (struct

Reading and Writing • • 26 27 28 29 • 30 sin = (struct sockaddr_in *) (rtm + 1); sin->sin_len = sizeof(struct sockaddr_in); sin->sin_family = AF_INET; Inet_pton(AF_INET, argv[1], &sin->sin_addr); Write(sockfd, rtm->rtm_msglen)

Reading and Writing • 31 do { • 32 n = Read(sockfd, rtm, BUFLEN);

Reading and Writing • 31 do { • 32 n = Read(sockfd, rtm, BUFLEN); • 33 } while (rtm->rtm_type != RTM_GET || rtm>rtm_seq != SEQ || • 34 rtm->rtm_pid != pid);

Reading and Writing • 1– 3 Our unproute. h header includes some files that

Reading and Writing • 1– 3 Our unproute. h header includes some files that are needed and then includes our unp. h file. The constant BUFLEN is the size of the buffer that we allocate to hold our message to the kernel, along with the kernel's reply. We need room for one rt_msghdr structure and possibly eight socket address structures (the maximum number that is ever returned on a routing socket). Since an IPv 6 socket address structure is 28 bytes in size, the value of 512 is more than adequate.

Reading and Writing • Create routing socket • 17 We create a raw socket

Reading and Writing • Create routing socket • 17 We create a raw socket in the AF_ROUTE domain, and as we said earlier, this may require superuser privileges. A buffer is allocated and initialized to 0.

Reading and Writing • Fill in rt_msghdr structure • 18– 25 We fill in

Reading and Writing • Fill in rt_msghdr structure • 18– 25 We fill in the structure with our request. We store our process ID and a sequence number of our choosing in the structure. We will compare these values in the responses that we read, looking for the correct reply.

Reading and Writing • Fill in Internet destination socket address structure with • 26–

Reading and Writing • Fill in Internet destination socket address structure with • 26– 29 Following the rt_msghdr structure, we build a sockaddr_in structure containing the destination IPv 4 address for the kernel to look up in its routing table. All we set are the address length, the address family, and the address.

Reading and Writing • write message to kernel and read reply • 30– 34

Reading and Writing • write message to kernel and read reply • 30– 34 We write the message to the kernel and read back the reply. Since other processes may have routing sockets open, and since the kernel passes a copy of all routing messages to all routing sockets, we must check the message type, sequence number, and process ID to verify that the message received is the one we are waiting for.

Reading and Writing • See you next week

Reading and Writing • See you next week

Sumber http: //www. masterraghu. com/subjects/np/introduction/unix_network_programming_ v 1. 3/ch 18 lev 1 sec 1. html

Sumber http: //www. masterraghu. com/subjects/np/introduction/unix_network_programming_ v 1. 3/ch 18 lev 1 sec 1. html http: //www. masterraghu. com/subjects/np/introduction/unix_network_programming_ v 1. 3/ch 18 lev 1 sec 2. html#ch 18 fig 01 http: //www. masterraghu. com/subjects/np/introduction/unix_network_programming_ v 1. 3/ch 18 lev 1 sec 3. html STMIK AKBA – Suraydi Syamsu : Konsep Routing http: //muhammadhasansadali. blogspot. com/2013/02/membentuk-routing-table. html

Thank You … End Of File

Thank You … End Of File