[Juniper] CẤU HÌNH VLAN, TRUNKING VÀ DHCP CHO SWITCH JUNIPER

Discussion in 'Tổng hợp' started by nguyenanhquan, Aug 16, 2023.

  1. nguyenanhquan

    nguyenanhquan New Member

    Thực hiện cấu hình theo topo mạng như sau:

    [​IMG]

    Cấu hình vlan, trunking để các PC ping được với nhau trong cùng vlan và khác vlan. Cấu hình cấp DHCP từ Switch Core tới các PC
    Ta tiến hành thực hiện như sau:

    Switch Core
    Trước hết, ta cần vào giao diện dòng lệnh mode configuration và đặt hostname/password:

    cli
    configure
    set system host-name SW_Core
    set system root-authentication plain-text-password
    quan123
    quan123
    commit


    Sau đó, ta tạo các vlan là vlan 10: SaleRoomvlan 20: TechnicalRoom

    set vlans SaleRoom vlan-id 10
    set vlans TechnicalRoom vlan-id 20


    Cấu hình trunking cho các interfaces nối xuống 2 switch access và cho phép 2 vlan vừa tạo đi qua:

    set interfaces ge-0/0/1 unit 0 family ethernet-switching
    set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode trunk
    set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members SaleRoom
    set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members TechnicalRoom
    set interfaces ge-0/0/2 unit 0 family ethernet-switching
    set interfaces ge-0/0/2 unit 0 family ethernet-switching interface-mode trunk
    set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members SaleRoom
    set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members TechnicalRoom


    Cấu hình Interface irb để tạo default-gateway cho từng vlan:

    set interfaces irb unit 10 family inet
    set interfaces irb unit 10 family inet address 192.168.10.1/24
    set vlans SaleRoom l3-interface irb.10
    set interfaces irb unit 20 family inet
    set interfaces irb unit 20 family inet address 192.168.20.1/24
    set vlans TechnicalRoom l3-interface irb.20


    Cấu hình DHCP pool để cấp ip tự động cho các PC:

    set access address-assignment pool dhcp_vlan10 family inet
    set access address-assignment pool dhcp_vlan10 family inet network 192.168.10.0/24
    set access address-assignment pool dhcp_vlan10 family inet range dhcp_vlan10_range low 192.168.10.11 high 192.168.10.200
    set access address-assignment pool dhcp_vlan10 family inet dhcp-attributes router 192.168.10.1
    set system services dhcp-local-sever group dhcp_vlan10 interface irb.10
    set access address-assignment pool dhcp_vlan20 family inet
    set access address-assignment pool dhcp_vlan20 family inet network 192.168.20.0/24
    set access address-assignment pool dhcp_vlan20 family inet range dhcp_vlan20_range low 192.168.20.11 high 192.168.20.200
    set access address-assignment pool dhcp_vlan20 family inet dhcp-attributes router 192.168.20.1
    set system services dhcp-local-sever group dhcp_vlan20 interface irb.20
    commit


    Sau khi cấu hình xong Switch Core, ta dùng lệnh show configuration để check lại cấu hình:
    Về mục cấu hình Vlans – Trunking:


    interfaces {
    ge-0/0/1 {
    unit 0 {
    family ethernet-switching {
    interface-mode trunk;
    vlan {
    members [ SaleRoom TechnicalRoom ];
    }
    }
    }
    }
    ge-0/0/2 {
    unit 0 {
    family ethernet-switching {
    interface-mode trunk;
    vlan {
    members [ SaleRoom TechnicalRoom ];
    }
    }
    }
    }


    Về interface irb:

    irb {
    unit 10 {
    family inet {
    address 192.168.10.1/24;
    }
    }
    unit 20 {
    family inet {
    address 192.168.20.1/24;
    }
    }
    }
    vlans {
    SaleRoom {
    vlan-id 10;
    l3-interface irb.10;
    }
    TechnicalRoom {
    vlan-id 20;
    l3-interface irb.20;
    }
    }


    Về DHCP pool:


    access {
    address-assignment {
    pool dhcp_vlan10 {
    family inet {
    network 192.168.10.0/24;
    range dhcp_vlan10_range {
    low 192.168.10.11;
    high 192.168.10.200;
    }
    dhcp-attributes {
    router {
    192.168.10.1;
    }
    }
    }
    }
    pool dhcp_vlan20 {
    family inet {
    network 192.168.20.0/24;
    range dhcp_vlan20_range {
    low 192.168.20.11;
    high 192.168.20.200;
    }
    dhcp-attributes {
    router {
    192.168.20.1;
    }
    }
    }
    }
    }
    }


    Sau khi check đúng hết thông số đã cấu hình trên Switch Core, ta tiến hành cấu hình tới Switch Access
    Thực hiện cấu hình hostname/password và tạo các Vlans tương tự switch core. Cấu hình mode Access cho các interfaces nối xuống PC:


    set interfaces interface-range range_vlan10 member-range ge-0/0/4 to ge-0/0/6
    set interfaces interface-range range_vlan20 member-range ge-0/0/7 to ge-0/0/9
    set interfaces interface-range range_vlan10 unit 0 family ethernet-switching
    set interfaces interface-range range_vlan10 unit 0 family ethernet-switching interface-mode access
    set interfaces interface-range range_vlan10 unit 0 family ethernet-switching vlan members SaleRoom
    set interfaces interface-range range_vlan20 unit 0 family ethernet-switching
    set interfaces interface-range range_vlan20 unit 0 family ethernet-switching interface-mode access
    set interfaces interface-range range_vlan20 unit 0 family ethernet-switching vlan members TechnicalRoom


    Cấu hình trunking cho interfaces nối lên Switch Core:

    set interfaces ge-0/0/0 unit 0 family ethernet-switching
    set interfaces ge-0/0/0 unit 0 family ethernet-switchinginterface-mode trunk
    set interfaces ge-0/0/0 unit 0 family ethernet-switchingvlan members SaleRoom
    set interfaces ge-0/0/0 unit 0 family ethernet-switchingvlan members TechnicalRoom
    set interfaces ge-0/0/1 unit 0 family ethernet-switching
    set interfaces ge-0/0/1 unit 0 family ethernet-switchinginterface-mode trunk
    set interfaces ge-0/0/1 unit 0 family ethernet-switchingvlan members SaleRoom
    set interfaces ge-0/0/1 unit 0 family ethernet-switchingvlan members TechnicalRoom
    commit


    Ta check lại cấu hình của Switch Access:
    Về phần port access các vlans:


    interfaces {
    interface-range range_vlan10 {
    member-range ge-0/0/4 to ge-0/0/6;
    unit 0 {
    family ethernet-switching {
    interface-mode access;
    vlan {
    members SaleRoom;
    }
    }
    }
    }
    interface-range range_vlan20 {
    member-range ge-0/0/7 to ge-0/0/9;
    unit 0 {
    family ethernet-switching {
    interface-mode access;
    vlan {
    members TechnicalRoom;
    }
    }
    }
    }


    Về phần trunking:

    ge-0/0/0 {
    unit 0 {
    family ethernet-switching {
    interface-mode trunk;
    vlan {
    members [ SaleRoom TechnicalRoom ];
    }
    }
    }
    }
    ge-0/0/1 {
    unit 0 {
    family ethernet-switching {
    interface-mode trunk;
    vlan {
    members [ SaleRoom TechnicalRoom ];
    }
    }
    }
    }


    Như vậy, ta đã cấu hình thành công. Tiến hành test thì các PC nhận được ip từ Switch Juniper Core thành công và ping được các máy PC khác trong hệ thống mạng.

    [​IMG]
     

Share This Page