此项Achieve the dynamic IP domain name automatic pointing under Linux(在linux下实现动态IP的域名自动指向)

域名指向  时间:2021-02-21  阅读:()

Achieve the dynamic IP domain name automatic pointing under

Linux 在linux下实现动态IP的域名自动指向

China Linux Forum Forum | reviews | cangjingge | CMPP | planMirror plan | online survey software | | warehouse on the |China Linux Forum - article meta

The home page | classified articles | meta search articles |my article | online users

Article meta

The latest article read this topic: 1704

On the last topic, read all the topics, index the next topic,next to the flat pattern tree model, and read the tree modelone by one

Add to favorites | print

Article title in Linux, dynamic IP domain name automaticallypoint to by Gan Jiehan

Respond to the commentary in this article

Posted: David. system (webmaster)

Posted date 09/04/02 12:26 PM

Gan Jiehan, 100 Wenfeng Road, Guangxi, Qinzhou

On the Internet, the user' s domain name and IP address areone-to-one correspondence. But the virtual dial-up access tothe Internet, resulting in a dynamic IP address. This has causedtrouble for computer enthusiasts who don' t have much money toapply for domain names. The previous period, due to the authorof the region' s ADSL instead of virtual dial-up, the troublealso troubled the author for a while. After many debugging,finally realized the dynamic IP address domain name automaticpointing under Linux. Now we will record it and share it withyou:

Before thehttp://www.deerf ield.com/download/dns2go/linux/index.htm isa server for a free domain name, put the dns2go in the/etc/rc.d/rc. local, the boot fixed free domain name. But ADSLto virtual dial-up way, there is no fixed IP address, startdns2go is very troublesome, first use the ifconfig command tofind the ppp0 IP, and thenmodify the IP under/etc/dns2go. conf,and then can start dns2go. It' s inconvenient to use manualoperation every time. It can not be started automaticallywithout anyone' s intervention. Write a C program to solve theproblem, in cases of all procedures are assumed installed inthe /usr/local/bin/, a program written in shell to call the Cprogram, the directory containing xnbh (shell program) , trans(Executive C program compiled) , outfile (intermediatetemporary files) , pppoe.txt (intermediate) , dns2go. conf(typical the configuration file)

The shell program for xnbh is as follows:

Adsl-start# starts the virtual dialer for adls,

The ifconfig ppp0 |grep -v "Link" >/usr/local/bin/pppoe.txt#produces the pppoe. txt file in the directory

The /usr/local/bin/trans# invokes the C program to extract theIP value in the file pppoe.txt, and then replaces the IP valuein the dns2go.conf to produce the intermediate file outfileCP/etc/dns2go. conf/etc/dns2go.confold#backup the originaldns2go. conf file

CP /usr/local/bin/outfile /etc/dns2go. conf # after replacingthe dns2go.conf file

Nohup /usr/local/bin/dns2go >/var/tmp/dns2go. log 2>&1 &#start fixed domain

After executing the second sentence in xnbh, the followingpppoe.txt is generated:

INET addr:218.65.217. 109 P-t-P: 172.0.0. 1

Mask:255.255.255.255

UP, POI NTOPOI NT, RUNNING, NOARP, MULT I CAS T, MTU: 1492, Met r i c: 1RX, packet s:26, errors:0, dropped:0, overruns:0, frame:0TX, packets:27, errors:0, dropped:0, overruns:0, carrier:0Collisions:0 txqueuelen:3

RX bytes:1400 (1.3 Kb) TX bytes:1358 (1.3 Kb)The trans. c program is as follows:

#include <stdio.h>

#include <ctype.h>

(ma i n)

{

F ILE, *fp, *bp, *out;

Int i=0;

Int j;char ip [16] ;char dip [16] ;char na [] = "address =";char inip [24] ;char readln [255] ;char readlnn [255] ;

fp = fopen ("/ usr / local / bin / pppoe.txt", "r") ;if (fgets (readln, 255, fp) ! = = null)

{ (i = 0; i < 16; i + +) ip = readln [20 + in] ;}in = 0;for (i = 0; i < 16; i + +)

{if (ip! = ' ' )

{dip = ip; printf ("ip% d =% c% n" in, ip) ; }else {j = i; printf ("j =% d", j) ; } }for (i = 0; i < = j; i + +) dip = ip;dip [j] = '\ 0' ;printf ("a =% s \ n", dip) ;f c l o s e (fp) ;strcpy (inip, na) ;printf ("inip =% s \ n", inip) ;strcat (inip, dip) ;

printf ("inip =% s \ n", inip) ;fp = fopen ("/ usr / local / bin / dns2go. conf", "r") ;out = fopen ("/ usr / local / outfile", "w") ;while ( ! feof (fp)) {if (fgets (readlnn, 255, fp) ! = = null)i f (strncmp ("addres s = aaa.bbb.ccc.ddd", readlnn, 15)) fputs(readlnn, out) ;else fputs (inip, out) ; }f c l o s e (fp) ;fclose (out) ;

}

在linux下用gcc –o trans trans.c编译通过产生文件trans,dns2go. conf的配vchgob #:

#

# simple configuration file for dns2go linux client

#

# for more information refer to the dns2go.conf manual page#

# global directives

#

# dns2go serverserver = discovery.dns2go.com

# key (required, case sensitive)key = aaaaaa - bbbbbb - ccccccc - ddddd (此项为申请的激活码)# log file (optional, default: syslog)

# log = / var / log / dns2go.txt

# send debug outputs two stdoutdebug

# number of connection attempts (optional, default: 8)# retries = 8

# rate two send heartbeats (in minutes) (optional, default: 0= automati c)

# heartbeat rate = 0

#

# domain directives

#

# fully qualified domain name (required)doma in = xxxxx.dnsgo.com (此项填写固定免费域名)

# static ip address (optional, default: external ip address)address = aaa.bbb.ccc.ddd (此项为假设ip)

# online www alias redirection: choose one of the following:# (optional, default: www. alias resolves two domain ip)# www redirect - url = http: / /. . .

# www redirect gate = 8080

# offline redirect option: choose one of the following# (optional, default: offline status page)

# offline - url = http: / /. . .

# offline - ip = 0.0.0.0

以上xnbh程序若加入/ etc / rc.d / rc. local /中则可以启动时自动启动固定免费域名,

此时你可以启动的apache, ftp, telnet等都可以用此免费域名了,出门在外的朋友可以

很方便找到自己的服务器,熟悉shell的朋友也可以用shell完成c程序的功能, 以上的

程序在redhat7.2上顺利通过.david

Article options: print, put this article in the memorandum, andwhen you have time to reply to friends, share the notificationmoderator

The title of Re: Linux under dynamic IP domain name to by [re:David. ] automatic Gansu Johanna

Respond to the commentary in this article

Posted by: zjohnc (journeyman)

Posting date 09/04/02 04:41 PM

In/etc/ppp/ip-up and/etc/ppp/ip-down Riga, dns2go and dns2go-k, you can automatically follow the new. I have used for morethan 2 months, basically no problem, sometimes can not update,

iON Cloud:七月活动,洛杉矶CN2 GIA线路85折优惠中,价格偏高/机器稳定/更新优惠码

iON Cloud怎么样?iON Cloud是Krypt旗下的云服务器品牌,成立于2019年,是美国老牌机房(1998~)krypt旗下的VPS云服务器品牌,主打国外VPS云服务器业务,均采用KVM架构,整体性能配置较高,云服务器产品质量靠谱,在线率高,国内直连线路,适合建站等用途,支付宝、微信付款购买。支持Windows server 2012、2016、2019中英文版本以及主流Linux发行...

随风云-内蒙古三线BGP 2-2 5M 25/月 ,香港CN2 25/月 ,美国CERA 25/月 所有云服务器均支持5天无理由退款

公司成立于2021年,专注为用户提供低价高性能云计算产品,致力于云计算应用的易用性开发,面向全球客户提供基于云计算的IT解决方案与客户服务,拥有丰富的国内BGP、三线高防、香港等优质的IDC资源。公司一直秉承”以人为本、客户为尊、永续创新”的价值观,坚持”以微笑收获友善, 以尊重收获理解,以责任收获支持,以谦卑收获成长”的行为观向客户提供全面优质的互...

Raksmart:香港高防服务器/20Mbps带宽(cn2+bgp)/40G-100Gbps防御

RAKsmart怎么样?RAKsmart香港机房新增了付费的DDoS高防保护服务,香港服务器默认接入20Mbps的大陆优化带宽(电信走CN2、联通和移动走BGP)。高防服务器需要在下单页面的IP Addresses Option里面选择购买,分:40Gbps大陆优化高防IP-$461/月、100Gbps国际BGP高防IP-$692/月,有兴趣的可以根据自己的需求来选择!点击进入:RAKsmart官...

域名指向为你推荐
安装程序配置服务器失败安装用友T3出现安装程序配置服务器失败是怎么回事缓冲区溢出教程溢出攻击法使用什么样的原理万网核心代理哪里可以注册免费代理?bt封杀现在是全面封杀BT下载了吗?现在都找不到BT下载影片了机械键盘轴机械键盘的轴哪种好?iphone6上市时间苹果6什么时候出来分词技术百度的中文分词原理是什么?与IK分词有区别吗?什么是云平台什么是家庭云平台?去鼠标加速度CS去鼠标加速度和鼠标灵敏度的区别?手工杀毒有没有人会手动杀毒.可否详解下
什么是域名地址 香港加速器 idc测评网 12306抢票攻略 光棍节日志 华为云主机 免费网络电视 大容量存储 中国电信测速112 支持外链的相册 卡巴斯基免费试用版 免费私人服务器 google台湾 512mb 韩国代理ip 国外网页代理 云服务是什么意思 葫芦机 贵州电信 湖南铁通 更多