Lewati ke isi

Konfigurasi pertama

Contoh ini membuat router edge sederhana:

  • eth1: uplink ke ISP, alamat 103.10.20.2/30, gateway 103.10.20.1
  • eth2: LAN 192.168.10.1/24 dan VLAN 20 192.168.20.1/24
  • NAT masquerade supaya LAN bisa ke internet
   Internet ── ISP 103.10.20.1 ── eth1 [ROUTER] eth2 ── LAN 192.168.10.0/24
                                                  └─ eth2.20 VLAN 20 192.168.20.0/24

1. Masuk mode konfigurasi

admin@cidr> configure
[edit]
admin@cidr#

2. Hostname, DNS, dan zona waktu

admin@cidr# set system host-name edge-01
admin@cidr# set system name-server 1.1.1.1
admin@cidr# set system name-server 8.8.8.8
admin@cidr# set system time-zone Asia/Jakarta

3. Interface

admin@cidr# set interfaces eth1 description "uplink ISP"
admin@cidr# set interfaces eth1 unit 0 family inet address 103.10.20.2/30
admin@cidr# set interfaces eth2 description LAN
admin@cidr# set interfaces eth2 unit 0 family inet address 192.168.10.1/24
admin@cidr# set interfaces eth2 unit 20 vlan-id 20
admin@cidr# set interfaces eth2 unit 20 description "LAN tamu"
admin@cidr# set interfaces eth2 unit 20 family inet address 192.168.20.1/24

Alamat IP selalu berada di bawah unit. unit 0 adalah port itu sendiri (tanpa tag); unit lain dengan vlan-id menjadi VLAN 802.1Q (eth2.20). Untuk menggabungkan beberapa port dalam satu VLAN (seperti switch) dengan gateway irb, lihat Interface & VLAN.

4. Default route dan NAT

admin@cidr# set protocols static route 0.0.0.0/0 next-hop 103.10.20.1
admin@cidr# set nat masquerade interface eth1.0

5. Periksa, terapkan, simpan

admin@cidr# show | compare
[edit system]
+   host-name edge-01
+   name-server 1.1.1.1
...
[edit interfaces]
+   eth1 {
+       description "uplink ISP"
+       unit 0 {
+           family inet {
+               address 103.10.20.2/30
+           }
+       }
+   }
...
admin@cidr# commit comment "setup awal"
Applying configuration:
  ...
admin@cidr# save
Saved to /config/config.boot
admin@cidr# exit

commit tanpa save hilang setelah reboot

commit mengubah sistem yang sedang berjalan. save menulisnya ke /config/config.boot, yang dimuat saat boot.

6. Cek hasilnya

admin@edge-01> show interfaces
Interface      Admin/Link  MTU    Addresses                      Description
------------------------------------------------------------------------------
eth1           up/up       1500   103.10.20.2/30                 uplink ISP
eth2           up/up       1500   192.168.10.1/24                LAN
eth2.20        up/up       1500   192.168.20.1/24                LAN tamu

admin@edge-01> show ip route              # tabel routing (FRR)
admin@edge-01> show ip fib                # tabel forwarding di dalam VPP
admin@edge-01> show nat sessions          # sesi NAT aktif
admin@edge-01> ping 1.1.1.1 count 3

Hasil sebagai file

show configuration menampilkan konfigurasi yang tersimpan, dan show configuration | display set menampilkannya sebagai perintah:

system {
    host-name edge-01
    name-server 1.1.1.1
    name-server 8.8.8.8
    time-zone Asia/Jakarta
}
interfaces eth1 {
    description "uplink ISP"
    unit 0 {
        family inet {
            address 103.10.20.2/30
        }
    }
}
interfaces eth2 {
    description LAN
    unit 0 {
        family inet {
            address 192.168.10.1/24
        }
    }
    unit 20 {
        description "LAN tamu"
        vlan-id 20
        family inet {
            address 192.168.20.1/24
        }
    }
}
protocols {
    static {
        route 0.0.0.0/0 {
            next-hop 103.10.20.1
        }
    }
}
nat {
    masquerade {
        interface eth1.0
    }
}
set system host-name edge-01
set system name-server 1.1.1.1
set system name-server 8.8.8.8
set system time-zone Asia/Jakarta
set interfaces eth1 description "uplink ISP"
set interfaces eth1 unit 0 family inet address 103.10.20.2/30
set interfaces eth2 description LAN
set interfaces eth2 unit 0 family inet address 192.168.10.1/24
set interfaces eth2 unit 20 description "LAN tamu"
set interfaces eth2 unit 20 vlan-id 20
set interfaces eth2 unit 20 family inet address 192.168.20.1/24
set protocols static route 0.0.0.0/0 next-hop 103.10.20.1
set nat masquerade interface eth1.0

Output display set bisa langsung di-paste ke router lain dalam mode konfigurasi.

Selanjutnya