跳至內容

Linux 網路/幀中繼

來自華夏公益教科書

幀中繼

[編輯 | 編輯原始碼]

幀中繼裝置名稱為 `dlci00`、`dlci01` 等,用於 DLCI 封裝裝置,`sdla0`、`sdla1` 等用於 FRAD。幀中繼是一種新的網路技術,旨在適合突發或間歇性的資料通訊流量。您可以使用幀中繼接入裝置 (FRAD) 連線到幀中繼網路。Linux 幀中繼支援 RFC-1490 中描述的 IP over Frame Relay。

核心編譯選項

            Network device support  --->
                <*> Frame relay DLCI support (EXPERIMENTAL)
                (24)   Max open DLCI
                (8)   Max DLCI per device
                <*>   SDLA (Sangoma S502/S508) support

Mike McLagan (mike.mclagan@linux.org) 開發了幀中繼支援和配置工具。目前唯一支援的 FRAD 是 Sangoma Technologies S502A、S502E 和 S508。

在重新構建核心後,您需要使用幀中繼配置工具來配置 FRAD 和 DLCI 裝置。這些工具可從 ftp.invlogic.com 獲取。編譯和安裝工具很簡單,但由於缺少頂層 Makefile,因此是一個相當手動化的過程

             user% tar xvfz .../frad-0.15.tgz
             user% cd frad-0.15
             user% for i in common dlci frad; make -C $i clean; make -C $i; done
             root# mkdir /etc/frad
             root# install -m 644 -o root -g root bin/*.sfm /etc/frad
             root# install -m 700 -o root -g root frad/fradcfg /sbin
             rppt# install -m 700 -o root -g root dlci/dlcicfg /sbin

請注意,之前的命令使用的是 sh 語法。如果您使用的是 csh 風格(如 tcsh),則 for 迴圈將有所不同。安裝工具後,您需要建立一個 /etc/frad/router.conf 檔案。您可以使用此模板,它是其中一個示例檔案的修改版本

# /etc/frad/router.conf
# This is a template configuration for frame relay.
# All tags are included. The default values are based on the code
# supplied with the DOS drivers for the Sangoma S502A card.
#
# A '#' anywhere in a line constitutes a comment
# Blanks are ignored (you can indent with tabs too)
# Unknown [] entries and unknown keys are ignored
#

[Devices]
Count=1                 # number of devices to configure
Dev_1=sdla0             # the name of a device
#Dev_2=sdla1            # the name of a device

# Specified here, these are applied to all devices and can be overridden for
# each individual board.
#
Access=CPE
Clock=Internal
KBaud=64
Flags=TX
#
# MTU=1500              # Maximum transmit IFrame length, default is 4096
# T391=10               # T391 value    5 - 30, default is 10
# T392=15               # T392 value    5 - 30, default is 15
# N391=6                # N391 value    1 - 255, default is 6
# N392=3                # N392 value    1 - 10, default is 3
# N393=4                # N393 value    1 - 10, default is 4

# Specified here, these set the defaults for all boards
# CIRfwd=16             # CIR forward   1 - 64
# Bc_fwd=16             # Bc forward    1 - 512
# Be_fwd=0              # Be forward    0 - 511
# CIRbak=16             # CIR backward  1 - 64
# Bc_bak=16             # Bc backward   1 - 512
# Be_bak=0              # Be backward   0 - 511


#
#
# Device specific configuration
#
#

#
# The first device is a Sangoma S502E
#
[sdla0]
Type=Sangoma            # Type of the device to configure, currently only
                        # SANGOMA is recognized
#
# These keys are specific to the 'Sangoma' type
#
# The type of Sangoma board - S502A, S502E, S508
Board=S502E
#
# The name of the test firmware for the Sangoma board
# Testware=/usr/src/frad-0.10/bin/sdla_tst.502
#
# The name of the FR firmware
# Firmware=/usr/src/frad-0.10/bin/frm_rel.502
#
Port=360                # Port for this particular card
Mem=C8                  # Address of memory window, A0-EE, depending on card
IRQ=5                   # IRQ number, do not supply for S502A
DLCIs=1                 # Number of DLCI's attached to this device
DLCI_1=16               # DLCI #1's number, 16 - 991
# DLCI_2=17
# DLCI_3=18
# DLCI_4=19
# DLCI_5=20
#
# Specified here, these apply to this device only,
# and override defaults from above
#
# Access=CPE            # CPE or NODE, default is CPE
# Flags=TXIgnore,RXIgnore,BufferFrames,DropAborted,Stats,MCI,AutoDLCI
# Clock=Internal        # External or Internal, default is Internal
# Baud=128              # Specified baud rate of attached CSU/DSU
# MTU=2048              # Maximum transmit IFrame length, default is 4096
# T391=10               # T391 value    5 - 30, default is 10
# T392=15               # T392 value    5 - 30, default is 15
# N391=6                # N391 value    1 - 255, default is 6
# N392=3                # N392 value    1 - 10, default is 3
# N393=4                # N393 value    1 - 10, default is 4

#
# The second device is some other card
#
# [sdla1]
# Type=FancyCard        # Type of the device to configure.
# Board=                # Type of Sangoma board
# Key=Value             # values specific to this type of device


#
# DLCI Default configuration parameters
# These may be overridden in the DLCI specific configurations
#
CIRfwd=64               # CIR forward   1 - 64
# Bc_fwd=16             # Bc forward    1 - 512
# Be_fwd=0              # Be forward    0 - 511
# CIRbak=16             # CIR backward  1 - 64
# Bc_bak=16             # Bc backward   1 - 512
# Be_bak=0              # Be backward   0 - 511

#
# DLCI Configuration
# These are all optional. The naming convention is
# [DLCI_D<devicenum>_<DLCI_Num>]
#

[DLCI_D1_16]
# IP=
# Net=
# Mask=
# Flags defined by Sangoma: TXIgnore,RXIgnore,BufferFrames
# DLCIFlags=TXIgnore,RXIgnore,BufferFrames
# CIRfwd=64
# Bc_fwd=512
# Be_fwd=0
# CIRbak=64
# Bc_bak=512
# Be_bak=0

[DLCI_D2_16]
# IP=
# Net=
# Mask=
# Flags defined by Sangoma: TXIgnore,RXIgnore,BufferFrames
# DLCIFlags=TXIgnore,RXIgnore,BufferFrames
# CIRfwd=16
# Bc_fwd=16
# Be_fwd=0
# CIRbak=16
# Bc_bak=16
# Be_bak=0

構建完 /etc/frad/router.conf 檔案後,剩下的唯一步驟就是配置實際裝置本身。這與普通網路裝置配置僅略有不同,您需要記住在 DLCI 封裝裝置之前啟動 FRAD 裝置。這些命令最好放在一個 shell 指令碼中,因為它們數量很多

             #!/bin/sh
             # Configure the frad hardware and the DLCI parameters
             /sbin/fradcfg /etc/frad/router.conf || exit 1
             /sbin/dlcicfg file /etc/frad/router.conf
             #
             # Bring up the FRAD device
             ifconfig sdla0 up
             #
             # Configure the DLCI encapsulation interfaces and routing
             ifconfig dlci00 192.168.10.1 pointopoint 192.168.10.2 up
             route add -net 192.168.10.0 netmask 255.255.255.0 dlci00
             #
             ifconfig dlci01 192.168.11.1 pointopoint 192.168.11.2 up
             route add -net 192.168.11.0 netmask 255.255.255.0 dlci00
             #
             route add default dev dlci00
             #
華夏公益教科書