歡迎您光臨本站 註冊首頁

用客戶端Dr.com可以在Linux中上網了

←手機掃碼閱讀     火星人 @ 2014-03-23 , reply:0

自6月份學校要用DR.COM客戶端登陸,災難就來了,在U6.06下上了網,在網上看到很多朋友也是這樣,不過有的朋友把在U7.04下可以用DR.COM上網,於是我刻了一張U7.04的光碟,又按網上找到的方法:

現在很多大家都是用Dr.com上網。而學校又沒有提供linux版。或者是老有版本,新的用不了。所以要自己編譯。

首要因素是你要安裝 build-essential

如果你沒有安裝過,請利用下面的命令安裝

sudo apt-get install build-essential

當然你可以用「新立得」,我就很喜歡新立得!

你需要做的第二件事就是安裝libssl-dev,這個包包括了drcom需要用到的用於認證加密的md5函數,它需要一個md5.h的頭文件,而這個文件在libssl-dev中有,另外libssl-dev還包括了其他好多的用於加密的頭文件哦。

第三,你需要安裝對應內核版本的頭文件,這個用 uname -r命令可以得到關於你機器的信息,比如我的:

uname -r

2.6.12-10-686

這是我的內核版本,我用的是Intel P4的CPU,所以我安裝的是這個內核,ubuntu默認安裝的是 2.6.12-9-386,當你第一次系統更新時就會安裝 2.6.12-10-386,然後一般人都會根據自己的CPU類型選擇合適的內核版本,AMD用戶會選擇 2.6.12-10-k7;

另外你得到信息的方法就是查看/proc/version文件,這裡有你機器的一般信息,包括編譯內核採用的gcc版本,這也是呆會要用的。

cat /proc/version

比如我的信息顯示為:

Linux version 2.6.12-10-686 (buildd@rothera) (gcc version 3.4.5 20050809 (prerelease) (Ubuntu 3.4.4-6ubuntu8)) #1

Mon Jan 16 17:58:04 UTC 2006

它不但告訴了我內核版本還告訴了我gcc的版本是3.4.5,因為你編譯新的內核模塊時要用到和編譯內核同樣版本的gcc版本。

那麼就在你的「新立得」裡面搜索「linux-headers」找到你需要版本的linux頭文件

Linux-header-file-{yourversion},比如我的就安裝linux-header-2.6.12-10-686

雖然你剛才已經安裝了編譯的環境build-essential,但是安裝的gcc版本是更新的4.0版本,它在用來編譯內核模塊時是不合適的。

在你的「新立得」搜索gcc,安裝gcc3.4,至此你就建立了一個可以編譯drcomsuite的環境了,按照前面的方法編譯安裝。

一、要從能上網的機上下載drcom的源代碼,(libdrcom、drcomsuite)以下給出地址:

http://jaist.dl.sourceforge.net/ ... -20050423-2.tar.bz2

http://jaist.dl.sourceforge.net/ ... 2drcom-1.3.2.tar.gz

二、解壓包:以下操作大部分需要超級用戶的許可權,所以如果你當前是普通用戶請用「su」切換到「root「用戶

#tar jxvf libdrcom-0.0-20050423-2.tar.bz2

#tar jxvf drcomsuite-0.1.12.tar.bz2

三、安裝libdrcom

#cd libdrcom-0.0-20050423-2/

#more INSTALL "查看安裝說明

#make

#make install

安裝libdrcom一般是沒什麼問題的,關鍵是安裝後面的那部分

四、安裝drcomsuite

安裝之前你要確定在以下目錄中有Linux內核的頭文件或源代碼存在,查看方法如下:

#uname -r "如我的就顯示"2.6.20-15-server"

#ls /usr/src "那麼這裡就會有" linux-headers-2.6.20-15-server"或者是"linux"等等目錄。注意這版本號一定要

跟上面那命令顯示的版本號相對應,要不然可能導致後面的安裝失敗,或者是drcom程序崩潰。

#cd drcomsuite-0.1.12/

#more INSTALL "可以看到這可以編譯生成針對於不同內核版本的drcom,比較新的Linux發行版都是2.6以後的版本了,這也就是為什麼從網路中心下載的客戶端使用不了的原因,如果你的系統是2.6以後的版本,那就使用命令的默認參數就行了

#make "如果在make過程中出現以下錯誤:

/……/Drcom/drcomsuite-0.1.12/module/Linux/2.6.x/proto.c: 在函數 『init_proto』 中:

/……/Drcom/drcomsuite-0.1.12/module/Linux/2.6.x/proto.c:306: 錯誤: 向只讀變數 『inet_stream_ops』 賦值

/……/Drcom/drcomsuite-0.1.12/module/Linux/2.6.x/proto.c:309: 錯誤: 向只讀變數 『inet_dgram_ops』 賦值

/……/Drcom/drcomsuite-0.1.12/module/Linux/2.6.x/proto.c: 在函數 『cleanup_proto』 中:

/……/Drcom/drcomsuite-0.1.12/module/Linux/2.6.x/proto.c:322: 錯誤: 向只讀變數 『inet_dgram_ops』 賦值

/……/Drcom/drcomsuite-0.1.12/module/Linux/2.6.x/proto.c:323: 錯誤: 向只讀變數 『inet_stream_ops』 賦值

說明了你的內核頭文件中『inet_stream_ops』和『inet_dgram_ops』聲明是常量,要想進行下去,必須要其對進行修改:(可以編譯通過後再改回原樣)

#vi /usr/src/你的內核頭文件目錄/include/net/inet_common.h

找到以下兩句,然後刪除「const」,保全再從新編譯過一次。

extern const struct proto_ops inet_stream_ops;

extern const struct proto_ops inet_dgram_ops;

#make "好了,沒有出錯了吧

#make install

五、配置drcom.conf文件
順利安裝好drcom只是成功的一半,後面還有好戲看呢……在安裝的時候已經複製了配置文件樣式「drcom.conf.new"到「/etc/「目錄下了。我們需要做的就是:

#mv /etc/drcom.conf.new /etc/drcom.conf

#vi /etc/drcom.conf "會看到以下內容

……

……

# Username and password

# A blank password is considered valid.

username=填入你的帳號名

password=填入帳號密碼

# Interface information

# mac is the MAC address of the nic we use to connect

# to the server.

# Example:

# mac=1a:2b:3c:4d:5e:6f

# If left blank it will default to 00:00:00:00:00:00

mac=填入你網卡的物理地址 #不清楚的在終端以root用戶輸入「ifconfig「查看

# nicn is the nth nic. This is the real data that's

# passed to the server, and thus I suggest you only

# fill in the first nic.

# Example:

# nic0=192.168.0.1

# nic1=

# nic2=

# nic3=

# Only nic0 is mandatory; the others should normally

# be left blank.

nic0=填入你本機的IP #一般都是單網卡用戶,後面的空白

nic1=

nic2=

nic3=

# dnsp(rimary) and dnss(econdary).

dnsp=219.222.191.9 #主dns,這是我們學校的

dnss=202.96.128.86 #次dns,這是我們學校的,一定要填,不填程序會出錯,如果沒有次dns,填一個合法的ip地址

# dhcp server address. Windows XP uses 255.255.255.255

# and Windows 2000 uses 0.0.0.0

# If left blank it defaults to 255.255.255.255

dhcp= #一般都不是由dhcp指配的ip,所以這裡也留空

# Connection information

# If the network supports it, and serverip is set

# to 1.1.1.1, then the gateway will help us find

# the real server (beex said this was the reason

# why we had to upgrade, but I don't see the

# practical reason why)

# All are optional, if left blank, then:

# + hostip defaults to nic0

# + servip defaults to 1.1.1.1

# + hostport defaults to 61440 (0xf000)

# + servport defaults to 61440 (0xf000)

# Note: hostip can be given one of the special values

# eth0, eth1, eth2, ... eth9 (I don't think

# regular users would need eth10 :-P), which

# corresponds to the inet address of the

# interface.

hostip=

servip=192.168.252.9 #輸入你用drcom時打開瀏覽器被自動引導如提示你登陸的那個地址就可以了,這個是我們學校的登陸地址,其他的留空默認

hostport=

servport=

# Miscellaneous Machine Information

# We don't need to be honest about these.

# For example, Windows XP has a version number

# of 5.1 and a build number of 2600.

# All are optional, if left blank, then:

# + hostname defaults to "localhost"

# + winver defaults to 5.1

# + winbuild defaults to 2600

# + servicepack defaults to "Service Pack 2"

#後面的四項是用來假冒windows xp主機的,可以不填

hostname=

winver=

winbuild=

servicepack=

六、測試運行
#drcomcd "啟動drcom的守護進程,如果運行成功會提示如下信息:

1177613153 DEBUG drcomc: Creating socket...

#drcomc login "如果顯示 Login succeeded,就表示已經連接了,恭喜你。

但是我卻在運行drcomcd的時候出現了以下錯誤:

1177621481 DEBUG drcomcd: Redirecting stderr to /var/log/drcomcd...

*** stack smashing detected ***: drcomcd terminated

忽略 (core dumped)

查看/var/log/drcomcd

1177621481 DEBUG drcomcd: Checking for running instance of drcomcd...

ps -e | grep `basename drcomcd` | grep -v ^\ *15248\

然後查看源代碼drcomcd.c(在/……/drcomsuite-0.1.12/drcomcd/目錄下),發現原來drcomcd在啟動的時候會檢查是否有drcomcd正在運行,在以下語句中出現了錯誤:

sprintf(s, "ps -e | grep `basename %s` | grep -v ^\\ *%d\\ ", name, pid);

把他改為下面的語句就可以通過:

sprintf(s, "ps -e | grep `basename %s` | grep -v ^\\ %d\\ ", name, pid);

如果修改後,編譯能通過,而且drcomcd能運行,但是運行drcomc login 時連接不上的話,那就乾脆把上面那語句用/*……*/註釋掉它,沒多大影響的。(我測試的時候就出現了這種情況)

修改後重新做步驟四:

#cd drcomsuite-0.1.12/

#make clean "刪除上次編譯生成的文件

#make

#make install

重新測試后成功了……終於可以在Linux下上網拉。嘻嘻

補充說明:第一次登錄必須首先要$su到root用戶運行守護進程#drcomcd(因為要動態載入模塊drcom),運行#drcomc login登錄和#drcomc logout註銷,然後才可以返回普通用戶使用系統。要退出守護進程又必須$su到root用戶執行#killall drcomcd撤銷進程。但是在ubuntu下就很方便的實現,不清楚查看一下sudo就知道了。

以上我師兄的可以。我的不可以。那就。

再裝個drcom-1.3.5

下載地址http://sourceforge.net/projects/drcom-client

#tar zxvf drcom-1.3.5.tar.gz

#cd drcom-1.3.5

#make

#make install.

gedit /etc/drcom.conf

根據上面說明填寫/

#drcomd

#drcomc login

註銷

#drcomc logout

弄了幾次,都不行,與上面紅色代碼不同,我的那幾個數字每次都不同,如下:
1190528361 DEBUG drcomcd: Checking for running instance of drcomcd...
ps -e | grep `basename drcomcd` | grep -v ^\ *6964\

1190893132 DEBUG drcomcd: Checking for running instance of drcomcd...
ps -e | grep `basename drcomcd` | grep -v ^\ *5997\

唉,沒有辦法……只有等待高手,由於中途課程緊和暑假,所以很久沒有上論壇,暫時把U擱在一邊,今天又上論壇,用了幾天,問了師兄。也搞了好久。用了好多方法不行。

別說那麼多了。分享一下吧。大學的同學們。

=======

沒有想到,這次居然可以了,在此謝謝cookierolls的好帖子,不過我用的是drcom-1.3.7,心情激動,再次謝謝朋友們,希望對用Dr.com客戶端的朋友有所幫助。

[火星人 ] 用客戶端Dr.com可以在Linux中上網了已經有592次圍觀

http://coctec.com/docs/linux/show-post-119767.html