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 an SFTP tool.
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 the Cntlm installation package.
1tar -xvzf cntlm-0.92.3.tar.gz
- Go to the Cntlm 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 Cntlm startup directory, /opt/cntlm/etc is the directory of the Cntlm configuration file, and /opt/cntlm/share/man is the directory of the Cntlm help guide.
- Configure the cntlm.conf file.
- Open the file.
1vim /opt/cntlm/etc/cntlm.conf - Press i to enter the insert mode and modify the following content in the file. Set the parameters based on actual requirements.
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 Parameter
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 the actual environment.
NoProxy
Configures the IP addresses without a proxy, including the IP address segment 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 file.
- Start Cntlm.
1/opt/cntlm/bin/cntlm -c /opt/cntlm/etc/cntlm.conf
If the command for restarting the server is invalid, you can add Cntlm 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.
1ps -ef |grep cntlm
If the Cntlm process is displayed in the command output, Cntlm is started.

- Configure 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 access any website. If the website information is displayed, the proxy is successfully configured and the Internet is connected, indicating that the installation is successful.