Archive for August, 2007

Auto Proxy config

I had a little problem. When I am at work I have to go through a proxy server for all internet access. When I am at home I don’t have a proxy server so nothing special is needed there. So this meant that when at work to get aptitude to work I had to do a

export http_proxy="http://name.of.proxy:80"

This really is not that big of an issue but I had to do it every time I opened the terminal. My solution (with the help of some on irc) was this:

ifconfig0=`ifconfig eth0 | grep addr: | awk '{ print $2 }' | cut -d : -f2 | cut -d . -f1 | grep .`
ifconfig1=`ifconfig eth1 | grep addr: | awk ‘{ print $2 }’ | cut -d : -f2 | cut -d . -f1 | grep .`

if [[ "$ifconfig0" == "157" ]] || [[ "$ifconfig1" == "157" ]]
then
export http_proxy=”http://name.of.proxy:80″
else
export http_proxy=”"
fi

I have both a wireless and wired connection and the first part of my IP at work is a 157. The idea here is that if I get a 157 then that means that I am at work and need the proxy. If not them I must be somewhere else and it is not needed.

I added this code to the bottom of my ~/.bashrc and it seems to be working well.

In what ways can I make this better? Are there any other solutions that you can think of?

Advertisements

11 Comments

USTeam Meetup

Tonight we had the Ubuntu USTeams Meet & Greet in #ubuntu-us. If you were not there then you missed out :). There were quite a few teams represented in the 105 or so that were present. If you did miss the event though the logs will be posted online somewhere soon.

We started with a general introduction of the project and the mentors. Then it was a free for all chat session. For about 2 hours it was non stop chatting. It was a great time to get a chance to meet members from some of the other teams.

There was even a new team started. LaserJock stepped up to the plate to start the Nevada LoCo team. Stop by #ubuntu-nevada and say “Hi” to the newest team. If you are in Nevada and want to join up then that would be great too.

It is great to be a part of something as big and as much fun as Ubuntu. Hopefully this will be something that we do on a regular schedule.

Leave a comment