CLI konfigurasi¶
Prompt user@host#, didahului [edit] (dan (uncommitted) kalau ada perubahan). Hanya kelas super-user yang bisa masuk mode ini.
| Perintah | Fungsi |
|---|---|
set <path> [nilai] |
Tambah/ubah konfigurasi di candidate |
delete <path> [nilai] |
Hapus node, atau satu nilai dari daftar |
show [path] |
Tampilkan candidate (seluruhnya atau satu bagian) |
show [path] \| display set |
Candidate sebagai perintah set |
show [path] \| compare |
Beda candidate dengan running, per blok [edit …] (+ / -). compare saja sama artinya |
show [path] \| compare rollback N |
Beda candidate dengan commit ke-N |
commit [comment TEKS] |
Validasi lalu terapkan. Kalau gagal, otomatis dikembalikan |
discard |
Buang perubahan yang belum di-commit |
save |
Simpan running ke /config/config.boot |
load <file> |
Muat file ke candidate (relatif ke /config, atau path absolut) |
rollback [N] |
Muat commit ke-N ke candidate (tanpa N: tampilkan daftar) |
run <perintah> |
Jalankan perintah operasional |
exit |
Keluar (ditolak kalau ada perubahan yang belum di-commit) |
exit discard |
Keluar dan buang perubahan |
set¶
admin@r1# set interfaces eth1 unit 0 family inet address 10.0.12.1/30
admin@r1# set int eth1 desc "link ke R2" # singkatan kata kunci
admin@r1# set interfaces eth1 unit 100 # cukup membuat node
- Nilai yang berisi spasi diberi tanda kutip.
- Node yang menerima banyak nilai (
address,name-server,next-hop, …) menambahkan nilai baru; nilai lama tetap. - Node bernilai tunggal (
description,mtu, …) mengganti nilai lama. - Kesalahan tipe langsung ditolak:
admin@r1# set interfaces eth1 unit 0 family inet address 10.0.12.1
% '10.0.12.1' needs a prefix length, e.g. 10.0.0.1/24
admin@r1# set interfaces eth1 unit 0 family inet address 2001:db8::1/64
% '2001:db8::1/64' is not an IPv4 address (family inet)
admin@r1# set interfaces eth1 unit 100 vlan-id 5000
% 5000 is out of range 1-4094
delete¶
admin@r1# delete interfaces eth1 unit 0 family inet address 10.0.12.1/30 # satu nilai
admin@r1# delete interfaces eth1 unit 100 # satu node
admin@r1# delete protocols # satu cabang
show | compare¶
Sebelum commit, lihat apa saja yang akan berubah:
admin@r1# show | compare
[edit system]
- host-name r1
+ host-name edge-01
[edit interfaces eth1]
+ mtu 9000
+ unit 100 {
+ vlan-id 100
+ mtu 1500
+ family inet {
+ address 10.100.0.1/30
+ }
+ }
[edit protocols static]
+ route 0.0.0.0/0 {
+ next-hop 103.10.20.1
+ }
- route 10.9.0.0/16 {
- next-hop 10.0.0.9
- }
[edit …]menunjukkan letak perubahan di pohon konfigurasi. Baris+ditambahkan,-dihapus. Nilai yang diganti tampil sebagai pasangan-lalu+.- Blok yang baru seluruhnya (atau dihapus seluruhnya) ditampilkan lengkap dengan isinya.
- Batasi ke satu bagian:
show interfaces eth1 | compare. - Bandingkan dengan commit lama:
show | compare rollback 3. - Batasi ke satu nilai juga bisa:
show system host-name | comparetetap ditampilkan di bawah[edit system]. show | comparetanpa output berarti tidak ada perubahan; perintahcomparemencetakNo changes between running and candidate configuration.run show configuration | comparemembandingkan running dengan dirinya sendiri (selalu kosong), sama seperti di mode operasional.
commit¶
admin@r1# commit comment "pindah uplink"
Applying configuration:
ip addr replace 103.10.20.2/30 dev eth1
write /etc/frr/frr.conf
/usr/lib/frr/frr-reload.py --reload /etc/frr/frr.conf
Kalau tidak ada perubahan: No configuration changes to commit.
Kalau gagal:
Commit failed, rolling back to the previous configuration...
% commit failed:
vppctl lcp create loop7 host-if lo0.7: lcp create: linux-cp pair creation failed (-11)
Password¶
set ... plaintext-password tanpa nilai meminta password dua kali, tanpa ditampilkan. Yang disimpan hanya hash-nya (encrypted-password). Lihat User & akses.