Archive for October, 2009

Use Proxy Server To Access Internet

October 21, 2009

Q. I’m behind a squid proxy server. How do I access internet via proxy server when I use wget, lynx and other utilities from a shell prompt?

A. Linux / UNIX has environment variable called http_proxy. It allows you to connect text based session / application via the proxy server. All you need is proxy server IP and port values. This variable is almost used by all utilities such as elinks, lynx, wget, curl and others.
Set http_proxy shell variable

Type the following command to set proxy server:
$ export http_proxy=http://server-ip:port/
$ export http_proxy=http://127.0.0.1:3128/
$ export http_proxy=http://proxy-server.mycorp.com:3128/
for password protected proxy:
http_proxy=http://user:passwd@proxy.foo.com:portnumber
How do I setup proxy variable for all users?
To setup the proxy environment variable as a global variable, open /etc/profile file:
# vi /etc/profile
Add the following information:
export http_proxy=http://proxy-server.mycorp.com:3128/
Save and close the file.
How do I use password protected proxy server?
You can simply use wget as follows:
$ wget –proxy-user=USERNAME –proxy-password=PASSWORD http://path.to.domain.com/some.html
Lynx has following syntax:
$ lynx -pauth=USER:PASSWORD http://domain.com/path/html.file
Curl has following syntax:
$ curl –proxy-user user:password http://url.com/

source: http://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/#comments

Disable DNS Lookup in Cisco Routers and Switches

October 17, 2009

This article discusses how you can disable DNS lookup on Cisco routers and switches and effect when DNS lookup is enabled.

Problem: In privilege EXEC mode, if you type in something other than a Cisco IOS command, the router assumes that you typed a domain name and it tries to resolve what ever you type.

Although this feature is can be useful in some situations, for most of the time, this is a pain, especially if you do not have DNS server configured. The router becomes irresponsive for about 5-6 seconds trying to resolve the name.

The following is an example.

R4#wrong-command
Translating “wrong-command”…domain server (255.255.255.255)
(255.255.255.255)
Translating “wrong-command”…domain server (255.255.255.255)

% Unknown command or computer name, or unable to find computer
address
R4#

Solution:

R4#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#no ip domain-lookup
R4(config)#

R4#wrong-command
Translating “wrong-command”

Translating “wrong-command”

% Unknown command or computer name, or unable to find computer address
R4#