Selasa, 15 Oktober 2013

Konfigurasi IP Alias & Router pada OS Debian

Setelah berhasil menginstal debian. Selanjutnya kita akan mengkonfigurasi Router. Silahkan ikuti langkah berikut :


* Kata2 yang bercetak tebal adalah perintah yang dijalankan pada komputer server.
* Kata2 yang berwarna merah adalah yang harus anda ubah atau buat.

1) pico  /etc/network/interfaces
                   # The primary network interface
                  allow-hotplug eth0
                  iface eth0 inet static
                  address 192.168.1.5
                  netmask 255.255.255.0
                  network 192.168.1.0
                  broadcast 192.168.1.255
                  gateway 192.168.1.1
                  # dns-* options are implemented by the resolvconf package, if installed
                  dns-nameservers 192.168.1.1
                  dns-search smkn1nganjuk.sch.id

                  # The local alias network interface ( Perintah untuk menambahkan ip alias )
                  auto eth0:1
                  iface eth0:1 inet static
                  address 192.168.1.6
                  netmask 255.255.255.0

                  auto eth0:2
                  iface eth0:2 inet static
                  address 192.168.1.7
                  netmask 255.255.255.0

                  # The secondary network interface  ( Perintah untuk menambahkan ip secondary )
                  auto eth1
                  iface eth1 inet static
                  address                   192.168.5.1
                  netmask                  255.255.255.0
                  network                  192.168.5.0
                  broadcast                192.168.5.255

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 ( tambahkan script ini )
iptables-restore < /etc/network/iptables.conf ( jangan dihapus,ini file defaultnya )


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.5 Bcast:192.192.168.1.255 Mask:255.255.255.0
                 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:192.168.5.1 Bcast:192.168.5.255Mask:255.255.255.0
                 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                   : 192.168.5.2
                 Subnet Mask                : 255.255.255.0
                 Default Gateway           : 192.168.5.1
                 Preferred DNS Server  : 192.168.5.1

14) Setelah settingan diubah, Bukalah Command Prompt computer client dan cek koneksi ke server.


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






C:\Users\tkj>ping 192.168.1.5
Pinging 192.168.1.5 with 32 bytes of data:
Reply from 192.168.1.5: bytes=32 time=1ms TTL=64
Reply from 192.168.1.5: bytes=32 time<1ms TTL=64
Reply from 192.168.1.5: bytes=32 time<1ms TTL=64
Reply from 192.168.1.5: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.1.5:
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.


Tidak ada komentar:

Posting Komentar