[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Proxy-configuration for different network-localtions



The lightweight proxy I use is simpleproxy. In /etc/own/http_file the proxy 
config is described while /etc/init.d/simpleproxy is my init script for it.
I use ifplugd, guessnet and switchconf. In /etc/network/interfaces there are a 
few switchconf invokations for the appropriate config.

/etc/own/http_proxy:
HTTP_PROXY_ADDRESS=192.168.24.11
HTTP_PROXY_PORT=3128

/etc/init.d/simpleproxy:
#! /bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/bin/simpleproxy
# The following value is extracted by debstd to figure out how to generate
# the postinst script. Edit the field to change the way the script is
# registered through update-rc.d (see the manpage for update-rc.d!)
FLAGS="defaults 50"

test -f $DAEMON || exit 0

source /etc/own/http_proxy

case "$1" in
  start)
    start-stop-daemon --start --verbose --exec $DAEMON -- -d -L 3128 -R 
$HTTP_PROXY_ADDRESS:$HTTP_PROXY_PORT
    ;;
  stop)
    start-stop-daemon --stop --verbose --exec $DAEMON
    ;;
  force-reload|restart)
    start-stop-daemon --stop --verbose --exec $DAEMON
    start-stop-daemon --start --verbose --exec $DAEMON -- -d -L 3128 -R 
$HTTP_PROXY_ADDRESS:$HTTP_PROXY_PORT
    ;;
  *)
    echo "Usage: $0 {start|stop|restart|force-reload}"
    exit 1
    ;;
esac

exit 0



/etc/network/interaces:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

auto lo
iface lo inet loopback

auto eth0
mapping eth0
     # Too bad there's no way to pass commandline options to script
     # script /usr/sbin/guessnet -i
     script /usr/sbin/guessnet-ifupdown
     # List of stanzas guessnet should scan for
     map home work
     map default: offline
     map timeout: 8
     map verbose: true

# Work network configuration
iface work inet static
     address 192.168.26.26
     netmask 255.255.252.0
     network 192.168.24.0
     broadcast 192.168.27.255
     gateway 192.168.24.2
     pre-up switchconf work
     # the other guessnet scan:
     test-peer address 192.168.24.1 mac 00:A0:C9:B4:25:62
     #test-peer address 192.168.24.2 mac 00:50:73:3D:65:A0

# Home network configuration
iface home inet ppp
     provider dsl-provider
     pre-up switchconf home
     # guessnet scan:
     test-command /etc/network/testpppoe

# eth0 defaults (I'd really appreciate a 'disabled' method for iface that 
keeps
#                the interface down)
iface offline inet static
     address 192.168.1.2
     netmask 255.255.255.0
     pre-up switchconf offline



Reply to: