Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am behind a corporate firewall in the day, and on an open internet connection at night. I have configured cntlm to forward to my corporate proxy, but when I connect from an open connection, I must re-configure my proxy settings.

Is there a way to make cntlm fallback to using no proxy when there is none available?

# List of parent proxies to use. More proxies can be defined
# one per line in format <proxy_ip>:<proxy_port>
# <~~ something here to fallback to a direct connection when no proxy is available
share|improve this question

cntlm has this on it's roadmap, but I think I solved this problem in a simple way using squid: 1. Install squid on the same machine as cntlm, on port 3129 (just change 3128 to 3129 in squid.conf) 2. Add "Proxy localhost:3129" to the cntlm proxy list

That's it.

Hope this helps.

share|improve this answer
This works flawlessly. – Kshitiz Sharma Jan 8 at 18:45

This solution rewrites the relevant part of the cntlm.conf based on your current IP address:

case "$2" in
          IP=`/sbin/ifconfig  | grep 'inet addr:'| grep -v '' | cut -d: -f2 | awk '{ print $1}'`
          case $IP in
                logger " -set NoProxy for enterprise net"
                NoProxy="NoProxy         localhost, 127.0.0.*, 10.*, 192.168.*,enterprise-intranet"
                logger " - set NoProxy for direct net"
                NoProxy="NoProxy *"
         sudo sed "s/^NoProxy.*$/$NoProxy/g" -i /etc/cntlm.conf
         sudo service cntlm restart
share|improve this answer
Please edit your answer to describe or at least summarize the solution here. External pages can disappear at any time, and we prefer not to rely on them. – 200_success Oct 1 '13 at 7:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.