Konfigurasi IP Address di Debian 8

Sebelum konfigurasi IP address kita lihat terlebih dahulu interface yang terpasang di sistem.

$ su
# ifconfig | grep eth

Hasilnya adalah:

eth0      Link encap:Ethernet  HWaddr 08:00:27:6e:b7:a0

Disini saya memiliki satu interface yang aktif bernama eth0.

Jika kita telah memasang ethernet namun belum terbaca di sistem, gunakan perintah berikut untuk melihat ethernet yang terpasang.

# ifconfig -a

Untuk mengaktifkan interface.

# ifup eth0

Untuk menonaktifkan interface.

#ifdown eth0

Memberi IP Address

Untuk memberi ip address pada interface yang telah terpasang ikuti langkah-langkah berikut:

  1. Buka file /etc/network/interfaces.
  2. # nano /etc/network/interfaces

    Kemudian edit pada bagian berikut:

    # The primary network interface
    #allow-hotplug eth0
    auto eth0
    iface eth0 inet static
            address 192.168.4.2
            netmask 255.255.255.248
            network 192.168.0.0
            broadcast 192.168.4.7
            gateway 192.168.4.1
            dns-nameserver 202.10.200.2
            dns-search kita.com

    Keterangan:

    address : IP Address
    netmask : Subnet mask
    network : IP Network
    broadcast : IP Broadcast
    gateway : Alamat IP Gateway
    dns-nameserver : Alamat IP DNS server
    dns-search : DNS server
  3. Kemudian restart network.
  4. # service networking restart

    Jika berhasil tidak akan muncul pesan apa-apa.

    atau restart dengan perintah.

    # /etc/init.d/networking restart

    Jika berhasil muncul pesan.

    [ ok ] Restarting networking (via systemctl): networking.service.
  5. Setelah itu cek ip dengan perintah:
  6. # ifconfig

    Hasilnya adalah:

    eth0      Link encap:Ethernet  HWaddr 08:00:27:6e:b7:a0  
              inet addr:192.168.4.2  Bcast:192.168.4.7  Mask:255.255.255.248
              inet6 addr: fe80::a00:27ff:fe6e:b7a0/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:736 errors:0 dropped:0 overruns:0 frame:0
              TX packets:516 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:68328 (66.7 KiB)  TX bytes:64294 (62.7 KiB)
    
    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:65536  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:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    Coba ping ke ip 192.168.4.2

    ping 192.168.4.2

    Jika hasilnya seperti dibawah berarti ip telah berhasil dikonfigurasi.

    PING 192.168.4.2 (192.168.4.2) 56(84) bytes of data.
    64 bytes from 192.168.4.2: icmp_seq=1 ttl=64 time=0.051 ms
    64 bytes from 192.168.4.2: icmp_seq=2 ttl=64 time=0.078 ms
    64 bytes from 192.168.4.2: icmp_seq=3 ttl=64 time=0.063 ms
    64 bytes from 192.168.4.2: icmp_seq=4 ttl=64 time=0.043 ms
    ^C
    --- 192.168.4.2 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3004ms
    rtt min/avg/max/mdev = 0.043/0.058/0.078/0.016 ms

    Tekan ctrl+C untuk stop.

Comments

Popular posts from this blog

Mengatasi Error: dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) pada Ubuntu

Konfigurasi DHCP Server pada Debian 8 Server