Hướng dẫn cấu hình Firewall Filters cho lưu lượng Port, VLAN và Router trên Switch dòng EX Series

Hướng dẫn cấu hình Firewall Filters cho lưu lượng Port, VLAN và Router trên Switch dòng EX Series

Ví dụ này minh họa cách cấu hình và áp dụng các bộ lọc firewall (firewall filters) nhằm kiểm soát lưu lượng vào (ingress) hoặc ra (egress) tại các điểm sau: cổng (port) trên switch, VLAN trong mạng, và giao diện Layer 3 trên switch. Các bộ lọc firewall định nghĩa các quy tắc quyết định việc cho phép (forward) hoặc từ chối (deny) gói tin tại các điểm xử lý cụ thể trong luồng gói tin.

Yêu cầu

Ví dụ này sử dụng các thành phần phần cứng và phần mềm sau:

  • Hệ điều hành Junos OS phiên bản 9.0 hoặc cao hơn dành cho switch dòng EX Series.
  • Hai switch Juniper Networks EX3200-48T: một thiết bị đóng vai trò switch truy cập (access switch), thiết bị còn lại làm switch phân phối (distribution switch).
  • Một module uplink Juniper Networks EX-UM-4SFP.
  • Một router Juniper Networks dòng J-series.

Trước khi cấu hình và áp dụng các firewall filters trong ví dụ này, bạn cần đảm bảo đã:

  • Có kiến thức về khái niệm firewall filter, các cơ chế giới hạn băng thông (policers), và phân loại dịch vụ (CoS - Class of Service).
  • Gắn module uplink vào switch phân phối. Tham khảo hướng dẫn "Installing an Uplink Module in an EX3200 Switch" để biết chi tiết cách lắp đặt.

Tổng quan

Ví dụ cấu hình này minh họa cách cấu hình và áp dụng các firewall filter để thiết lập các quy tắc nhằm đánh giá nội dung của các gói tin, từ đó quyết định khi nào nên loại bỏ (discard), chuyển tiếp (forward), phân loại (classify), đếm (count), hoặc phân tích (analyze) các gói tin được gửi đến hoặc xuất phát từ các switch dòng EX Series. Các switch này chịu trách nhiệm xử lý toàn bộ lưu lượng mạng của các VLAN: voice-vlan, employee-vlan, và guest-vlan. Bảng 1 dưới đây liệt kê các firewall filter được cấu hình cho các switch EX Series trong ví dụ này.

Bảng 1: Thành phần cấu hình Firewall Filters

Thành phầnMục đích/Mô tả
Firewall filter ở cổng – ingress-port-voip-class-limit-tcp-icmpBộ lọc firewall này thực hiện hai chức năng: - Gán hàng đợi ưu tiên (priority queueing) cho các gói tin có địa chỉ MAC nguồn trùng với địa chỉ MAC của điện thoại IP. Lớp chuyển tiếp expedited-forwarding đảm bảo mức mất mát thấp, độ trễ thấp, độ dao động thấp (jitter), băng thông được đảm bảo, và dịch vụ đầu-cuối cho toàn bộ lưu lượng trên voice-vlan. - Thực hiện giới hạn tốc độ (rate limiting) đối với các gói tin đi vào cổng dành cho employee-vlan. Tốc độ lưu lượng TCP và ICMP bị giới hạn ở mức 1 Mbps, với kích thước burst tối đa là 30.000 byte. → Firewall filter này được áp dụng tại các giao diện cổng trên switch truy cập.
Firewall filter trên VLAN – ingress-vlan-rogue-blockNgăn chặn các thiết bị rogue (thiết bị không hợp lệ) sử dụng phiên HTTP để giả mạo thiết bị gatekeeper – thiết bị chịu trách nhiệm đăng ký cuộc gọi, xác nhận, và trạng thái cuộc gọi trong hệ thống VoIP. Chỉ các cổng TCP hoặc UDP mới được phép sử dụng, và chỉ riêng thiết bị gatekeeper được phép sử dụng giao thức HTTP. Nói cách khác, tất cả lưu lượng voice-vlan sử dụng cổng TCP phải được gửi đến thiết bị gatekeeper. → Firewall filter này được áp dụng tại giao diện VLAN trên switch truy cập, bao gồm cả lưu lượng liên lạc giữa các điện thoại trong cùng VLAN và giữa điện thoại với thiết bị gatekeeper.
Firewall filter trên VLAN – egress-vlan-watch-employeeChấp nhận lưu lượng từ employee-vlan đi đến subnet nội bộ (corporate subnet), nhưng không giám sát luồng dữ liệu này. Tuy nhiên, lưu lượng từ employee đi ra Web sẽ được đếm và phân tích. → Firewall filter này được áp dụng tại giao diện VLAN trên switch truy cập.
Firewall filter trên VLAN – ingress-vlan-limit-guestNgăn chặn người dùng khách (guest - không phải nhân viên) giao tiếp với nhân viên hoặc các host thuộc employee-vlan. Đồng thời ngăn khách sử dụng các ứng dụng peer-to-peer trên guest-vlan, nhưng vẫn cho phép truy cập Web. → Firewall filter này được áp dụng tại giao diện VLAN trên switch truy cập.
Firewall filter trên router – egress-router-corp-classƯu tiên lưu lượng từ employee-vlan, gán mức ưu tiên cao nhất trong lớp chuyển tiếp (forwarding-class) cho lưu lượng của nhân viên hướng đến subnet nội bộ (corporate subnet). → Firewall filter này được áp dụng trên cổng định tuyến (uplink Layer 3) của switch phân phối.

Hình 1 minh họa cách áp dụng các firewall filter tại các lớp: cổng (Port), VLAN, và giao diện định tuyến Layer 3 trên switch.

Hình 1: Cách áp dụng Firewall Filter tại Cổng, VLAN và Giao diện Định tuyến Layer 3

Topo Mạng

Tô-pô mạng trong ví dụ cấu hình này bao gồm một switch EX-3200-48T tại lớp truy cập (access layer) và một switch EX-3200-48T tại lớp phân phối (distribution layer). Module uplink của switch phân phối được cấu hình để hỗ trợ kết nối Layer 3 với một router dòng J-series.

Các switch dòng EX được cấu hình để hỗ trợ thành viên VLAN (VLAN membership). Bảng 2 bên dưới liệt kê các thành phần cấu hình VLAN cho các VLAN sử dụng trong mạng.

Bảng 2: Thành phần cấu hình VLANs

Tên VLANVLAN IDDải mạng VLAN và địa chỉ IP khả dụngMô tả VLAN
voice-vlan10192.0.2.0/28Địa chỉ IP khả dụng: 192.0.2.1 đến 192.0.2.14Địa chỉ quảng bá (broadcast): 192.0.2.15VLAN thoại dành cho lưu lượng VoIP của nhân viên.
employee-vlan20192.0.2.16/28Địa chỉ IP khả dụng: 192.0.2.17 đến 192.0.2.30Địa chỉ quảng bá: 192.0.2.31VLAN cho máy tính cá nhân độc lập, máy tính kết nối qua hub tích hợp trong điện thoại VoIP, điểm truy cập không dây (WAP), và máy in. VLAN này bao gồm toàn bộ voice-vlan. Hai VLAN (voice-vlan và employee-vlan) phải được cấu hình trên các cổng kết nối đến điện thoại IP.
guest-vlan30192.0.2.32/28Địa chỉ IP khả dụng: 192.0.2.33 đến 192.0.2.46Địa chỉ quảng bá: 192.0.2.47VLAN dành cho thiết bị dữ liệu của khách (như máy tính cá nhân). Tình huống giả định rằng công ty có một khu vực mở cho khách (sảnh hoặc phòng họp), nơi có hub để khách cắm máy tính và truy cập Web hoặc kết nối vào VPN của công ty họ.
camera-vlan40192.0.2.48/28Địa chỉ IP khả dụng: 192.0.2.49 đến 192.0.2.62Địa chỉ quảng bá: 192.0.2.63VLAN dành cho hệ thống camera an ninh của doanh nghiệp.

Các cổng trên switch EX Series hỗ trợ Power over Ethernet (PoE), cho phép cung cấp cả kết nối mạng và nguồn điện cho các điện thoại VoIP được kết nối vào các cổng này. Bảng 3 liệt kê các cổng trên switch được gán vào các VLAN, cùng với địa chỉ IP và địa chỉ MAC của các thiết bị được kết nối vào các cổng đó:

Bảng 3: Thành phần cấu hình – Các cổng trên switch PoE 48 cổng

Switch và Số hiệu CổngThuộc VLANĐịa chỉ IP và MACThiết bị kết nối vào Cổng
ge-0/0/0, ge-0/0/1voice-vlan, employee-vlanIP: 192.0.2.1 đến 192.0.2.2MAC: 00.00.5E.00.53.01, 00.00.5E.00.53.02Hai điện thoại VoIP, mỗi điện thoại kết nối với một máy tính cá nhân.
ge-0/0/2, ge-0/0/3employee-vlanIP: 192.0.2.17 đến 192.0.2.18Một máy in và hai điểm truy cập không dây (WAP).
ge-0/0/4, ge-0/0/5guest-vlanIP: 192.0.2.34 đến 192.0.2.35Hai hub để khách có thể kết nối máy tính cá nhân. Các hub này đặt ở khu vực mở như sảnh lễ tân hoặc phòng họp.
ge-0/0/6, ge-0/0/7camera-vlanIP: 192.0.2.49 đến 192.0.2.50Hai camera an ninh.
ge-0/0/9voice-vlanIP: 192.0.2.14MAC: 00.05.5E.00.53.0EThiết bị Gatekeeper. Thiết bị này quản lý việc đăng ký cuộc gọi, cấp phép và trạng thái cuộc gọi cho điện thoại VoIP.
ge-0/1/0IP: 192.0.2.65Kết nối Layer 3 đến router (lưu ý: đây là cổng trên module uplink của switch).

Cấu hình bộ lọc firewall ở cổng đầu vào (Ingress Port Firewall Filter) để ưu tiên lưu lượng thoại và giới hạn tốc độ lưu lượng TCP và ICMP

Để cấu hình và áp dụng các bộ lọc firewall cho cổng, VLAN, và các giao diện router, hãy thực hiện các bước sau:

Quy trình thực hiện

Cấu hình nhanh qua CLI (CLI Quick Configuration)

Để cấu hình nhanh và áp dụng bộ lọc firewall tại cổng nhằm ưu tiên lưu lượng thoại và giới hạn tốc độ các gói tin TCP và ICMP hướng đến subnet của VLAN nhân viên (employee-vlan), hãy sao chép và dán các lệnh sau vào cửa sổ terminal của switch:

[edit]

                         set firewall policer tcp-connection-policer if-exceeding burst-size-limit 30k bandwidth-limit 1m                    

                         set firewall policer tcp-connection-policer then discard                    

                         set firewall policer icmp-connection-policer if-exceeding burst-size-limit 30k bandwidth-limit 1m                      

                         set firewall policer icmp-connection-policer then discard                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term voip-high from source-mac-address 00.00.5E.00.53.01                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term voip-high from source-mac-address 00.00.5E.00.53.02                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term voip-high from protocol udp                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term voip-high then forwarding-class expedited-forwarding                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term voip-high then loss-priority low                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term network-control from precedence net-control                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term network-control then forwarding-class network-control                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term network-control then loss-priority low                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term tcp-connection from destination-address 192.0.2.16/28                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term tcp-connection from protocol tcp                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term tcp-connection then policer tcp-connection-policer                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term tcp-connection then count tcp-counter                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term tcp-connection then forwarding-class best-effort                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term tcp-connection then loss-priority high                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term icmp-connection from destination-address 192.0.2.16/28                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term icmp-connection from protocol icmp                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term icmp-connection then policer icmp-connection-policer                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term icmp-connection then count icmp-counter                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term icmp-connection then forwarding-class best-effort                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term icmp-connection then loss-priority high                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term best-effort then forwarding-class best-effort                    

                         set firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp term best-effort then loss-priority high                    

                         set interfaces ge-0/0/0 description "voice priority and tcp and icmp traffic rate-limiting filter at ingress port"                    

                         set interfaces ge-0/0/0 unit 0 family ethernet-switching filter input ingress-port-voip-class-limit-tcp-icmp                    

                         set interfaces ge-0/0/1 description "voice priority and tcp and icmp traffic rate-limiting filter at ingress port"                    

                         set interfaces ge-0/0/1 unit 0 family ethernet-switching filter input ingress-port-voip-class-limit-tcp-icmp                    

                         set class-of-service schedulers voice-high buffer-size percent 15                    

                         set class-of-service schedulers voice-high  priority high                    

                         set class-of-service schedulers net-control buffer-size percent 10                    

                         set class-of-service schedulers net-control priority high                    

                         set class-of-service schedulers best-effort buffer-size percent 75                    

                         set class-of-service schedulers best-effort priority low                    

                         set class-of-service scheduler-maps ethernet-diffsrv-cos-map forwarding-class expedited-forwarding scheduler voice-high                    

                         set class-of-service scheduler-maps ethernet-diffsrv-cos-map forwarding-class network-control scheduler net-control                    

                         set class-of-service scheduler-maps ethernet-diffsrv-cos-map forwarding-class best-effort scheduler best-effort                    

Quy trình từng bước (Step-by-Step Procedure)

Để cấu hình và áp dụng bộ lọc firewall tại cổng nhằm ưu tiên lưu lượng thoại (voice traffic) và giới hạn tốc độ các gói tin TCP và ICMP đi đến subnet của VLAN nhân viên (employee-vlan):

  • Định nghĩa các policer với tên tcp-connection-policer và icmp-connection-policer:

[edit]

user@switch# set firewall policer tcp-connection-policer if-exceeding burst-size-limit 30k bandwidth-limit 1m

user@switch# set firewall policer tcp-connection-policer then discard

user@switch# set firewall policer icmp-connection-policer if-exceeding burst-size-limit 30k bandwidth-limit 1m

user@switch# set firewall policer icmp-connection-policer then discard                        

  • Định nghĩa bộ lọc firewall với tên ingress-port-voip-class-limit-tcp-icmp:

[edit firewall]

user@switch# set family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp                        

  • Định nghĩa term voip-high:

[edit firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp ]

user@switch# set term voip-high from source-mac-address 00.00.5E.00.53.01

user@switch# set term voip-high from source-mac-address 00.00.5E.00.53.02

user@switch# set term voip-high from protocol udp

user@switch# set term voip-high then forwarding-class expedited-forwarding

user@switch# set term voip-high then loss-priority low                        

  • Định nghĩa term network-control:

[edit firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp ]

user@switch# set term network-control from precedence net-control

user@switch# set term network-control then forwarding-class network-control

user@switch# set term network-control then loss-priority low                        

  • Định nghĩa term tcp-connection để cấu hình giới hạn tốc độ cho lưu lượng TCP.

[edit firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp]

user@switch# set term tcp-connection from destination-address 192.0.2.16/28

user@switch# set term tcp-connection from protocol tcp

user@switch# set term tcp-connection then policer tcp-connection-policer

user@switch# set term tcp-connection then count tcp-counter

user@switch# set term tcp-connection then forwarding-class best-effort

user@switch# set term tcp-connection then loss-priority high                        

  • Định nghĩa term icmp-connection để cấu hình giới hạn tốc độ cho lưu lượng ICMP.

[edit firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp]

user@switch# set term icmp-connection from destination-address 192.0.2.16/28

user@switch# set term icmp-connection from protocol icmp

user@switch# set term icmp-connection then policer icmp-policer

user@switch# set term icmp-connection then count icmp-counter

user@switch# set term icmp-connection then forwarding-class best-effort

user@switch# set term icmp-connection then loss-priority high                        

  • Định nghĩa term best-effort mà không có điều kiện match, để mặc định áp dụng cho tất cả các gói tin không khớp với bất kỳ term nào khác trong firewall filter.

[edit firewall family ethernet-switching filter ingress-port-voip-class-limit-tcp-icmp]

user@switch# set term best-effort then forwarding-class best-effort

user@switch# set term best-effort then loss-priority high                        

  • Áp dụng firewall filter ingress-port-voip-class-limit-tcp-icmp làm bộ lọc đầu vào (input filter) cho các cổng giao diện thuộc VLAN nhân viên (employee-vlan).

[edit interfaces]

user@switch# set ge-0/0/0 description "voice priority and tcp and icmp traffic rate-limiting filter at ingress port"

user@switch# set ge-0/0/0 unit 0 family ethernet-switching filter input ingress-port-voip-class-limit-tcp-icmp

user@switch# set ge-0/0/1 description "voice priority and tcp and icmp traffic rate-limiting filter at ingress port"

user@switch# set ge-0/0/1 unit 0 family ethernet-switching filter input ingress-port-voip-class-limit-tcp-icmp

  • Cấu hình các tham số mong muốn cho các scheduler khác nhau.

**Lưu ý: Khi cấu hình các tham số cho các scheduler, hãy xác định các giá trị sao cho phù hợp với mô hình lưu lượng mạng của bạn.

[edit class-of-service]

user@switch# set schedulers voice-high buffer-size percent 15

user@switch# set schedulers voice-high priority  high

user@switch# set schedulers network—control buffer-size percent 10

user@switch# set schedulers network—control priority high

user@switch# set schedulers best-effort buffer-size percent 75

user@switch# set schedulers best-effort priority low                        

  • Gán các lớp chuyển tiếp (forwarding classes) cho các scheduler bằng cách sử dụng một bảng ánh xạ scheduler (scheduler map).

[edit class-of-service]

user@switch# set scheduler-maps ethernet-diffsrv-cos-map

user@switch# set scheduler-maps ethernet-diffsrv-cos-map forwarding-class expedited-forwarding scheduler voice-high

user@switch# set scheduler-maps ethernet-diffsrv-cos-map forwarding-class network-control scheduler net-control

user@switch# set scheduler-maps ethernet-diffsrv-cos-map forwarding-class best-effort scheduler best-effort                        

  • Liên kết bảng ánh xạ scheduler với giao diện đầu ra (outgoing interface).

[edit class-of-service]

user@switch# set interfaces ge–0/1/0 scheduler-map ethernet-diffsrv-cos-map                        

Kết quả

Hiển thị kết quả của cấu hình.

user@switch# show                        

    firewall {

        policer tcp-connection-policer {

            if-exceeding {

                bandwidth-limit 1m;

                burst-size-limit 30k;}

            then {

                discard;}}

        policer icmp-connection-policer {

            if-exceeding {

                bandwidth-limit 1m;

                burst-size-limit 30k;}

            then {

                discard;}}

        family ethernet-switching {

            filter ingress-port-voip-class-limit-tcp-icmp {

                 term voip-high {

                    from {

                        destination-mac-address 00.00.5E.00.53.01;

                            destination-mac-address 00.00.5E.00.53.02;

                        protocol udp;}

                    then {

                        forwarding-class expedited-forwarding;

                        loss-priority low;}}

                term network-control {

                    from {

                        precedence net-control ;}

                    then {

                        forwarding-class network-control;

                        loss-priority low;}}

                term tcp-connection {

                    from {

                        destination-address 192.0.2.16/28;

                        protocol tcp;}

                    then {

                        policer tcp-connection-policer;

                            count tcp-counter;

                            forwarding-class best-effort;

                        loss-priority high;}}

                term icmp-connection

                    from {

                        protocol icmp;}

                    then {

                         policer icmp-connection-policer;

                            count icmp-counter;

                            forwarding-class best-effort;

                        loss-priority high;}}

                term best-effort {

                    then {

                        forwarding-class best-effort;

                        loss-priority high;}}}}}

    interfaces {

        ge-0/0/0 {

            description "voice priority and tcp and icmp traffic rate-limiting filter at ingress port";

            unit 0 {

                family ethernet-switching {

                    filter {

                        input ingress-port-voip-class-limit-tcp-icmp;}}}}

        ge-0/0/1 {

            description "voice priority and tcp and icmp traffic rate-limiting filter at ingress port";

                unit 0 {

                family ethernet-switching {

                    filter {

                        input ingress-port-voip-class-limit-tcp-icmp;}}}}}

    scheduler-maps {

        ethernet-diffsrv-cos-map {

            forwarding-class expedited-forwarding scheduler voice-high;

                forwarding-class network-control scheduler net-control;

            forwarding-class best-effort scheduler best-effort;}}

    interfaces {

        ge/0/1/0 {

            scheduler-map ethernet-diffsrv-cos-map;}}

Cấu hình bộ lọc firewall cổng đầu vào VLAN để ngăn chặn các thiết bị giả mạo làm gián đoạn lưu lượng VoIP

Để cấu hình và áp dụng các bộ lọc firewall cho cổng, VLAN, và các giao diện router, hãy thực hiện các bước sau:

Quy trình thực hiện

Cấu hình nhanh qua CLI (CLI Quick Configuration)

Để cấu hình nhanh bộ lọc firewall VLAN trên voice-vlan nhằm ngăn chặn các thiết bị giả mạo sử dụng các phiên HTTP để giả mạo thiết bị gatekeeper quản lý lưu lượng VoIP, sao chép các lệnh sau và dán chúng vào cửa sổ terminal của switch:

[edit]

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term to-gatekeeper from destination-address 192.0.2.14                    

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term to-gatekeeper from destination-port 80                    

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term to-gatekeeper then accept                    

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term from-gatekeeper from source-address 192.0.2.14                    

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term from-gatekeeper from source-port 80                    

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term from-gatekeeper then accept                    

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term not-gatekeeper from destination-port 80                    

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term not-gatekeeper then count rogue-counter                    

                         set firewall family ethernet-switching filter ingress-vlan-rogue-block term not-gatekeeper then discard                    

                         set vlans voice-vlan description "block rogue devices on voice-vlan"                    

                         set vlans voice-vlan filter input ingress-vlan-rogue-block                    

Quy trình từng bước (Step-by-Step Procedure)

Để cấu hình và áp dụng bộ lọc firewall VLAN trên voice-vlan nhằm ngăn chặn các thiết bị giả mạo sử dụng HTTP để giả mạo thiết bị gatekeeper quản lý lưu lượng VoIP:

  • Định nghĩa bộ lọc firewall ingress-vlan-rogue-block để chỉ định các điều kiện lọc cho lưu lượng bạn muốn cho phép và hạn chế:

[edit firewall]

user@switch# set family ethernet-switching filter ingress-vlan-rogue-block                        

  • Định nghĩa term to-gatekeeper để chấp nhận các gói tin khớp với địa chỉ IP đích của thiết bị gatekeeper.

[edit firewall family ethernet-switching filter ingress-vlan-rogue-block]

user@switch# set term to-gatekeeper from destination-address 192.0.2.14

user@switch# set term to-gatekeeper from destination-port 80

user@switch# set term to-gatekeeper then accept                        

  • Định nghĩa term from-gatekeeper để chấp nhận các gói tin khớp với địa chỉ IP nguồn của thiết bị gatekeeper.

[edit firewall family ethernet-switching filter ingress-vlan-rogue-block]

user@switch# set term from-gatekeeper from source-address 192.0.2.14

user@switch# set term from-gatekeeper from source-port 80

user@switch# set term from-gatekeeper then accept                        

  • Định nghĩa term not-gatekeeper để đảm bảo tất cả lưu lượng trên voice-vlan qua các cổng TCP đều hướng đến thiết bị gatekeeper.

[edit firewall family ethernet-switching filter ingress-vlan-rogue-block]

user@switch# set term not-gatekeeper from destination-port 80

user@switch# set term not-gatekeeper then count rogue-counter

user@switch# set term not-gatekeeper then discard                        

  • Áp dụng bộ lọc firewall ingress-vlan-rogue-block làm bộ lọc đầu vào (input filter) cho giao diện VLAN của các điện thoại VoIP.

[edit]

user@switch# set vlans voice-vlan description "block rogue devices on voice-vlan"

user@switch# set vlans voice-vlan filter input ingress-vlan-rogue-block                        

Kết quả

Hiển thị kết quả của cấu hình:

user@switch# show                        

    firewall {

        family ethernet-switching {

            filter ingress-vlan-rogue-block {

                term to-gatekeeper {

                    from {

                        destination-address 192.0.2.14/32

                        destination-port 80;}

                    then {

                        accept;}}

                term from-gatekeeper {

                    from {

                        source-address 192.0.2.14/32

                        source-port 80;}

                    then {

                        accept;}}

                term not-gatekeeper {

                    from {

                        destination-port 80;}

                    then {

                        count rogue-counter;

                        discard;}}}

    vlans {

        voice-vlan {

            description "block rogue devices on voice-vlan";

            filter {

                 input ingress-vlan-rogue-block;}}}

Cấu hình bộ lọc firewall VLAN để đếm, giám sát và phân tích lưu lượng egress trên VLAN nhân viên

Để cấu hình và áp dụng các bộ lọc firewall cho cổng, VLAN, và các giao diện router, hãy thực hiện các bước sau:

Quy trình thực hiện

Cấu hình nhanh qua CLI (CLI Quick Configuration)

Một bộ lọc firewall được cấu hình và áp dụng cho các giao diện VLAN để lọc lưu lượng egress của employee-vlan. Lưu lượng nhân viên hướng đến subnet công ty được chấp nhận nhưng không được giám sát. Lưu lượng nhân viên hướng đến Web sẽ được đếm và phân tích.

Để cấu hình nhanh và áp dụng bộ lọc firewall VLAN, sao chép các lệnh sau và dán chúng vào cửa sổ terminal của switch:

[edit]

                         set firewall family ethernet-switching filter egress-vlan-watch-employee term employee-to-corp from destination-address 192.0.2.16/28 

                         set firewall family ethernet-switching filter egress-vlan-watch-employee term employee-to-corp then accept                 

                         set firewall family ethernet-switching filter egress-vlan-watch-employee term employee-to-web from destination-port 80               

                         set firewall family ethernet-switching filter egress-vlan-watch-employee term employee-to-web then count employee-web-counter         

                         set firewall family ethernet-switching filter egress-vlan-watch-employee term employee-to-web then analyzer employee-monitor            

                         set vlans employee-vlan description "filter at egress VLAN to count and analyze employee to Web traffic"                    

                         set vlans employee-vlan filter output egress-vlan-watch-employee                 

Quy trình từng bước (Step-by-Step Procedure)

Để cấu hình và áp dụng bộ lọc firewall cổng egress để đếm và phân tích lưu lượng employee-vlan hướng đến Web:

  • Định nghĩa bộ lọc firewall egress-vlan-watch-employee:

[edit firewall]

user@switch# set family ethernet-switching filter egress-vlan-watch-employee 

  • Định nghĩa term employee-to-corp để chấp nhận nhưng không giám sát tất cả lưu lượng employee-vlan hướng đến subnet công ty.

[edit firewall family ethernet-switching filter egress-vlan-watch-employee]

user@switch# set term employee-to-corp from destination-address 192.0.2.16/28

user@switch# set term employee-to-corp then accept                        

  • Định nghĩa term employee-to-web để đếm và giám sát tất cả lưu lượng employee-vlan hướng đến Web.

[edit firewall family ethernet-switching filter egress-vlan-watch-employee]

user@switch# set term employee-to-web from destination-port 80

user@switch# set term employee-to-web then count employee-web-counter

user@switch# set term employee-to-web then analyzer employee-monitor    

**Lưu ý: Xem ví dụ: Cấu hình Port Mirroring để giám sát sử dụng tài nguyên của nhân viên trên các switch EX Series để biết thông tin về cấu hình analyzer employee-monitor.

  • Áp dụng bộ lọc firewall egress-vlan-watch-employee làm bộ lọc đầu ra (output filter) cho các cổng giao diện của các điện thoại VoIP.

[edit]

user@switch# set vlans employee-vlan description "filter at egress VLAN to count and analyze employee to Web traffic"

user@switch# set vlans employee-vlan filter output egress-vlan-watch-employee                        

Kết quả

Hiển thị kết quả của cấu hình:

user@switch# show                        

    firewall {

        family ethernet-switching {

            filter egress-vlan-watch-employee {

                term employee-to-corp {

                    from {

                        destination-address 192.0.2.16/28}

                    then {

                        accept;}}

                term employee-to-web {

                    from {

                        destination-port 80;}

                    then {

                        count employee-web-counter:

                        analyzer employee-monitor;}}}}}

    vlans {

        employee-vlan {

            description "filter at egress VLAN to count and analyze employee to Web traffic";

            filter {

                 output egress-vlan-watch-employee;}}}

Cấu hình bộ lọc firewall VLAN để hạn chế lưu lượng giữa khách mời và nhân viên, cũng như các ứng dụng peer-to-peer trên VLAN khách mời

Để cấu hình và áp dụng các bộ lọc firewall cho cổng, VLAN, và các giao diện router, hãy thực hiện các bước sau:

Quy trình thực hiện

Cấu hình nhanh qua CLI (CLI Quick Configuration)

Trong ví dụ dưới đây, điều kiện lọc đầu tiên cho phép khách mời giao tiếp với các khách mời khác nhưng không được giao tiếp với nhân viên trên employee-vlan. Điều kiện lọc thứ hai cho phép khách mời truy cập Web nhưng ngăn chặn họ sử dụng các ứng dụng peer-to-peer trên guest-vlan.

Để cấu hình nhanh bộ lọc firewall VLAN hạn chế lưu lượng giữa khách mời và nhân viên, ngăn không cho khách mời giao tiếp với nhân viên hoặc các thiết bị nhân viên trên employee-vlan, hoặc cố gắng sử dụng các ứng dụng peer-to-peer trên guest-vlan, sao chép các lệnh sau và dán chúng vào cửa sổ terminal của switch:

[edit]

                         set firewall family ethernet-switching filter ingress-vlan-limit-guest term guest-to-guest from destination-address 192.0.2.33/28                    

                         set firewall family ethernet-switching filter ingress-vlan-limit-guest term guest-to-guest then accept                    

                         set firewall family ethernet-switching filter ingress-vlan-limit-guest term no-guest-employee-no-peer-to-peer from destination-mac-address 00.05.5E.00.00.DF                    

                         set firewall family ethernet-switching filter ingress-vlan-limit-guest term no-guest-employee-no-peer-to-peer then accept                    

                         set vlans guest-vlan description "restrict guest-to-employee traffic and peer-to-peer applications on guest VLAN"                    

                         set vlans guest-vlan forwarding-options filter input ingress-vlan-limit-guest                    

Quy trình từng bước (Step-by-Step Procedure)

Để cấu hình và áp dụng bộ lọc firewall VLAN hạn chế lưu lượng giữa khách mời và nhân viên, cũng như các ứng dụng peer-to-peer trên guest-vlan:

  • Định nghĩa bộ lọc firewall ingress-vlan-limit-guest:

[edit firewall]

                             set firewall family ethernet-switching filter ingress-vlan-limit-guest                        

  • Định nghĩa term guest-to-guest để cho phép khách mời trên guest-vlan giao tiếp với các khách mời khác nhưng không giao tiếp với nhân viên trên employee-vlan.

[edit firewall family ethernet-switching filter ingress-vlan-limit-guest]

user@switch# set term guest-to-guest from destination-address 192.0.2.33/28

user@switch# set term guest-to-guest then accept                        

  • Định nghĩa term no-guest-employee-no-peer-to-peer để cho phép khách mời trên guest-vlan truy cập Web nhưng ngăn chặn họ sử dụng các ứng dụng peer-to-peer trên guest-vlan.

**Lưu ý: destination-mac-address là cổng mặc định, đối với bất kỳ thiết bị nào trong một VLAN, đó là router tiếp theo.

[edit firewall family ethernet-switching filter ingress-vlan-limit-guest]

user@switch# set term no-guest-employee-no-peer-to-peer from destination-mac-address 00.05.5E.00.00.DF

user@switch# set term no-guest-employee-no-peer-to-peer then accept                        

  • Áp dụng bộ lọc firewall ingress-vlan-limit-guest làm bộ lọc đầu vào (input filter) cho giao diện của guest-vlan.

[edit]

user@switch# set vlans guest-vlan description "restrict guest-to-employee traffic and peer-to-peer applications on guest VLAN"

user@switch# set vlans guest-vlan forwarding-options filter input ingress-vlan-limit-guest                        

Kết quả

Hiển thị kết quả của cấu hình:

user@switch# show                        

    firewall {

        family ethernet-switching {

            filter ingress-vlan-limit-guest {

                term guest-to-guest {

                    from { 

                        destination-address 192.0.2.33/28;}

                    then {

                        accept;}}

                term no-guest-employee-no-peer-to-peer {

                    from { 

                        destination-mac-address 00.05.5E.00.00.DF;}

                    then {

                        accept;}}}}}

    vlans {

        guest-vlan {

            description "restrict guest-to-employee traffic and peer-to-peer applications on guest VLAN";

            filter {

                input ingress-vlan-limit-guest;}}}

Cấu hình Bộ Lọc Firewall trên Router để Ưu Tiên Lưu Lượng Egress đến Subnet Doanh Nghiệp

Để cấu hình và áp dụng các bộ lọc firewall (firewall filters) cho các cổng, VLAN và giao diện router, thực hiện các bước sau:

Quy trình thực hiện

Cấu hình nhanh qua CLI

Để nhanh chóng cấu hình một bộ lọc firewall cho cổng định tuyến (Layer 3 uplink module) nhằm lọc lưu lượng từ VLAN nhân viên (employee-vlan), đồng thời cấp ưu tiên cao nhất cho lớp chuyển tiếp (forwarding-class) đối với lưu lượng hướng đến subnet doanh nghiệp (corporate subnet), sao chép các lệnh sau và dán vào cửa sổ dòng lệnh (terminal) của switch:

[edit]

                         set firewall family inet filter egress-router-corp-class term corp-expedite from destination-address 192.0.2.16/28                    

                         set firewall family inet filter egress-router-corp-class term corp-expedite then forwarding-class expedited-forwarding            

                         set firewall family inet filter egress-router-corp-class term corp-expedite then loss-priority low                    

                         set firewall family inet filter egress-router-corp-class term not-to-corp then accept                    

                         set interfaces ge-0/1/0 description "filter at egress router to expedite destined for corporate network"                    

                         set ge-0/1/0 unit 0 family inet address 203.0.113.0                    

                         set interfaces ge-0/1/0 unit 0 family inet filter output egress-router-corp-class                    

Quy trình từng bước (Step-by-Step Procedure)

Để cấu hình và áp dụng một bộ lọc firewall (firewall filter) lên cổng định tuyến (cổng uplink Layer 3) nhằm cấp ưu tiên cao nhất cho lưu lượng từ VLAN nhân viên (employee-vlan) hướng đến subnet doanh nghiệp (corporate subnet):

  • Định nghĩa firewall filter có tên egress-router-corp-class:

[edit]

user@switch# set firewall family inet filter egress-router-corp-class                          

  • Định nghĩa term corp-expedite:

[edit firewall]

user@switch# set family inet filter egress-router-corp-class term corp-expedite from destination-address 192.0.2.16/28

user@switch# set family inet filter egress-router-corp-class term corp-expedite then forwarding-class expedited-forwarding

user@switch# set family inet filter egress-router-corp-class term corp-expedite then loss-priority low                        

  • Định nghĩa term not-to-corp:

[edit firewall]

user@switch# set family inet filter egress-router-corp-class term not-to-corp then accept                        

  • Áp dụng firewall filter egress-router-corp-class dưới dạng bộ lọc đầu ra (output filter) cho cổng trên mô-đun uplink của switch, cổng này cung cấp kết nối Layer 3 đến router:

[edit interfaces]

user@switch# set ge-0/1/0 description "filter at egress router to expedite employee traffic destined for corporate network"

user@switch# set ge-0/1/0 unit 0 family inet address 203.0.113.0

user@switch# set ge-0/1/0 unit 0 family inet filter output egress-router-corp-class                        

Kết quả

Hiển thị kết quả của cấu hình:

user@switch# show                        

    firewall {

        family inet {

            filter egress-router-corp-class {

                term corp-expedite {

                    from {

                        destination-address 192.0.2.16/28;}

                    then {

                        forwarding-class expedited-forwarding;

                        loss-priority low;}}

                term not-to-corp {

                    then {

                        accept;}}}}}

    interfaces {

        ge-0/1/0 {

            unit 0 {

                description "filter at egress router interface to expedite employee traffic destined for corporate network";

                family inet {

                    source-address 203.0.113.0

                    filter {

                        output egress-router-corp-class;}}}}}

Xác minh

Để xác nhận rằng các bộ lọc firewall đang hoạt động đúng cách, thực hiện các tác vụ sau:

Xác minh rằng các Firewall Filter và Policer đang hoạt động

Mục đích

Xác minh trạng thái hoạt động của các firewall filter và policer đã được cấu hình trên switch.

Hành động

Sử dụng lệnh ở chế độ hoạt động (operational mode):

user@switch>                              show firewall                                              

Filter: ingress-port-voip-class-limit-tcp-icmp

Counters:

Name                                              Packets

icmp-counter                                            0

tcp-counter                                             0

Policers:

Name                                              Packets

icmp-connection-policer                                 0

tcp-connection-policer                                  0

Filter: ingress-vlan-rogue-block

Filter: egress-vlan-watch-employee

Counters:

Name                                              Packets

employee-web—counter                                    0

Ý nghĩa

Lệnh show firewall hiển thị tên của các firewall filter, policer và counter đã được cấu hình trên switch. Các trường đầu ra sẽ hiển thị số byte và số gói tin đã được đếm bởi tất cả các counter, cùng với số lượng gói tin đã được xử lý bởi tất cả các policer.

Xác minh rằng các Scheduler và Scheduler-Map đang hoạt động

Mục đích

Xác minh rằng các scheduler và scheduler-map đang hoạt động trên switch.

Hành động

Sử dụng lệnh ở chế độ hoạt động (operational mode):

user@switch>                              show class-of-service scheduler-map                    

Scheduler map: default, Index: 2

  Scheduler: default-be, Forwarding class: best-effort, Index: 20

    Transmit rate: 95 percent, Rate Limit: none, Buffer size: 95 percent,

    Priority: low

    Drop profiles:

      Loss priority   Protocol    Index    Name

      Low             non-TCP         1    default-drop-profile

      Low             TCP             1    default-drop-profile

      High            non-TCP         1    default-drop-profile

      High            TCP             1    default-drop-profile

  Scheduler: default-nc, Forwarding class: network-control, Index: 22

    Transmit rate: 5 percent, Rate Limit: none, Buffer size: 5 percent,

    Priority: low

    Drop profiles:

      Loss priority   Protocol    Index    Name

      Low             non-TCP         1    default-drop-profile

      Low             TCP             1    default-drop-profile

      High          &

 

Chúc các bạn thực hiện thành công. Hi vọng bài viết này sẽ giúp ích cho các bạn trong công việc. Nếu bạn có vấn đề gì thắc mắc đừng ngần ngại liên hệ với chúng tôi theo thông tin dưới đây để được hỗ trợ thêm.

Hẹn gặp lại các bạn trong các bài viết tiếp theo!

CÔNG TY CỔ PHẦN DỊCH VỤ CÔNG NGHỆ DATECH

• Địa chỉ: Số 23E4 KĐT Cầu Diễn, Tổ 7, Phú Diễn, Bắc Từ Liêm, Hà Nội

• Điện thoại: 02432012368

• Hotline: 098 115 6699

• Email: info@datech.vn

• Website: https://datech.vn