Phụ lục D: Hiện thực MPLS trên Linux
271
đến như sau: đầu tiên, nó trích nhãn từ tiêu đề chèn thêm trên cùng, tìm nhãn trong bảng
ILM, dựa vào opcode trong nhãn mà thực hiện các xử lí khác nhau.
struct mpls label {
u32 label res:1,
label value:28,
label type:3:
#define MPLS_LABEL_VPI
#define MPLS_LABEL_VCI
fdefine MPLS_LABEL_GEN
tdefine MPLS_LABEL_DLCI 10
♦define MPLS_LABEL_DLCI 17
#define MPLS_LABEL_DLCI 23
};
Idefine MPLS_GEN_LABEL
#define MPLS_VPIVCI_LABEL
Idefine MPLS_VPI_LABEL
Idefine MPLS_VCI_LABEL
#define MPLS_FR10_LABEL
idefine MPLS_FR17_LABEL
Refine MPLS_FR23_LABEL
Cấu trúc ILM, với opcode là các hành vi tương ứng: POP_AND_LOOKUP,
PO PA NDFORW ARD, NO _POP_AND_FORWARD,
SEND TO RP
struct ilm ent {
struct mpls_label label;
struct route_ent* outgoing_rt;
ul6 protocol;
u8 opcode;
};
CÀI ĐẶT
Download các gói kemel2.4.x.tar.gz, mpls-linux-l.lyy.tgz, giải nén và cập nhật bản
MPLS patch cho kernel để hồ trợ tính năng MPLS, biên dịch lại kernel mới với các tùy chọn
như bên dưới, cuối cùng là cài đặt kernel mới có hỗ ứợ MPLS
Code maturity level options — ->
[*] Prompt for development and/or incomplete code/drivers
Networking options — ->
[*] Multi Protocol
Label Switching - MPLS
[*] Network packet filtering (replaces ipchains)
IP: Netfliter Configuration — ->
<*> IP tables support (required for filtering/masq/NAT)
<*> Packet mangling
( (label_value»16) &0xFFF)
(label_value&OxFFFF)
(label_value&OxFFFfF)
(label_value&0x3FF)
(label_value&OxlFFFF)
(label_value&0x7FFFFF)
0x01
0x02
0x03
0x04
0x05
0x06
0x07
272
Chuyển mạch nhãn đa giao thức MPLS
<*> MPLS target support
/usr/src/linux-2.4.19>make dep && make clean && make bzlmage && make
modules && make modules
install
Chuyển bzlmage and System.map trong thư mục /boot và tạo một symbolic link mới
đến System.map (tùy chọn).
Thay đổi file /etc/lilo.conf để bổ sung Image mới. Nạp lilo và khởi động lại.
VÍ DỤ
Sau đây là một ví dụ đơn giản về thiết lập một LSP và ánh xạ lưu lượng đến nó, sau
đó kiểm tra lại lưu lượng đã được gán nhãn.
Chia sẻ với bạn bè của bạn: