บทความอัพเดทในเว็บ ขออนุญาตอัพเดทช่องทาง https://fb.com/siamcafefan

ผู้เขียน หัวข้อ: อยากทราบวิธี่ ทำให้ CCproxy มันเชื่อมต่อกับ IP No-ip  (อ่าน 4798 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ poi15973

  • มือใหม่
  • *
  • กระทู้: 3
  • Reputation: 0
บอกวิธี น่อยคับ  :039:
Signature cleanned by Admin

ออฟไลน์ oek2002

  • ผ่านการทดสอบเลื่อนชั้น
  • **
  • กระทู้: 33
  • Reputation: 1
Re: อยากทราบวิธี่ ทำให้ CCproxy มันเชื่อมต่อกับ IP No-ip
« ตอบกลับ #1 เมื่อ: มกราคม 19, 2011, 11:29:20 am »
การทำ Dynamic DNS

   สำหรับผู้ที่ต้องการที่จะควบคุม Server ในขณะที่ไม่ได้อยู่ภายในวงแลน หรือต้องการที่จะควบคุมระบบจากที่อื่น (เช่นจากที่บ้านโดยการ Online Internet ผ่าน Modem)  ซึ่งความเป็นจริงการต่อไปยัง ISP โดยผ่านทาง Modem ปัญหาที่เกิดขึ้นอย่างหนึ่งก็คือเมื่อสายหลุด IP ที่ได้รับการแจกจาก ISP จะเปลี่ยนไป การที่เราจะ Remote เข้ามาเพื่อทำอะไรบางอย่างกับ Server ค่อนข้างจะลำบากเนื่องจากไม่ทราบ IP ของ Server
ในขณะนั้น การทำ Dynamic DNS จะช่วยเราได้มากในที่นี้ผู้เขียนจะยกตัวอย่าง 2 ตัว คือของ no-ip และ dyns ซึ่งสามารถดูได้จาก http://www.no-ip.com  และ http://www.dyns.cx  ตามลำดับ แนะนำว่าไปลง
ทะเบียน ทั้งสองตัวเลย ให้ download โปรแกรม ทั้งสองตัวมาใช้

       อนึ่งการทำ Dynamic DNS นั้นให้ทำในขณะที่เรากำลัง Online นะครับ ไม่งั้น ppp0 จะไม่ปรากฎให้
เราเลือก

NO-IP

ในที่นี้ผู้เขียนได้เก็บโปรแกรมไว้ที่ /home/util เราก็ copy มาไว้ที่ /var/tmp จากนั้นก็ทำการแตกและ config ตั้งค่าต่างๆ ดังนี้

[root@one tmp]# cp /home/util/noip_updater_v1.6.tar.gz .   <--- ทำการ copy
[root@one tmp]# tar -zxvf noip_updater_v1.6.tar.gz   <--- ทำการแตกไฟล์
noip_updater_v1.6/
noip_updater_v1.6/Makefile
noip_updater_v1.6/COPYING
noip_updater_v1.6/README.FIRST
noip_updater_v1.6/no-ip.sh
noip_updater_v1.6/no-ip.conf.sample
noip_updater_v1.6/noip.c
noip_updater_v1.6/i386binaries/
noip_updater_v1.6/i386binaries/noip-for-libc6
[root@one tmp]# cd noip_updater_v1.6       <--- เปลี่ยน directory ไปที่ no-ip_updater_v1.6
[root@one noip_updater_v1.6]# make     <--- สั่ง make
gcc -O2 -g -Dlinux noip.c -o noip
[root@one noip_updater_v1.6]# make conf <--- สั่ง make conf
./no-ip.sh
Greetings!

The no-ip dynamic DNS system requires a configuration file.
The answers to the next five questions will build one.

What is your email address for no-ip.com? ([email protected])
> [email protected]                 <--- ใส่ e-mail ที่เราลงทะเบียนเอาไว้กับ no-ip.com
What is the password for the login account? (password)
> abcdef                                 <--- ใส่ password ที่เราลงทะเบียนเอาไว้
Are you using a groupname instead of a host.domain.name? (Y/N)
Answer 'N' if you do not understand the question.
> n                                     <--- ตอบ  n
What is the host.domain.name you are using? (host.no-ip.com)
> rtrc.no-ip.com                   <--- ใส่ชื่อที่เราต้องการ url ของเรา(ไม่รวม http://) ซึ่งลงทะเบียนเอาไว้
Do you have a router which uses NAT/masquerading? (Y/N)
> n                                     <--- ตอบ  n
Which device is your net connection? (one of: lo eth0 ppp0 )
> ppp0                               <--- ให้เลือก ppp0 ในขั้นตอนนี้ถ้ายังไม่ได้ online  ตัว ppp0 จะไม่มี
Configuration file [./no-ip.conf] created.
[root@one noip_updater_v1.6]# make install <--- จากนั้นก็สั่ง make install
cp noip /usr/local/bin/noip
cp no-ip.conf /usr/local/lib/no-ip.conf
chmod 600 /usr/local/lib/no-ip.conf
[root@one noip_updater_v1.6]# /usr/local/bin/noip <--- สั่ง run โปรแกรม
[root@one noip_updater_v1.6]# cd .. <--- ออกจากที่อยู่ปัจจุบันไปหนึ่ง level
[root@one tmp]# rm -f noip_updater_v1.6.tar.gz <--- ลบ file ทิ้ง
[root@one tmp]# rm -rf noip_updater_v1.6/     <--- ลบ folder ทิ้ง
[root@one tmp]#
 

ก็เป็นการเรียบร้อยในการทำ Dynamic DNS กับ no-ip ซึ่งในขั้นตอนนี้เราสามารถใช้ ssh เข้ายัง Server โดยไม่ต้องใส่เลข IP 192.168.1.1 แต่เราสามารถ ใส่ IP เป็น rtrc.dyns.cx  เรามาสมารถเข้าไปยัง Server ของเรา ไม่ว่าจากภายในวงแลน หรือจากบ้านหรือที่อื่นในโลกนี้ ตัว rtrc คือตัวที่เราลงทะเบียนไว้กับ no-ip  อย่าลืมว่า ถ้าเราปิด Server เมื่อไหร่ เมื่อเปิดใหม่ขึ้นมา หลังจากที่ต่อ Modem ไป ISP แล้ว อย่าลืมสั่ง run ด้วยโดย

[root@one tmp]# /usr/local/bin/noip


ต่อไปเป็นการทำ dyns ซึ่งถ้าไม่ต้องการก็ไม่จำเป็น แต่ผู้เขียนใช้ทั้งสองตัว

DYNS

เนื่องจาก dyns สามารถทำ redirection ได้ คือ แปลง url ที่ยาวๆ ให้สั้นๆได้เช่น เวบที่ท่านกำลังอ่านจะเก็บไว้ที่ http://varanya.ph.mahidol.ac.th/academic/the_departments/training/Paper/RedHat73/redh  at73.html
แต่ผมได้สมัคร dyns.cx เอาไว้ เลยใช้  http://muphrtrc.dyns.cx  จะสั้นกว่า มาเริ่มกันเลยนะครับ

ในที่นี้ผู้เขียนได้เก็บโปรแกรมไว้ที่ /home/util เราก็ copy มาไว้ที่ /var/tmp จากนั้นก็ทำการแตกและ config ตั้งค่าต่างๆ ดังนี้

[root@one tmp]# cp /home/util/ez-ipupdate-3.0.11b6-patched.tgz .<--- ทำการ copy
[root@one tmp]# tar -zxvf ez-ipupdate-3.0.11b6-patched.tgz     <--- ทำการแตก file
ez-ipupdate-3.0.11b6-patched/
ez-ipupdate-3.0.11b6-patched/Makefile.in
ez-ipupdate-3.0.11b6-patched/README
ez-ipupdate-3.0.11b6-patched/stamp-h.in
ez-ipupdate-3.0.11b6-patched/COPYING
ez-ipupdate-3.0.11b6-patched/INSTALL
ez-ipupdate-3.0.11b6-patched/Makefile.am
ez-ipupdate-3.0.11b6-patched/acconfig.h
ez-ipupdate-3.0.11b6-patched/aclocal.m4
ez-ipupdate-3.0.11b6-patched/config.guess
ez-ipupdate-3.0.11b6-patched/config.h.in
ez-ipupdate-3.0.11b6-patched/config.sub
ez-ipupdate-3.0.11b6-patched/configure
ez-ipupdate-3.0.11b6-patched/configure.in
ez-ipupdate-3.0.11b6-patched/install-sh
ez-ipupdate-3.0.11b6-patched/missing
ez-ipupdate-3.0.11b6-patched/mkinstalldirs
ez-ipupdate-3.0.11b6-patched/ez-ipupdate.c
ez-ipupdate-3.0.11b6-patched/conf_file.c
ez-ipupdate-3.0.11b6-patched/conf_file.h
ez-ipupdate-3.0.11b6-patched/md5.c
ez-ipupdate-3.0.11b6-patched/md5.h
ez-ipupdate-3.0.11b6-patched/cache_file.c
ez-ipupdate-3.0.11b6-patched/cache_file.h
ez-ipupdate-3.0.11b6-patched/error.h
ez-ipupdate-3.0.11b6-patched/pid_file.c
ez-ipupdate-3.0.11b6-patched/pid_file.h
ez-ipupdate-3.0.11b6-patched/dprintf.h
ez-ipupdate-3.0.11b6-patched/getpass.c
ez-ipupdate-3.0.11b6-patched/ez-ipupdate.lsm
ez-ipupdate-3.0.11b6-patched/example.conf
ez-ipupdate-3.0.11b6-patched/example-pgpow.conf
ez-ipupdate-3.0.11b6-patched/example-dhs.conf
ez-ipupdate-3.0.11b6-patched/example-dyndns.conf
ez-ipupdate-3.0.11b6-patched/example-ods.conf
ez-ipupdate-3.0.11b6-patched/example-tzo.conf
ez-ipupdate-3.0.11b6-patched/example-gnudip.conf
ez-ipupdate-3.0.11b6-patched/example-easydns.conf
ez-ipupdate-3.0.11b6-patched/example-justlinux.conf
ez-ipupdate-3.0.11b6-patched/example-dyns.conf
ez-ipupdate-3.0.11b6-patched/CHANGELOG
ez-ipupdate-3.0.11b6-patched/mkbinary
ez-ipupdate-3.0.11b6-patched/example-heipv6tb.conf
ez-ipupdate-3.0.11b6-patched/config.log
ez-ipupdate-3.0.11b6-patched/config.h
ez-ipupdate-3.0.11b6-patched/config.cache
ez-ipupdate-3.0.11b6-patched/config.status
ez-ipupdate-3.0.11b6-patched/stamp-h
ez-ipupdate-3.0.11b6-patched/Makefile
[root@one util]# cd ez-ipupdate-3.0.11b6-patched     <--- เปลี่ยนไปยัง folder ของ dyns
[root@one ez-ipupdate-3.0.11b6-patched]# ./configure <--- สั่ง config
loading cache ./config.cache
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... (cached) yes
checking for working aclocal... missing
checking for working autoconf... missing
checking for working automake... missing
checking for working autoheader... missing
checking for working makeinfo... missing
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking how to run the C preprocessor... (cached) gcc -E
checking for a BSD compatible install... /usr/bin/install -c
checking return type of signal handlers... (cached) void
checking for gethostbyname... (cached) yes
checking for connect... (cached) yes
checking for socket... (cached) yes
checking for strdup... (cached) yes
checking for getopt_long... (cached) yes
checking for gethostbyaddr... (cached) yes
checking for getservbyname... (cached) yes
checking for inet_addr... (cached) yes
checking for inet_ntoa... (cached) yes
checking for snprintf... (cached) yes
checking for vfprintf... (cached) yes
checking for stat... (cached) yes
checking for vsprintf... (cached) yes
checking for vsnprintf... (cached) yes
checking for strerror... (cached) yes
checking for strftime... (cached) yes
checking for wait... (cached) yes
checking for waitpid... (cached) yes
checking for getpid... (cached) yes
checking for fork... (cached) yes
checking for vfork... (cached) yes
checking for getuid... (cached) yes
checking for geteuid... (cached) yes
checking for setuid... (cached) yes
checking for seteuid... (cached) yes
checking for getgid... (cached) yes
checking for getegid... (cached) yes
checking for setgid... (cached) yes
checking for setegid... (cached) yes
checking for inet_aton... (cached) yes
checking for herror... (cached) yes
checking for arpa/inet.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for fcntl.h... (cached) yes
checking for signal.h... (cached) yes
checking for syslog.h... (cached) yes
checking for pwd.h... (cached) yes
checking for stdarg.h... (cached) yes
checking for grp.h... (cached) yes
checking for errno.h... (cached) yes
checking for sys/sockio.h... (cached) no
checking for sys/wait.h... (cached) yes
checking for getopt.h... (cached) yes
checking for unistd.h... (cached) yes
checking for netinet/in.h... (cached) yes
checking for netdb.h... (cached) yes
checking for sys/socket.h... (cached) yes
checking for sys_errlist in -lc... (cached) yes
checking for getopt... (cached) yes
checking for getpass... (cached) yes
checking host system type... i686-pc-linux-gnu
checking for user supplied default service... no
configure: warning: not setting default service
checking whether user wants debugging support... no
checking whether user wants to dissable MD5 support... no
creating ./config.status
creating Makefile
creating config.h
config.h is unchanged
[root@one ez-ipupdate-3.0.11b6-patched]# make     <--- สั่ง make
gcc -DHAVE_CONFIG_H -I. -I. -I.    -g -O2 -c ez-ipupdate.c
ez-ipupdate.c: In function `main':
ez-ipupdate.c:4627: warning: assignment makes pointer from integer without a cast
gcc -DHAVE_CONFIG_H -I. -I. -I.    -g -O2 -c conf_file.c
gcc -DHAVE_CONFIG_H -I. -I. -I.    -g -O2 -c md5.c
gcc -DHAVE_CONFIG_H -I. -I. -I.    -g -O2 -c cache_file.c
gcc -DHAVE_CONFIG_H -I. -I. -I.    -g -O2 -c pid_file.c
gcc  -g -O2  -o ez-ipupdate  ez-ipupdate.o conf_file.o md5.o cache_file.o pid_file.o
[root@one ez-ipupdate-3.0.11b6-patched]# make install     <--- สั่ง install
make[1]: Entering directory `/home/util/ez-ipupdate-3.0.11b6-patched'
/bin/sh ./mkinstalldirs /usr/local/bin
  /usr/bin/install -c  ez-ipupdate /usr/local/bin/ez-ipupdate
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/home/util/ez-ipupdate-3.0.11b6-patched'
[root@one ez-ipupdate-3.0.11b6-patched]# /usr/local/bin/ez-ipupdate <--- สั่งให้โปรแกรมทำงาน
ez-ipupdate Version 3.0.11b6
Copyright (C) 1998-2001 Angus Mackay.
service: dyns             <--- ให้ใส่  dyns
user name: sermpan         <--- ใส่ชื่อที่เราลงทะเบียนเอาไว้กับ dyns
password: ******           <--- ใส่ password ที่ลงทะเบียนไว้
host: rtrc.dyns.cx       <--- ชื่อ host ที่เราลงทะเบียนเอา สามารถมีได้หลายชื่อ
interface: ppp0           <--- ให้ใส่ ppp0
connected to www.dyns.cx  (213.239.56.191) on port 80.
request successful
[root@one ez-ipupdate-3.0.11b6-patched]#
[root@one ez-ipupdate-3.0.11b6-patched]# cd .. <--- ออกจากที่อยู่ปัจจุบันไปหนึ่ง level
[root@one tmp]# rm -f ez-ipupdate-3.0.11b6-patched.tgz <--- ลบ file ทิ้ง
[root@one tmp]# rm -rf ez-ipupdate-3.0.11b6-patched/   <--- ลบ folder ทิ้ง
[root@one tmp]#
 

การสั่งให้โปรแกรมทั้งสองตัวทำงาน ให้สั่งหลังจากที่เราเปิดเครื่อง Server และต่อไปยัง ISP เรียบร้อยแล้ว
ก็จบการทำ Dynamic DNS 

ที่มา: http://www.thaiadmin.org/board/index.php?topic=8879.0
Signature cleanned by Admin