Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>
#
Proxy       10.73.55.44:80
# <~~ something here to fallback to a direct connection when no proxy is available
share|improve this question

2 Answers 2

This solution rewrites the relevant part of the cntlm.conf based on your current IP address: http://mirkoweber.blogspot.hu/2011/10/using-cntlm-in-changing-environment.html

#!/bin/sh
case "$2" in
    up|vpn-up)
          IP=`/sbin/ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
          case $IP in
             172.*)
                logger "setNoProxy.sh -set NoProxy for enterprise net"
                NoProxy="NoProxy         localhost, 127.0.0.*, 10.*, 192.168.*,enterprise-intranet"
                ;;
               *)
                logger "setNoProxy.sh - set NoProxy for direct net"
                NoProxy="NoProxy *"
                ;;
            esac
         sudo sed "s/^NoProxy.*$/$NoProxy/g" -i /etc/cntlm.conf
         sudo service cntlm restart
         ;;
esac
share|improve this answer
1  
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

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

Your Answer

 
discard

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.