How to redirect ports to access Gmail, Yahoo,
Hotmail etc. via a different port number on Debian Linux
The university where I study right now
ABS - (Arnhem Business
School) does some outbound port filtering.
Therefore I couldn't access my Gmail email through POP3 neither
send my emails via the SMTP protocol.
In other words
the port numbers 25, 110, 995 and 143 are
filtered by the University System Administrator, or whoever did
built the University network.
This I found pretty annoying because I've noticed the Teachers who
work on their Desktops are able to access their email addresses via
a normal
POP3 and SMTP protocols .
Of course there is likely a good reason that the university filters
the traffic for students accessing internet via their notebooks
through the Internal built University wireless network, however as
I feel very convenient with checking my mail via Thunderbird
(Icedove), it's really, really irritating to go for a browser each
and every time I'd like to check my Gmail.
In that reason an idea come to my mind to get through the
SMTP,
POP and IMAP protocol access restrictions.
The idea is not something brilliant or something too smart, however
it prooved to work so I was quite happy with it.
My idea was to simply use my personal Linux router as a jumping off
place to access gmail.
To do so first think I did was to scan my Linux router and check
which ports are filtered from Arnhem Business School University
firewall and which one are allowed to pass traffic.
After a while I have found out that the
ports range from 2010 up
to 2050 are freely allowing traffic to pass without any
firewall restrictions.
Thus my next logical step I took was to configure my Linux router
to pass by all incoming traffic on ports
2050 and 2060 to
Gmail servers for POP3 email access pop.gmail.com and
the other one responsible for
sending emails via the SMTP
protocol -
smtp.gmail.com
In order to fulfill my desired task I first experimented a bit with
some
iptables nat PREROUTING redirect to destination
rules.
However after many tries without success I finally decided to
abandom this approach and try with another one.
I've remembered that some time ago I've used a
tiny Linux
software called rinetd that makes the port forwardking,
redirections a piece of cake
RINETD is really straight forward to install and use on
Debian Linux. To make the actual port redirects first you will have
to install
rinetd
1. Install rinetd
debian-desktop:~# apt-get install rinetd
2. Configure rinetd by editting /etc/rinetd.conf to make the
redirects to gmail or any other pop3 mail server host
Open up the /etc/rinetd.conf with your favourite text editor and
for a gmail redirect place the lines:
83.228.93.76 2010 74.125.65.109 995
83.228.93.76 2050 74.125.65.109 25
In the above configuration directives the first IP address
83.228.93.76 should be changed and adjusted with your actual
Linux router external IP address.
The second option
2010 is the port number to accept
connections from your host to be redirected to the IP
74.125.65.109 , the last argument is the
port number to
where you desire to redirect 995.
In the above example I've used the IP
74.125.65.109 which
actually a gmail server IP address I have obtained through
resolving
smtp.gmail.com and pop.gmail.com
In order to conduct the resolve I issued the commands:
3. Resolve pop.gmail.com and smtp.gmail.com to find out their
actual IP addresses, which you will have to use in your port
redirect
hipo@debian-desktop:~$ host pop.gmail.com
pop.gmail.com is an alias for gmail-pop.l.google.com.
gmail-pop.l.google.com has address 74.125.43.109
hipo@debian-desktop:~$ host smtp.gmail.com
smtp.gmail.com is an alias for gmail-smtp-msa.l.google.com.
gmail-smtp-msa.l.google.com has address 74.125.43.109
hipo@debian-desktop:~$
All left to be done to have the port redirections active is to run
up the rinetd service, to do so issue:
debian-desktop:~# /etc/init.d/rinetd start
That's all, now go to your Thunderbird, Outlook or any POP3 email
client of choice and just change the mail server hosts and ports
with your Linux router IP address and ports where you just binded
the redirect.Of course the Linux router IP could also be used, if
you don't have a hostname associated with it.
END---