蘋果系統Mac OSX用花生殼phddns

蘋果系統Mac OSX用花生殼phddns

 

 

蘋果系統Mac OSX用花生殼phddnsxcode

剛剛修改了一下花生殼的文件,介紹給你們方法服務器

1.工具

下載花生殼文件phddns-2.0.3.16858.tar.gzui

這個文件是花生殼官方的linux版this

從新編譯OSX版spa

附件有編譯好的phddns-2.0.3.16858-osx.tar.bz2 .net

中有一個phddns文件夾能夠有簡單設定

 

2.

你的系統要有xcode嘍

tar xzvf phddns-2.0.3.16858.tar.gz

cd phddns-2.0.3.16858

按官網的方法

不過這裏一會要修改的

由於OSX的 net/if.h 中的 struct ifreq 結構有所不一樣

seazouMacBook:phddns-2.0.3.16858 qvb3d$ aclocal

seazouMacBook:phddns-2.0.3.16858 qvb3d$ autoconf

seazouMacBook:phddns-2.0.3.16858 qvb3d$ automake

seazouMacBook:phddns-2.0.3.16858 qvb3d$ ./configure

一大堆設定信息.....

seazouMacBook:phddns-2.0.3.16858 qvb3d$ make

編譯時可能還會遇到 /bin/sh: config.status Makefile 

的錯誤

本身手工輸信這行命令

/bin/sh config.status 

就能夠繼續make

phruncall.c: In function ‘ShowNic’:

phruncall.c:551: error: ‘struct ifreq’ has no member named ‘ifr_hwaddr’

phruncall.c:551: error: ‘struct ifreq’ has no member named ‘ifr_hwaddr’

phruncall.c:551: error: ‘struct ifreq’ has no member named ‘ifr_hwaddr’

phruncall.c:551: error: ‘struct ifreq’ has no member named ‘ifr_hwaddr’

phruncall.c:551: error: ‘struct ifreq’ has no member named ‘ifr_hwaddr’

phruncall.c:551: error: ‘struct ifreq’ has no member named ‘ifr_hwaddr’

make[1]: *** [phruncall.o] Error 1

make: *** [all-recursive] Error 1

怎麼辦?

seazouMacBook:phddns-2.0.3.16858 qvb3d$ cd src

seazouMacBook:src qvb3d$ vi phruncall.c 

(gg551) 快找到551行內容改

 

if (!(ioctl(fd, SIOCGIFADDR, (char *) &buf[interface]))) {

 printf("[%s] = [IP:%s][MAC:%02x:%02x:%02x:%02x:%02x:%02x]\n",buf[interface].ifr_name,\

inet_ntoa(((struct sockaddr_in *)(&buf[interface].ifr_ifru.ifru_addr)) -> sin_addr),\

&buf[interface].ifr_ifru.ifru_addr.sa_data[0],\

&buf[interface].ifr_ifru.ifru_addr.sa_data[1],\

&buf[interface].ifr_ifru.ifru_addr.sa_data[2],\

&buf[interface].ifr_ifru.ifru_addr.sa_data[3],\

&buf[interface].ifr_ifru.ifru_addr.sa_data[4],\

&buf[interface].ifr_ifru.ifru_addr.sa_data[5]);

 


改ifr_addr爲ifr_ifru.ifru_addr

改ifr_hwaddr爲ifr_ifru.ifru_addr

cd ..

make

cd src

獲得phddns

使用方法支官網上看吧

http://service.oray.com/question/116.html

 

 

如下不是原創是官網的引用:

*********************************************************************************************************************

1、安裝說明(以CentOS 5爲例)

 

一、安裝必要的開發包

 

 

[root@localhost ~]# yum install gcc gcc-c++ autoconf automake

 

 

二、下載phddns-2.0.2.16556.tar.gz到某一個目錄

 

 

[root@localhost ~]# wget http://download.oray.com/peanuthull/phddns-2.0.2.16556.tar.gz

 

 

三、解壓全部文件

 

 

[root@localhost ~]# tar zxvf phddns-2.0.2.16556.tar.gz

 

 

四、進入目錄並編譯

 

[root@localhost ~]# cd phddns-2.0.2.16556

[root@localhost phddns-2.0.2.16556]# aclocal

[root@localhost phddns-2.0.2.16556]# autoconf

[root@localhost phddns-2.0.2.16556]# automake

[root@localhost phddns-2.0.2.16556]# ./configure

[root@localhost phddns-2.0.2.16556]# make

[root@localhost phddns-2.0.2.16556]# cd src

[root@localhost src]# ls -l phddns

-rwxr-xr-x 1 root root 80968 Aug 2 11:18 phddns

 

 

五、執行編譯好的程序並配置(默認使用/etc/phlinux.conf,若是不存在這個文件則自動進入交互配置)

 

 

[root@localhost src]# ./phddns

輸入服務器地址,如無特殊狀況可以使用默認值

Enter server address(press ENTER use phlinux3.oray.net):

 

 

輸入您的Oray賬號名稱

Enter your Oray account:

 

 

對應的Oray賬號密碼

Password:

 

 

選擇幫定的網卡,如無特殊,默認便可

Network interface(s):

eth0:192.168.141.18

lo:127.0.0.1

Choose one(default eth0):

 

 

選擇日誌保存到哪一個文件

Log to use(default /var/log/phddns.log):

 

 

保存配置文件,選擇yes則直接保存到/etc/phlinux.conf,輸入other能夠指定文件

Save to configuration file (/etc/phlinux.conf)?(yes/no/other):

 

 

接下來程序將已交互模式開始運行

192.168.141.18

NIC bind success

OnStatusChanged okConnecting

OnStatusChanged okDomainListed

OnDomainRegistered skyvense22.gicp.net

OnStatusChanged okDomainsRegistered

UserType: 0

看到上面這些就表示登陸成功,這個時候能夠按ctrl+c先退出程序

 

 

 

六、將phddns拷貝到你但願的位置

 

[root@localhost src]# cp phddns /usr/bin/

 

 

七、之後臺模式啓動花生殼並檢查運行狀況

 

 

[root@localhost ~]# /usr/bin/phddns -c /etc/phlinux.conf -d

phlinux started as daemon!

[root@localhost ~]# tail /var/log/phddns.log

2011/08/02 11:28:58.256| ExecuteUpdate OK, BeginKeepAlive!

2011/08/02 11:29:59.354| SendKeepAlive() 8208

2011/08/02 11:30:00.355| RecvKeepaliveResponse() Data comes, OPCODE:8272

2011/08/02 11:30:00.356| Keepalive response received, client ip: 116.231.123.96

2011/08/02 11:31:00.447| SendKeepAlive() 8208

2011/08/02 11:31:01.450| RecvKeepaliveResponse() Data comes, OPCODE:8272

2011/08/02 11:31:01.450| Keepalive response received, client ip: 116.231.123.96

 

 

八、退出花生殼

 

 

查看進程ID

[root@localhost ~]# ps -A | grep phlinux

13731 ? 00:00:00 phlinux

讓後臺進程退出

[root@localhost ~]# kill -9 13731

 

 

九、將花生殼加到系統啓動時運行

 

[root@localhost ~]# vi /etc/rc.local

在文件的末尾加上一行:/usr/bin/phlinux -c /etc/phlinux.conf -d

 

 

 

2、花生殼Linux版本命令行參數說明

 

 

[root@localhost ~]# /usr/bin/phlinux -h

Peanuthull Linux-core 2.0 by oray.com, copyright 2011

Peanuthull Linux-core Help

--first-run

-f, run for the first time

用於首次啓動時配置參數

 

 

--interact

-i, run as interactive mode

program will request for necessary parameters.

this mode will automatically enabled at first running,

or your configuration file has been lost.

啓動交互模式

 

 

--daemon

-d, run as a daemon

program will quit after put itself to background,

and continue running even you logout,

you can use kill -9 <PID> to terminate.

後臺模式

 

 

--config

-c, run with configuration file

program will run with the file

指定使用哪個配置文件

 

 

--user

-u, run as the user

program will run as the user

以指定用戶啓動後臺進程

 

 

--help

-h, print this screen.

Please visit http://www.oray.com for detail.

 

 

 

3、常見問題

 

 

 

如何手動修改登錄的用戶名及密碼?

 

 

您能夠直接編輯/etc/phlinux.conf文件,對登錄用戶名及密碼進行修改。

花生殼日誌保存路徑

/var/log/phddns.log

 

 

 

爲何花生殼沒法登錄?

 

 

花生殼使用的通訊端口是TCP:6060和UDP:6060(方向:OUT),請確認防火牆沒有把這幾個通訊端口封掉。

 

 

 

如何查看花生殼當前運行狀態?

 

 

查看日誌:

[root@localhost ~]# tail /var/log/phddns.log

2011/08/02 11:28:58.256| ExecuteUpdate OK, BeginKeepAlive!

2011/08/02 11:29:59.354| SendKeepAlive() 8208

2011/08/02 11:30:00.355| RecvKeepaliveResponse() Data comes, OPCODE:8272

2011/08/02 11:30:00.356| Keepalive response received, client ip: 116.231.123.96

2011/08/02 11:31:00.447| SendKeepAlive() 8208

2011/08/02 11:31:01.450| RecvKeepaliveResponse() Data comes, OPCODE:8272

2011/08/02 11:31:01.450| Keepalive response received, client ip: 116.231.123.96

 

 

 

如何在其餘平臺(非X86)編譯運行?

 

 

交叉編譯mips cpu版本方法:

 

一、安裝交叉工具並配置環境

........

二、配置參數

./configure --host=i386-linux --target=mipsel-linux --build=mipsel-linux CXX=mipsel-linux-gcc CC=mipsel-linux-gcc LD=mipsel-linux-ld

三、make

四、最後靜態連接下

mipsel-linux-gcc -g -O2 -o phlinux -s main.o phupdate.o PHGlobal.o PHSocket.o md5.o log.o generate.o coder.o blowfish.o bitstream.o base64.o ConvertUTF.o CCmdParser.o PhClient.o PhUpdater.o /opt/openwrt/mipsel-linux/lib/librt.a /opt/openwrt/mipsel-linux/lib/libstdc++.a //opt/openwrt/mipsel-linux/lib/libc.a

五、壓縮下(好放到路由器的小空間)

upx -o phlinux2 phlinux

相關文章
相關標籤/搜索