如何使用cntlm配置代理上网

来源:互联网 发布:欧盟 知乎 编辑:程序博客网 时间:2024/05/16 03:42

问题:

公司网络使用了域账号管理机制,上网必须配指定的机器名和域名,最头痛的是还需要密码,访问网站经常弹出输入用户名密码的窗口,很多软件都不能自动升级。


解决办法:

是使用 Cntlm Authentication Procxy进行代理的转换,把公司的代理转成本地的标准代理。这样虚拟机内部的系统也就可以上网了^_^。而且使用了cntlm以后,公司的限制就没有了 哈哈

下面介绍配置方式:

软件官网:http://cntlm.sourceforge.net/ 是开源的哦!可以在linux和window下运行。

windows版本:http://ftp.awk.cz/cntlm/win32/cntlm-0.91rc6-setup.exe 

 

安装windows版:

1、下载cntlm-0.91rc6-setup.exe。

2、默认安装到"C:\Program Files\Cntlm",不要改变目录否则服务启动不了。


3、修改配置文件cntlm.ini

第8行 设定基本信息

Username 你的域用户名
Domain   公司分配的域名
Password 登录域密码

第29行 代理信息

Proxy  公司代理ip:端口

其余默认即可,如下图。


红色框选的内容是必须要有的配置

4、启动服务

点击开始菜单->cntlm->Start Cntlm Authentication Proxy即可启动服务

 

配置上网:

打开ie浏览器,设置代理上网方式为127.0.0.1:3128

3128是Cntlm服务使用的端口号,在cntlm.ini里面有默认的配置,也可以修改。

ok,下面就可以上网啦!!!

=======================================

LINUX系统下:

1.下载并安装cntlm-0.35.1.tar.gz

sudo ./configure

sudo make

sudo make install

2.修改配置文件

sudo vi /usr/local/etc/cntlm.conf

用户名

密码

workstation :liyang9

代理

3.设置cntlm的环境变量(可通过界面 network proxy)

   将

export http_proxy=http://localhost:3128/
export https_proxy=${http_proxy}
export ftp_proxy=${http_proxy}

写入~/.bash_profile

4.启动cntlm 命令sudo cntlm -c /usr/local/etc/cntlm.conf &  //最好将这一句加到/etc/rc.local启动项中,免得每次开机都要运行一下。

================================guoliang  ‘s   doc =========================

This is the basic procedure to install cntlm on your GNU/Linux machine.
1、Download the source tarball from http://cntlm.sourceforge.net
2、Unzip with tar -vxzf <path-to-tarball>.
3、cd into the resulting directory.
4、Run ./configure.This will install cntlm in /usr/local.
5、Edit the Makefile. Replace SYSCONFDIR=/usr/local/etc by SYSCONFDIR=/etc
6、Type make
7、Type sudo make install
8、Edit the /etc/cntlm.conf file as mentioned in the end.
9、do: $chmod 644 /etc/cntlm.conf as root.  Since the /etc/cntlm.conf was created by root, chances are that, cntlm will not be able to access the file. 
10、Then, start cntlm by typing : cntlm&  (有时配置会有错误,因此建议使用cntlm -v先查看是否可以启动成功,不成功则检查错误,如果确认可以启动成功后,ctrl+c取消当前进程,再输入cntlm&进入后台运行模式)




11、添加代理变量。
对于redhat,ubuntu以及fedora等常用linux系统,均有设置网络代理(network proxy)的菜单项,在里面代理地址上填写127.0.0.1,代理端口填写自己设置的端口数字,默认为3128。应用到整个系统,重启已经打开的终端即可(为了读取配置的网络代理变量值)。



如果使用的普通定制的linux系统不支持界面设置网络代理,则按以下操作:
根据自己实际的端口号或者IP地址分别替换3128或者localhost(如果是本机,localhost不用替换),具体端口号见/etc/cntlm.conf
export http_proxy=http://localhost:3128/
export https_proxy=${http_proxy}
export ftp_proxy=${http_proxy}

不想每次打开终端都有添加一次,可以把以上三行添加到用户目录下面的.bash_profile的最后


12、通过测试wget URL测试连接是否成功,URL用具体的网址替换,例如http://www.baidu.com


13、Reference: http://iitmlug.a.wiki-site.com/index.php/Cntlm


/etc/cntlm.conf


###start cntlm.conf
#
# Cntlm Authentication Proxy Configuration
#
# NOTE: all values are parsed literally, do NOT escape spaces,
# do not quote. Use 0600 perms if you use plaintext password.
#




Username <your username>  #代理用户名,海信为邮箱前缀
Domain iitm.ac.in       #域名,海信为hisense.ad
Password <your password># Use hashes instead (-H)密码
Workstation netbios_hostname# Should be auto-guessed主机名,海信的填写与用户名一致


Proxy hproxy.iitm.ac.in:3128   #验证代理的地址和端口,海信的这样填写172.16.2.101:80
#Proxy 10.217.112.42:8080


#
# This is the port number where Cntlm will listen
#
Listen <your choice of port here>      #自己的配置端口


#
# Use -M first to detect the best NTLM settings for your proxy.
# Default is to use the only secure hash, NTLMv2, but it is not
# as available as the older stuff.
#
# This example is the most universal setup known to man, but it
# uses the weakest hash ever. I won't have it's usage on my
# conscience. :) Really, try -M first.
#
Auth LM #授权类型
#Flags 0x06820000


#
# Enable to allow access from other computers
#
#Gateway yes


#
# Useful in Gateway mode to allow/restrict certain IPs
#
#Allow 127.0.0.1
#Deny 0/0


#
# GFI WebMonitor-handling plugin parameters, disabled by default
#
#ISAScannerSize 1024
#ISAScannerAgent Wget/
#ISAScannerAgent APT-HTTP/
#ISAScannerAgent Yum/


#
# Headers which should be replaced if present in the request
#
#Header User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)


#
# Tunnels mapping local port to a machine behind the proxy

#Tunnel 1122:awk.cz:443
##end cntlm.conf




2011.12.10修改  by liang guo
 

原创粉丝点击