跳至内容

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 ([email protected]) 开发了帧中继支持和配置工具。目前唯一支持的 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
             #
华夏公益教科书