如何在Linux环境下架设一台传真服务器(1)


传真服务器FAX Server)是基于网络的客户端/服务器的传真系统,其中服务器端软件为网络用户提供共享的传真功能,而客户端软件使您可以直接在自己的终端上发送传真,就像发送Email或者文件打印一样简单。本文就将分七步带领大家一起架设一台传真服务器。

一、介绍

下面介绍的配置采用了Hylafax 4.0p2.rjc11,其运行于Mandrake7.1之上。在服务器端,Hylafax由三个守护程序组成:

faxq: 主要的服务程序

hfaxd: 管理网络连接

faxgetty:管理调制解调器间的会话

在客户端运行的程序如下这些程序也可以在服务器上运行):

sendfax:发送传真

faxstat:检查传真队列

faxrm:从队列中删除一项工作。

相关的配置文件在/var/spool/fax/etc/文件夹内。

二、安装

我建议安装以下软件包它们都包含在Mandrake 7.1中):

ghostscript ftp://ftp.cs.wisc.edu/pub/ghost/aladdin

libtiff ftp://rufus.w3.org/linux/redhat

也可以从官方网站http://www.hylafax.org/links.html获取这些资源。安装Hylafax,需要安装下列RPM包:

rpm -ivh hylafax-common-4.0pl2.rjc11-3mdk

rpm -ivh hylafax-client-4.0pl2.rjc11-3mdk

rpm -ivh hylafax-server-4.0pl2.rjc11-3mdk

三、配置Hylafax

运行下列命令对服务器进行配置:

faxsetup -server必须以root身份进行该操作)
除了以下的几项外,对其它的询问选项都选取OK,即选取默认设值:

1)Country code [1]? enter 33 for France

2)Area code []? enter 1 for Paris

3)Long distance dialing prefix [1]? enter 0

4)International dialing prefix [011]? enter 00

5)Dial string rules file [etc/dialrules]? enter etc/dialrules.europe

6)Serial port that modem is connected to []? enter ttyS0 (for COM1) or ttyS1 (for COM2)

Hylafax的默认设置在启动时并不自动的调用守护程序faxgetty,可以手工完成该过程。

1、编辑/etc/inittab文件,在文件的最后插入下面的内容:

mo:2345:respawn:/usr/sbin/faxgetty -D ttyS0

然后运行kill -HUP l ,重启faxgetty,或者对rc.local文件进行改动。

2、在/etc/rc.d/rc.local文件中加入下面几行:

/usr/sbin/faxgetty -D /dev/ttys0

并运行命令:faxgetty -D /dev/ttys0

注意:用faxaddmodem命令可以添加多个调制解调器。

完成这些处理后,就为faxgetty创建了文件/var/spool/fax/etc/config.ttyS0串口1),其中包括了/dev/ttyS0调制解调器的配置。文件/usr/share/fax/hfaxd.conf包含了hfaxd守护程序的配置。
可能出现的问题:

用probemodem命令来探测调制解调器,另外在/var/spool/fax/config中有一些典型的配置。

如果你的调制解调器是3Com的,则可以将usr-2.0文件复制到/var/spool/fax/etc中,改名为config.ttyS0,并做如下修改:

# Configuration for using the Class 2.0 command interface

# with a USR v.34 Courier or Sporster modem.

# CONFIG: CLASS2.0: USRobotics*-*
# CountryCode: 33

AreaCode: 1

#FAXNumber: your number ex (for france): 0134123412

LongDistancePrefix: 0

InternationalPrefix: 00

DiadStringRules: etc/dialrules.europe (Important .europe !)

ServerTracing: 1

SessionTracing: 11

RecvFileMode: 0600

LogFileMode: 0600

DeviceMode: 0600

RingsBeforeAnswer: 1

SpeakerVolume: off

GettyArgs: "-h %l dx_%s"

#LocalIdentifier: "Your Company" (uncomment if wanted on the fax)

#TagLineFont: etc/lutRS18.pcf (idem)

#TagLineFormat: "De %%l %c Page %%p sur %%t" (idem)

#MaxRecvPages: 25

ModemType: Class2.0 # use class 2.0 interface

ModemRate: 57600 # 38400 DCE-DTE communication rate

ModemFlowControl: rtscts # XON/XOFF flow control assumed

ModemDialCmd: ATDT0%s # I added 0 because I go through a PABX !!

#ModemNoFlowCmd: AT&H0&I0&R1 # setup modem for no flow control
ModemHardFlowCmd: AT&H1&I0&R2 # setup modem for hardware flow control

#ModemSoftFlowCmd: AT&H2&I2&R1 # setup modem for software flow control

#ModemSetupDTRCmd: ATS13=1&D2 # setup so DTR drop resets modem

#ModemSetupDCDCmd: AT&C1 # setup so DCD reflects carrier (or not)

ModemResultCodesCmd: ATQ0X4 # enable extended result codes

#ModemSetupAACmd: AT+FAA=1

#ModemSetVolumeCmd: "ATM0 ATM1 ATM1 ATM1 ATM1"

Class2BUGCmd: AT+FBU=0

Class2CQQueryCmd: !(0),(0) # override modem response

Class2NRCmd: AT+FNR=1,1,1,0

接下来在/var/spool/fax/etc/host中添加以下几行:

localhost

192.168.0.1

允许所有在域192.168.1.0中的机器使用传真。


相关内容