LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1352|回复: 13

内网建ftp的问题

[复制链接]
发表于 2004-6-7 18:36:19 | 显示全部楼层 |阅读模式
内网中有四台机子通过多功能宽带路由器上网。想在内网中架设个ftp,让外网也能访问。我进行了如下操作:

       1. 在我的机子上装了vsftp,并配置完毕。
       2. 在路由器上设好了端口映射。
       2. 到 www.3322.org 申请了动态域名 ftpdownloads.3322.org,同时也下载了客户端程序ez-ipupdate。
       3. 我的ez-ipupdate的配置文件qdns.conf 文件内容如下:

------------------------------------------------------------------------------
#!/usr/local/bin/ez-ipupdate -c
#
# example config file for ez-ipupdate
#
# this file is actually executable!
#

#下面动态域名和静态域名选一个

#动态域名
service-type=qdns
#静态域名
#service-type=qdns-static

#设置用户名和密码
user=guanhuaming:xxxxxx

#你需要更新的域名
host=ftpdownloads.3322.org

#你的网络端口
interface=eth0

#如果使用通配符,请将下面的注释去掉
#wildcard

#如果使用邮件服务器(mx)
#mx=mx.abc.com


max-interval=2073600

# please create this file and ensure that the user that ez-ipupdate is running
# as has write permissions to it then uncomment this line, if you don't your
# dyndns account will probably get banned. if you run ez-ipupdate as root (bad
# idea, use "run-as-user") then you can just uncomment this line.
#cache-file=/etc/ez-ipupdate.cache.eth1

# for the mean time we'll just use a cache file in the temp directory
cache-file=/tmp/ez-ipupdate.cache

# uncomment this once you have everything working how you want and you are
# ready to have ez-ipupdate running in the background all the time. to stop it
# you can use "killall -QUIT ez-ipupdate" under linux.
#daemon
--------------------------------------------------------------------------

4. 运行ez-ipupdtae -c qdns.conf 命令后,显示如下:
-----------------------------------------------------------------------------
Incorrectly built binary which accesses errno or h_errno directly. Needs to be fixed.
ez-ipupdate Version 3.0.10
Copyright (C) 1999-2000 Angus Mackay.
no update needed at this time
----------------------------------------------------------------------

5. 接着我试着在我自己的机子上访问我建的ftp:
    ftp ftpdownloads.3322.org
可以访问,显示如下:
----------------------------------------------------------------------
[root@localhost ez-ipupdate]# ftp ftpdownloads.3322.org
Connected to ftpdownloads.3322.org (192.168.1.85).
220 (vsFTPd 1.2.1)
Name (ftpdownloads.3322.org:root): ftpdown
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,1,85,163,50)
150 Here comes the directory listing.
-rwxr-----    1 0        500      34896138 May 09 19:16 linux-2.6.6.tar.bz2
-rwxr-----    1 0        500       1851179 May 22 03:03 patch-2.6.6-bk8.bz2
drwxr-xr-x    3 0        0            4096 May 23 23:37 proE wildfire for linux
226 Directory send OK.
ftp>
--------------------------------------------------------------------

可为什么外网的人没法访问我的ftp?在windows中已经成功配好了,并且外网可以访问。
 楼主| 发表于 2004-6-7 20:19:58 | 显示全部楼层
自己已搞定,谢谢!
发表于 2004-6-7 23:11:19 | 显示全部楼层

大哥 把你的原因说出来阿!!

这样我以后遇到这样的问题就省得在 问大哥了 对不对阿!!

谢谢 !!!
发表于 2004-6-7 23:34:49 | 显示全部楼层
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
# Destination NAT for FTP
iptables -t nat -A PREROUTING -p tcp --dport 21 -j DNAT --to $FTL_localnet
# FTP forward
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p tcp -d $FTL_localnet --dport 21 -m state --state NEW -j ACCEPT

#$FTL_localnet 为localnet的ftp服务器.
发表于 2004-6-7 23:38:25 | 显示全部楼层
这个版面有很多的人都是自己解决了问题就拍拍屁股走人:-)
发表于 2004-6-8 00:24:44 | 显示全部楼层
最初由 guanhuaming 发表
自己已搞定,谢谢!


可以写出什么问题吗 ,,,
发表于 2004-6-8 10:49:31 | 显示全部楼层
呵呵,它是说外网的不能访问其内网的ftp服务器吧。现在解决了。
发表于 2004-6-8 12:10:45 | 显示全部楼层
把问题解决的过程写出来,
让大家受点益呀,
提个建议,不写出来斑竹就封他的id。。。:)
发表于 2004-6-8 13:14:03 | 显示全部楼层
上回也有一位,自己解决了,就跑了,好像怕人家偷偷了他的东西一样。所以,再遇到此种人,偶还是少回答的好。偶上面给的那几条iptables是可让外网的访问内网的ftp的。但如果想内网的人还能访问。
加上一条语句:
iptables -t nat -A POSTROUTING -d $FTL_localnet--dport -p tcp  21 -j SNAT --to $Gate_ip
发表于 2004-6-9 12:35:43 | 显示全部楼层
faint
是不是忘记加22端口了!ftp有二个端口的!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表