Proxying with QNX

author-image
PCQ Bureau
New Update

A proxy server can be used to share an Internet connection across a network.
After you’ve connected your QNX machine to the Internet (See ‘Going Online
with QNX’, page 56 in this issue), you can install Squid on it and make it a
proxy server. Squid is a popular HTTP proxy in the Linux world that also runs on
QNX. We’ve given the source for Squid on this month’s CD, and in this
article we tell you how to compile it on QNX. Let’s get started without
further ado.

Login as root. Use the Photon File Manager to copy the file squid-2.3.
STABLE4-src.tar.gz found in the directory qnx>utils on the PCQ CD to your
home directory /root. Start the Terminal in Photon and change to the /root
directory by typing ‘cd’. Next, uncompress and untar the Squid source
archive:

tar —zxvf squid-2.3.STABLE4-src.tar.gz

This will create a directory named squid-2.3.STABLE4. Change to this
directory (cd squid-2.3.STABLE4) and issue the following commands to compile the
program:

./configure —host=x86-pc-nto-qnx

make

make install

Open the file squid.conf located in /usr/local/squid/etc directory with a
text editor like vi or Photon Editor. Find the commented (with a # prefix) line
that says:

# cache_effective_group nogroup

Uncomment and change this line to:

cache_effective_group nobody

This is done because the default installation of QNX has a group named nobody
instead of nogroup.

Find the section called ‘ACCESS CONTROLS’ and add the following lines
before the other lines in this section:

acl localip src 192.168.1.0/255.255.255.0

http_access allow localip

This will allow all machines in your network having IP addresses in the range
of 192.168.1.0 to 192.168.1.254 to connect to the proxy.

Now open the Terminal window and type the following commands:

mkdir /usr/local/squid/cache

chown nobody /usr/local/squid/cache

chgrp nobody /usr/local/squid/cache

chown nobody /usr/local/squid/logs

chgrp nobody /usr/local/squid/logs

The first line creates a cache directory, where frequently accessed Web pages
are stored by Squid. Next, since Squid runs as user nobody and group nobody, we
give permissions to this user and group to access and write into directories
cache and log. The latter is used by Squid for logging sites accessed, any
errors that occurred, etc.

We now have to specify a DNS server for the proxy. Open the Photon Editor
again, create a file named resolv.conf in /etc directory, and put the following
line in it.

nameserver 202.54.15.1

where 202.54.15.1 is the domain name server in VSNL, Delhi. You can
substitute the IP address of the DNS server in your region here.

To start Squid for the first time, you must create the cache directories
where Squid can store or cache accessed Websites. This is done as:

/usr/local/squid/bin/squid —z

This command needs to be run only for the first time. Now you can start Squid
proxy by the command:

/usr/local/squid/bin/squid

By default, Squid listens on the port 3128. You can make it listen to another
port say 8000 by changing the line http_port 3128 in squid.conf to http_port
8000. Now, you must tell Squid to re-read the config file using the command:

/usr/local/squid/bin/squid —k reconfigure

That’s it. your QNX proxy server is ready for action. Client browsers just
need to specify the IP address and port number of your QNX machine running Squid
to access the Internet. For more on Squid, refer to the article ‘Squid for
Linux’, page 128, PC Quest October 2000.

Shekhar Govindarajan

Stay connected with us through our social media channels for the latest updates and news!

Follow us: