免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4370 | 回复: 0
打印 上一主题 下一主题

[samba] 新手配置samba+squid+iptables+端口映射共享 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-28 12:32 |只看该作者 |倒序浏览
我是一个刚接触linux的菜鸟,经过一段时间的学习和实践,把公司的linux网络配置成功,把里面我遇到的问题,和错误提供给大家,希望多多指教。
samba.config
#======================= Global Settings =====================================
[global]
        
        log file = /var/log/samba/%m.log
         client code page =936        可是在linux网络里面看win网络还是出现乱码
         unix charset =cp936
         dos charset = cp936   看了许多帖子加上这3个就不会有乱码,以前也弄好过,可先不知道怎么不行了
        load printers = yes
        idmap gid = 16777216-33554431
        socket options = TCP_NODELAY SO_SNDBUF=8192 SO_RCVBUF=8192 #网络协议
        deadtime = 5  #连接被视为无效而断开,未激活时间
        winbind use default domain = no
        template shell = /bin/false
        wins support = true   #wins服务
        dns proxy = no    #dns代理
        cups options = raw  
        server string = Samba Server
        idmap uid = 16777216-33554431
        workgroup = MYGROUP  #构建的域名
        os level = 64   #操作系统
        printcap name = /etc/printcap
        security = share   #共享的安全级别
        max log size = 50  
# Enable this if you want Samba to be a domain logon server for
# Windows95 workstations.
   domain logons = yes  #域登陆


# run a specific logon batch file per username
   logon script =netlogon.bat  #登如的脚本

# Where to store roving profiles (only for Win95 and WinNT)
#        %L substitutes for this servers netbios name, %U is username
#        You must uncomment the [Profiles] share below
   logon path = \\%L\Profiles\%U #win用户登陆的配置文件
============================ Share Definitions ==============================
[homes]
   comment = Home Directories
   browseable = no
   writable = yes

# Un-comment the following and create the netlogon directory for Domain Logons
[netlogon]
   comment = Network Logon Service
   path = /home/netlogon
   guest ok = yes
   writable = no
   share modes = no
   write list = user
   public = yes
   write list = @it

# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
[Profiles]
    path = /home/profiles
    browseable = no
    guest ok = yes
    writeable = yes
      


# NOTE: If you have a BSD-style print system there is no need to
# specifically define each individual printer
[printers]
   comment = All Printers
   path = /var/spool/samba
   browseable = no
   printable = yes

squid 配置
http_port 192.168.1.:8080
cache_mgr  name@email.com   出错时候管理员的email
cache_dir ufs /var/spool/squid 100 16 256 MB
cache_access_log /var/log/squid/access.log   用户的访问记录
cache_log /var/log/squid/cache.log   调试登陆文件
cache_store_log /var/log/squid/store.log  储存登陆文件
visible_hostname  no.1proxy    显示服务器的名字
如果不写会提示错误的

iptables
vi /etc/sysconfig/iptables
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 3128 -j ACCEPT
iptables -A INPUT -i eth1 -p icmp -m limit --limit 5/s -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 -j MIRROR

# NAT
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE

# DNAT RADMIN to PRIVATE
iptables -A PREROUTING -t nat -i ppp0 --dport 4899 -j DNAT --to 192.168.0.2
iptables -A PREROUTING -t nat -i ppp0 --dport 5000 -j DNAT --to 192.168.0.3:4899

# SQUID
iptables -A PREROUTING -t nat -i eth1 -p tcp -s 192.168.0.0/24 --dport 80 -j REDIRECT --to 3128

# FORWARD edit by Platinum
iptables -A FORWARD -p tcp --dport 21 -j ACCEPT    # FTP
iptables -A FORWARD -p tcp --dport 22 -j ACCEPT    # SSH
iptables -A FORWARD -p tcp --dport 23 -j ACCEPT    # TELNET
iptables -A FORWARD -p udp --dport 53 -j ACCEPT     # DNS
iptables -A FORWARD -p tcp --dport 80 -j ACCEPT    # HTTP
iptables -A FORWARD -p tcp --dport 443 -j ACCEPT    # HTTPS
iptables -A FORWARD -p udp --dport 8000 -j ACCEPT    # QQ
iptables -A FORWARD -p tcp --dport 25 -j ACCEPT    # SMTP
iptables -A FORWARD -p tcp --dport 110 -j ACCEPT    # POP3
iptables -A FORWARD -p tcp --dport 4899 -j ACCEPT    # RADMIN
iptables -A FORWARD -p tcp --dport 1863 -j ACCEPT   # MSN (you must allow port 443)
iptables -A FORWARD -p icmp -j ACCEPT

# KEEP ON CONNECTIONS
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

# exchange the "SOURCE" and "DESTINATION" of other packets, and SEND it out !!!
iptables -A INPUT -j MIRROR
这个也很强的,在学习中
http://bbs.chinaunix.net/viewthr ... =iptable&page=1

这个是参考斑竹的
端口映射出现的问题  
iptables -A PRETOUTING -d 218.x.x.x - p tcp --dport 80 -j DNAT --to 192.168.1.253
iptables -A PRETOUTING -d 218.x.x.x - p tcp --dport 5001 -j DNAT --to 192.168.1.253
iptables -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
这样是ok
如果不通的话,请查看你是不是安装了
iptables_nat ,ip_tables,ipt_MASQUERADE
这几个模块,如果没有安装的话就不能映射,这个问题困饶了我n天
可以在/sbin/lsmod查看模块
也可以在root下lsmod查看,挂接命令modprobe
如果想封qq和分时间段上网还要+string和time模块,这2个模块我在添加的时候没有成功,可能要去下载,在研究中

还有一个问题就是socks协议问题,这个需要下载一个socks5.tar.gz文件
使用方法很容易搜到
我在./configure的时候出现
no acceptable cc found in $path错误
搜了一下,发现自己把gcc没有装上,如果出现这个问题,把gcc装上就可以了(这个问题可能比较菜的会出现,比如我~嘿嘿)
这就是我在配置网络的时候出现的问题,我解决办法,希望能帮助一些和我一样菜的兄弟们~~~


在这里我也感觉baidu.com   google.com 和chinaunix.net和platinum 和兄弟们的帮助

我会一直努力,谢谢,谢谢~~哈哈
里面如果有什么不对的地方和问题,请各位多提意见,在这里小弟谢谢了

[ 本帖最后由 mantovine 于 2006-4-28 12:39 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP