Configuring Cntlm
If a proxy is required for the server to access the Internet, configure Cntlm.
- Obtain the Cntlm installation package.
- Download the Cntlm installation package using a local browser.
Download address: https://sourceforge.net/projects/cntlm/files/cntlm/cntlm%200.92.3/cntlm-0.92.3.tar.gz
- Upload the downloaded installation package to the server using a tool, such as FTP.
If the server is connected to the Internet, you can run the wget command on the server to download the binary package.
1 2
cd /home wget https://sourceforge.net/projects/cntlm/files/cntlm/cntlm%200.92.3/cntlm-0.92.3.tar.gz --no-check-certificate
- Download the Cntlm installation package using a local browser.
- Decompress installation package.
1tar -xvzf cntlm-0.92.3.tar.gz
- Go to the source code directory.
1cd /home/cntlm-0.92.3/
- Configure Cntlm.
1./configure
- Compile Cntlm.
1make SYSCONFDIR=/opt/cntlm/etc BINDIR=/opt/cntlm/bin MANDIR=/opt/cntlm/share/man
- Install Cntlm.
1make install SYSCONFDIR=/opt/cntlm/etc BINDIR=/opt/cntlm/bin MANDIR=/opt/cntlm/share/man
In the preceding command, BINDIR is the startup directory of the Cntlm, /opt/cntlm/etc is the configuration file directory of the Cntlm, and /opt/cntlm/share/man is the help directory of the Cntlm.
- Configure the cntlm.conf file.
- Open the cntlm.conf file.
1vim /opt/cntlm/etc/cntlm.conf - Press i to enter the insert mode and modify the following content in the file:
Username Domain account name Domain Domain name Password Proxy Proxy IP address:Proxy port Listen 3128 Auth NTLM PassNT 8FD92A7361BB9EE381B9513410D70495 PassLM 04DFBB7DB511E0C448A1F372896AB5AF
Table 1 describes the parameters.
Table 1 Parameters in cntlm.conf Item
Description
Example Value
Username
Domain account name. Set this parameter based on the actual environment.
Enter the domain account name based on the actual environment.
Domain
Domain
Enter the domain name based on the actual environment.
Password
Domain password. You are advised to leave this parameter blank.
-
Proxy
Proxy address and port number of the company
Enter the proxy IP address and port number based on site requirements.
NoProxy
Configure the IP addresses without proxy, including the network segment of the IP address of the current server.
localhost, 127.0.0.*, 10.*, 192.168.*, 90.*
Listen
Listening port number. The default value is 3128.
3128
Authentication configuration
-
Auth NTLM
PassNT 8FD92A7361BB9EE381B9513410D70495
PassLM 04DFBB7DB511E0C448A1F372896AB5AF
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the cntlm.conf file.
- Start Cntlm.
1/opt/cntlm/bin/cntlm -c /opt/cntlm/etc/cntlm.conf
The command for restarting the server is invalid after the server is restarted. You can add the command to the system startup items to enable Cntlm to automatically start with the server.
1echo "/opt/cntlm/bin/cntlm -c /opt/cntlm/etc/cntlm.conf" >> /etc/rc.local
- Check whether Cntlm is started.If the Cntlm process is displayed in the command output, Cntlm is started.
1ps -ef |grep cntlm

- Set the environment variables.
- Open the /etc/profile file.
1vim /etc/profile - Press i to enter the insert mode and add the following content to the file:
export http_proxy="http://127.0.0.1:3128" export https_proxy=$http_proxy export JAVA_OPTS="-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128" export MAVEN_OPTS="-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3128"
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Make the environment variables take effect.
1source /etc/profile
- Open the /etc/profile file.
- Verify Cntlm.
Run the curl command to obtain the web page content. If the web page content is successfully obtained, Cntlm is successfully installed.
1curl www.baidu.com