Jump to content

Perintah Dasar Cisco IOS

From Haidhi Wiki

Halaman ini adalah referensi cepat perintah dasar Cisco IOS yang paling sering dipakai, dikelompokkan per fungsi. Setiap perintah disertai keterangan dan contoh. Untuk konsep mode CLI, penyimpanan konfigurasi, dan metode koneksi, lihat halaman Cisco IOS.

Konvensi prompt: > = User Exec, # = Privileged Exec, (config)# = Global Configuration, (config-if)# = Interface Configuration.

Navigasi mode

Berpindah antar mode CLI
Perintah Fungsi Contoh
enable Masuk Privileged Exec Router> enable
disable Turun ke User Exec Router# disable
configure terminal Masuk Global Configuration Router# configure terminal
interface X Masuk Interface Configuration Router(config)# interface GigabitEthernet0/0
line X Masuk Line Configuration Router(config)# line console 0
exit Turun satu level Router(config-if)# exit
end (Ctrl-Z) Kembali ke Privileged Exec dari mana pun Router(config-if)# end

Identitas dan keamanan dasar

Konfigurasi dasar perangkat
Perintah Fungsi Contoh
hostname NAMA Mengatur nama perangkat Router(config)# hostname R1
enable secret PASS Password Privileged Exec (terenkripsi, disarankan) R1(config)# enable secret RahasiaKuat
enable password PASS Password Privileged Exec (plaintext, tidak disarankan) R1(config)# enable password lemah
service password-encryption Mengenkripsi password yang tampil di config R1(config)# service password-encryption
username X secret Y Membuat akun pengguna lokal R1(config)# username admin secret PassAdmin
banner motd #teks# Pesan saat login (message of the day) R1(config)# banner motd #Akses khusus yang berwenang#
no perintah Membatalkan/menghapus konfigurasi apa pun R1(config)# no hostname

Catatan: hampir semua perintah konfigurasi bisa dibatalkan dengan menambahkan awalan no di depannya.

Konfigurasi line (console dan VTY)

Line menentukan cara pengguna mengakses CLI: console untuk koneksi fisik, vty untuk sesi jaringan (Telnet/SSH).

Perintah line
Perintah Fungsi Contoh
line console 0 Konfigurasi port console R1(config)# line console 0
line vty 0 4 Konfigurasi 5 sesi VTY (0–4) R1(config)# line vty 0 4
password PASS Password untuk line tersebut R1(config-line)# password PassLine
login Minta password line saat masuk R1(config-line)# login
login local Autentikasi pakai akun lokal (username/secret) R1(config-line)# login local
transport input ssh Batasi VTY hanya menerima SSH R1(config-line)# transport input ssh
exec-timeout m s Timeout idle (menit detik); 0 0 = tak terbatas R1(config-line)# exec-timeout 5 0
logging synchronous Mencegah pesan log memotong ketikan R1(config-line)# logging synchronous

Konfigurasi interface

Perintah interface
Perintah Fungsi Contoh
ip address IP MASK Menetapkan IP address R1(config-if)# ip address 192.168.1.1 255.255.255.0
no shutdown Mengaktifkan interface (wajib!) R1(config-if)# no shutdown
shutdown Menonaktifkan interface R1(config-if)# shutdown
description TEKS Memberi label interface R1(config-if)# description Uplink ke core
switchport mode access (Switch) Set port sebagai access port SW1(config-if)# switchport mode access
switchport access vlan N (Switch) Menaruh port di VLAN tertentu SW1(config-if)# switchport access vlan 10

Catatan penting: interface baru biasanya dalam keadaan administratively down. Jangan lupa no shutdown — ini kesalahan paling umum saat interface "sudah dikonfigurasi tapi tidak jalan".

Perintah show (paling sering dipakai)

Memeriksa status dan konfigurasi
Perintah Fungsi
show running-config Konfigurasi yang sedang aktif (RAM)
show startup-config Konfigurasi tersimpan (NVRAM)
show ip interface brief Ringkasan IP + status semua interface (sangat sering)
show interfaces Detail lengkap interface (error, counter, dll)
show version Versi IOS, uptime, model, config register
show ip route Tabel routing
show arp Tabel ARP (IP ↔ MAC)
show mac address-table (Switch) Tabel MAC
show vlan brief (Switch) Daftar VLAN
show cdp neighbors Perangkat Cisco yang terhubung langsung
show flash Isi memori Flash

Tip: tambahkan pipe untuk menyaring, mis. show running-config | section interface atau show ip interface brief | include up.

Konektivitas dan troubleshooting

Pengujian jaringan
Perintah Fungsi Contoh
ping IP Uji reachability R1# ping 192.168.1.1
traceroute IP Jejak rute per hop R1# traceroute 8.8.8.8
ssh -l user IP Konek SSH ke perangkat lain R1# ssh -l admin 192.168.1.2
show cdp neighbors detail Info detail tetangga (IP, platform, IOS) R1# show cdp neighbors detail

Manajemen konfigurasi

Menyimpan, menghapus, dan memulai ulang
Perintah Fungsi Contoh
copy running-config startup-config Simpan config agar persisten R1# copy running-config startup-config
write memory / wr Bentuk singkat dari menyimpan config R1# wr
erase startup-config Hapus startup-config (factory reset) R1# erase startup-config
reload Mulai ulang perangkat R1# reload
copy running-config tftp Backup config ke server TFTP R1# copy running-config tftp

Ingat: perubahan langsung aktif di RAM tetapi hilang saat reboot jika belum disimpan dengan copy run start.

Contoh alur: konfigurasi interface

R1# configure terminal
R1(config)# interface GigabitEthernet0/0
R1(config-if)# description Link ke LAN
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# end
R1# copy running-config startup-config

Verifikasi hasilnya:

R1# show ip interface brief
R1# ping 192.168.1.10

Contoh alur: setup akses SSH dasar

R1(config)# hostname R1
R1(config)# ip domain-name lab.local
R1(config)# crypto key generate rsa modulus 2048
R1(config)# username admin secret PassAdmin
R1(config)# enable secret PassEnable
R1(config)# line vty 0 4
R1(config-line)# login local
R1(config-line)# transport input ssh
R1(config-line)# exit
R1(config)# end
R1# copy running-config startup-config

Setelah ini, perangkat bisa diakses via SSH menggunakan akun admin. Telnet otomatis tertolak karena VTY dibatasi hanya ssh. Konsep AAA (autentikasi tersentralisasi) merupakan kelanjutan dari pendekatan akun lokal ini.

Lihat pula

Pranala luar