- 論壇徽章:
- 1
|
作者:楊躍峰
摘自《中國(guó)計(jì)算機(jī)報(bào)》
一、問(wèn)題的提出
隨著網(wǎng)絡(luò)的日益普及,計(jì)算機(jī)系統(tǒng)通過(guò)網(wǎng)絡(luò)實(shí)現(xiàn)設(shè)備共享和資源共享已十分普遍。在一個(gè)公共的網(wǎng)絡(luò)環(huán)境中,設(shè)置一臺(tái)共享打印機(jī)不僅大大提高了設(shè)備的利用率和網(wǎng)絡(luò)效率,降低了總擁有成本,還省去了操作人員長(zhǎng)期習(xí)慣于每打印一份作業(yè)便抱一臺(tái)打印機(jī)連到自己機(jī)器上的麻煩。dos、windows、netware系統(tǒng)下共享打印機(jī)設(shè)置比較簡(jiǎn)單,無(wú)需多言,sco-unix作為金融系統(tǒng)和其它大行業(yè)首選的操作系統(tǒng),近年來(lái)組網(wǎng)非常廣泛,應(yīng)用也非常普及,但設(shè)置共享打印機(jī)比較麻煩。筆者經(jīng)過(guò)多次試驗(yàn),終獲成功,介紹給大家僅供參考。
二、工作原理
共享打印機(jī)即按一定拓?fù)浣Y(jié)構(gòu)聯(lián)接在網(wǎng)絡(luò)中的打印機(jī),通過(guò)網(wǎng)絡(luò)協(xié)議(tcp/ip、netbeui、ipx/spx等)而被網(wǎng)絡(luò)用戶(hù)共享使用。其連接主要有以下三種方式:
(1)打印機(jī)本身帶網(wǎng)卡(又稱(chēng)網(wǎng)絡(luò)打印機(jī)),直接連到網(wǎng)絡(luò)中供用戶(hù)共享使用(見(jiàn)圖1)。
![]()
(t 表示數(shù)據(jù)終端)
圖1
(2)打印機(jī)連接到專(zhuān)用的打印服務(wù)器上,并通過(guò)其網(wǎng)絡(luò)接口連到網(wǎng)絡(luò)中供用戶(hù)共享使用(見(jiàn)圖2)。
![]()
圖2
(3)使用一臺(tái)網(wǎng)絡(luò)上的pc或服務(wù)器兼作打印服務(wù)器,連上打印機(jī)供用戶(hù)共享使用(見(jiàn)圖3)。
比較而言,前兩種方式須購(gòu)置專(zhuān)用設(shè)備,同時(shí)unix下還需設(shè)置bootp 或rarp服務(wù)以自動(dòng)提供ip地址。而第三種方式無(wú)需購(gòu)置專(zhuān)用設(shè)備且不影響計(jì)算機(jī)的正常使用, 經(jīng)濟(jì)實(shí)用,簡(jiǎn)單方便,大大節(jié)約運(yùn)行成本,也是筆者下面所要介紹的。
![]()
圖3
三、實(shí)現(xiàn)過(guò)程
以網(wǎng)絡(luò)中有a、b兩臺(tái)主機(jī)為例(見(jiàn)圖4),操作系統(tǒng)為sco openserver 3.0 或5.0,打印機(jī)連到兼做打印服務(wù)器的b機(jī)上,供a、b主機(jī)上的用戶(hù)共享使用。設(shè)a機(jī)主機(jī)名為 hosta ip地址:168.1.8.1
b機(jī)主機(jī)名為 hostb ip地址:168.1.8.2
打印機(jī)名為:printer
調(diào)整unix 核心系統(tǒng)參數(shù) nregion: a 機(jī)不低于800、b機(jī)不低于1000并連接核心重新引導(dǎo)系統(tǒng)。
![]()
圖4
1.b機(jī)端設(shè)置
以 root 用戶(hù)注冊(cè):
(1)定義主機(jī)名。修改文件 /etc/hosts 含以下行:
168.1.8.1 hosta
168.1.8.2 hostb
。2)定義打印服務(wù)授權(quán)。修改文件 /etc/hosts.lpd 含以下行:
hosta
(3)建立本地打印機(jī) printer (如已存在先刪除),設(shè)為缺省并激活:
#mkder lp
選 configure→add
其中:printer name: printer
connection: direct
device name: /dev/lp0
#/usr/lib/lpadmin -d printer
#enable printer
(4)建立網(wǎng)絡(luò)方式下的本地打印機(jī),名稱(chēng)同上為 printer, 提示本地(local)或遠(yuǎn)程(remote)時(shí),選擇本地。
#mkdev rlp
提示如下(黑體字母為所選擇項(xiàng)):
remote printing configuration
do you want to install or remove remote printing (i/r/q)? [q]: i
installing remote line printing
creating directories /usr/lpd/remote and /usr/spool/lpd and file /etc/printcap.
saving lp, cancel and lpstat commands to /usr/lpd/remote
installing remote lp, cancel and lpstat commands
do you wish to change the printer description file /etc/printcap? (y/n) [n] y
remote printing configuration
enter information for remote printers or local printers accepting
remote printing requests
please enter the printer name (q to quit): printer
is printer a remote printer or a local printer (r/l)? l
please enter the the name of the device for printer: /dev/lp0
printer printer uses device /dev/lp0
is this correct? (y/n) y
remote printing configuration
enter information for remote printers or local printers accepting
remote printing requests
please enter the printer name (q to quit): q
do you want to start remote daemon now? (y/n) y
2?a機(jī)端設(shè)置
以 root 用戶(hù)注冊(cè):
。1)定義主機(jī)名。修改文件 /etc/hosts 含以下行:
168.1.8.1 hosta
168.1.8.2 hostb
。2)建立網(wǎng)絡(luò)方式下的遠(yuǎn)程打印機(jī),遠(yuǎn)程主機(jī)名為hostb,遠(yuǎn)程打印機(jī)名輸入printer,提示本地(local)或遠(yuǎn)程(remote)時(shí),選擇遠(yuǎn)程。
。kdev rlp
remote printing configuration
do you want to install or remove remote printing (i/r/q)? [q]: i
installing remote line printing
creating directories /usr/lpd/remote and /usr/spool/lpd and file /etc/printcap.
saving lp, cancel and lpstat commands to /usr/lpd/remote
installing remote lp, cancel and lpstat commands
do you wish to change the printer description file /etc/printcap? (y/n) [n] y
remote printing configuration
enter information for remote printers or local printers accepting
remote printing requests
please enter the printer name (q to quit): printer
is printer a remote printer or a local printer (r/l)? r
please enter the the name of the remote host that printer is attached to: hostb
printer printer is connected to host hostb
is this correct? (y/n) y
would you like this to be the system default printer? (y/n) [n] y
make sure your host name appears in hostb′s /etc/hosts.equiv
or /etc/hosts.lpd file
make sure that printer appears in hostb′s /etc/printcap file (bsd format)
make sure that printer has a spool directory on hostb
please hit to continue
remote printing configuration
enter information for remote printers or local printers accepting
remote printing requests
please enter the printer name (q to quit): q
do you want to start remote daemon now? (y/n) y
(3)測(cè)試。在 hosta 或 hostb 上以普通用戶(hù)注冊(cè), 輸入以下命令即可實(shí)現(xiàn)共享打。
。 lp /etc/default/lpd
3.日常維護(hù)
(1)管理員或普通用戶(hù)通過(guò)使用命令 lpstat 或 rlpstat 查看打印機(jī)狀態(tài),并使用命令 lp 進(jìn)行日常打印。
。2)設(shè)置遠(yuǎn)程打印機(jī)時(shí)將自動(dòng)安裝新的lpstat、cancel、lppstat命令, 原命令存放在/usr/lpd/remote目錄下
。3) 每次增加打印機(jī)前,最好刪除原有的打印機(jī)。
我們將以上共享打印機(jī)應(yīng)用于廣域網(wǎng)中,也調(diào)試正確。windows工作站安裝pc-nfs軟件后,通過(guò)nfs同樣可共享sco-unix打印機(jī),一年多來(lái),一直運(yùn)行良好,各應(yīng)用部門(mén)非常滿(mǎn)意。在當(dāng)前大力提倡降低總體擁有成本的今天,不失為一種好方法。
本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u/31/showart_526202.html |
|