Title: Test Proxy, VPN and ssh Tunnels
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Test Proxy, VPN and ssh Tunnels

Proxy servers can be susceptible to any network connectivity issues, and the administrator would troubleshoot them like any other server.  However, for clients who use proxy servers, it is possible to test that the server is available.  Check the hostname and/or IP address of the server and the port number, then run "nmap -P0 -p <port> <host>".  If the status is blocked, there may be a firewall issue.  If the status is closed, the service may be down temporarily.  If the status is open, w orrk with the proxy administrator to resolve the issue.

Below are images showing examples of the nmap command.

[root@darkstar ~]#
[root@darkstar ~]# nmap -PN sS -O Scanme.Nmap.Org

Starting Nmap 5.21 ( http://nmap.org ) at 2010-04-01 11:19 IDT
Nmap scan report for Scanme.Nmap.Org (64.13.134.52)
Host is up (0.18s latency).
rDNS record for 64.13.134.52: scanme.nmap.org
Not shown: 993 filtered ports
PORT        STATE SERVICE
25/tcp        closed smtp
53/tcp        open domain
70/tcp        closed gopher
80/tcp        open http
113/tcp      closed auth
8009/tcp    open        ajp13
31337/tcp  closed Elite
Device type: general purpose
Running: Linux 2.6.X
OS details: Linux 2.6.15 - 2.6.26

OS detection performed. Please report any incorrect results at http://nmap.org/submit/
Nmap done: 1 IP address (1 host up) scanned in 16.99 seconds
[root@darkstar ~]#

Source: "Nmap-5.21" by Tuankiet65 (bicara · kontrib) - Karya sendiri. Licensed under Public domain via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Nmap-5.21.png#mediaviewer/File:Nmap-5.21.png

root@iteduzero:~# nmap -sU -sT -0 -A 192.168.1.65

Starting Nmap 4.20 ( http://insecure.org ) at 2007-01-25 23:57 CET
Interesting ports on 192.168.1.65:
Not shown: 3177 closed ports
PORT           STATE                SERVICE VERSION
22/tcp         open                   ssh         OpenSSH 4.3p2 Debian 5ubuntu1 (protocol 2.0)
25/tcp         open                   smtp       Postfix smtpd
80/tcp         open                   http        Apache httpd 1.3.34 ((Ubuntu) mod_perl/1.29)
1234/tcp     open                   monopd  monopd 0.9.3
6112/tcp     open                   bnetd      PvGN BnetD Mod 1.5.0
68/upd        open | filtered      dhcpc 123/upd      open                   ntp          NTP v4
5555/udp    open | filtered      rPlay
Device type: general purpose
Running: Linux 2.6.X
OS details: Centos 4.3 Linux 2.6.17 11-grsec (Centos 4.3, X86) Network Distance: 0 hops
Service Info:  Host:  siteduzero; OSs: Linux, Unix

OS and Service detection performed. Please report any incorrect results at http:
//insecure.org/nmap/submit/ .
Nmap finished: 1 IP address (1 host up) scanned in 58.331 seconds
root@siteeduzero:~#

Source: By Taonas (Own work) [GFDL (http://www.gnu.org/copyleft/fdl.html) or CC-BY-SA-3.0 (http://creativecommons.org/licenses/by-sa/3.0/)], via Wikimedia Commons

Virtual Private Network (VPN) connections are usually implemented through IP tunnels.  This means that the client and the server uses specific IP addresses and ports to carry the encrypted traffic which is going through the tunnel.  If there are issues with the VPN connections, start by running nmap from the client to the appropriate port on the server, for example "nmap -P0 -sU -p1194 openvpn.sample.com".  If that succeeds, try restarting the VPN service and checking for errors.  Finally, try connecting to a server on the remote LAN.  If it fails, work with the VPN administrator to troubleshoot further.

Traffic can be tunneled through ssh in a way similar to a VPN.  To test an ssh tunnel, find all running instances of ssh by running "ps -f `pidof ssh`".  A tunnel will have the -f flag, for example "ssh -fNL 8080:www:80 user@jumpbox".  Since this process is running, an ssh connection was successfully made.  On the client computer run "nmap -P0 -p8080 localhost" to test the tunnel.  If the test fails, make an interactive ssh connection to the server and run "nmap -P0 -p80 www".  If the result is "host not found", find the full hostname or IP address of the web server.  On the client, kill the existing ssh process and then start a new one using the working hostname or IP address instead of www.