4. The Proxy

4.1. Installing the server

The proxy server is a simple out-of-the box Squid proxy on a virtual Ubuntu server. The installation script is below:

echo '*********************************************************'
echo '*********************************************************'
echo '*********************************************************'
echo '* Setup precise1 start *'
echo '*********************************************************'
echo '**************PROXY**************************************'
echo '*********************************************************'

function aptget {
    DEBIAN_FRONTEND=noninteractive apt-get -y \
     -o Dpkg::Options::="--force-confdef" \
     -o Dpkg::Options::="--force-confold" \

aptget -y update
aptget -y upgrade

ifconfig eth1 netmask up
route add -net netmask gw

netstat -rn

aptget install -y squid
aptget install -y squid-deb-proxy
aptget install -y language-pack-en
cp /vagrant/squid.conf /etc/squid3/squid.conf
service squid3 restart

cat > /etc/resolv.conf <
search server

At the end of the script, we set the nameserver to This is done after all the apt-gets, because our own DNS server does not resolve the hostnames needed for the apt-get. It is also important to see that the DNS server is the server server, for the .server hostnames, that is.

The squid.conf contains:

#Recommended minimum configuration:
acl manager proto cache_object
acl localhost src
acl to_localhost dst
acl localnet src
acl SSL_ports port 443
acl Safe_ports port 80     # http
acl Safe_ports port 21        # ftp
acl Safe_ports port 443        # https
acl Safe_ports port 70        # gopher
acl Safe_ports port 210        # wais
acl Safe_ports port 1025-65535    # unregistered ports
acl Safe_ports port 280        # http-mgmt
acl Safe_ports port 488        # gss-http
acl Safe_ports port 591        # filemaker
acl Safe_ports port 777        # multiling http



http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports

http_access deny to_localhost
icp_access deny all
htcp_access deny all

http_port 3128
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid3/access.log squid

#Suggested default:
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern .        0    20%    4320
# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid3

# Allow all machines to all sites
http_access allow all

This is more or less a minimal setup for Squid.

4.2. Split DNS

Split DNS, also called split brains or split horizon, is a method that separates the internal DNS from the external DNS. There are a number of reasons for keeping a split DNS, most of which have some security aspects. The idea behind it is very simple: there are two instances of DNS, that do not share data. This is exactly how we set-up our network: the client does not know about the server hostnames and vice-versa.

On the client (our Windows 10), the nameserver is precise2. We can see this by issuing ipconfig /all on the command prompt. The result will contain:
DNS Servers . . . . . . . . . . . . . :

This means, that our Windows 10 system can resolve all the client addresses, but not the server addresses:
Default Server:  dns.client
> proxy.client
Server:  dns.client
Name:    proxy.client
Server:  dns.client
*** dns.client can't find web.server: Query refused

On the other hand, the proxy's DNS points to the server side. The same nslookup set here gives:
vagrant@precise64:~$ nslookup
> proxy.client
** server can't find proxy.client: NXDOMAIN
> web.server
Name:	web.server

4.3. Using the proxy

There are many ways to set a proxy on Windows 10. You can do it system-wide or just for a single application. I choose the latter. Under the 3-points menu in the Edge browser, under Advanced, there is a setting Proxy Setup. Via the Open Proxy Settings button, you can manually set a proxy. Use on port 3128.

When we now browse to http://webserver/index.lighthttpd.html, we see our default Placeholder Page. So, how does that work?

Our browser sends the complete http-get request to the proxy.


We see the packet coming from (Windows 10) to, our proxy server. We also see that the destination port of the packet is 3128, which is the proxy port and not the http port. In the request, we see the complete http request to the URL. The client has done nothing to resolve the host name, it just sends it in the request to the proxy and lets the proxy handle it.

If you look at the rest of the traffic, you can see that Microsoft Edge is very noisy. Most of the other requests fail, because our proxy does not work for the Internet. We see calls to login.live.com, www.w3.or/Icons, nav.smartscreen.microsoft.com, which all fail here, but normally just slow down your browser.

On our proxy, we see the following traffic. You may need to restart the proxy, because otherwise it might serve from cache.


What we see is that the proxy first gets the http-request fro, our Windows 10 server. This results in a DNS query to, our server DNS (frame 116), from which it gets its response. The response in 232 says that web.server is at, and the DNS answer is to the proxy, not to the client.

Next, the proxy sets up a session to the web server to get the web page.