ip and port forwarding

Feb-9th-2011

Hello Friends,

IP Forwarding | Port Forwarding | Redirects TCP connections from one IP address and port to another

Since 3 days i was in trouble, i want to redirect my all incoming request port 8080 (i.e.) to remote machine port 8080. I have set lots of iptables rules but none of those working on internet or live environment.

The iptables rules which i tried are below and it was working perfectly in local environment but not in live environment :-

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp -s *route_only_for_this_ip* -d *router_ip* –dport 80 -j DNAT –to *destination_ip*:*destination_port*
iptables -t nat -A POSTROUTING -o eth0 -d *destination_ip* -j SNAT –to-source *router_ip*

After spending little bit time on google i found “rinetd” software that work great in ip and port redirection for live environment.

rinetd redirects TCP connections from one IP address and port to another or remote machine,rinetd is a single-process server which handles any number of connections to the address/port pairs specified in the file /etc/rinetd.conf.

Since rinetd runs as a single process using nonblocking I/O, it is able to redirect a large number of connections without a severe impact on the machine. This makes it practical to run TCP services on machines inside an IP masquerading firewall. rinetd does not redirect FTP, because FTP requires more than one socket.

rinetd is typically launched at boot time, using the following syntax:

/usr/sbin/rinetd

The default config file for rinetd is :- /etc/rinetd.conf

[root@map007]# wget http://www6.atomicorp.com/channels/atomic/centos/5/i386/RPMS/rinetd-0.62-6.el5.art.i386.rpm

[root@map007]#  vim /etc/rinetd.conf

# example configuration file for rinetd
#
# to forward connections to port 80 on 10.10.10.2 to port 80 on 192.168.0.2
10.10.10.2 8080 61.x.x.x 8080

# to forward connections to port 80 on all addresses to port 80 on 192.168.0.2
# access controls can be set with allow and deny rules
# allow and deny before the first forwarding rule are global
# allow and deny after a specific rule apply to it only

# this rule allows hosts from 172.16.32.0/24 netblock
allow 10.10.10.*

# this rule denies the host 192.168.32.12
# deny 192.168.32.12

# rinetd supports logging – to enable, uncomment the following
logfile /var/log/rinetd.log

# by default, logs are in a tab-delimited format. Web common-log format
# is available by uncommenting the following
logcommon

Now save and exit. And restart rinetd service.

[root@map007]#  /etc/init.d/rinetd restart

===============================================================================

Enjoy Linux !!!

How to install Skype on Ubuntu

Feb-5th-2011

Hello Friends,

Skype is proprietary software that allows you to make calls over the Internet using your computer. Skype uses decentralized peer-to-peer technologies, so your calls do not go through a central server, but through distributed servers and other users. It uses its own proprietary communication protocol to achieve this. In addition, all communications are encrypted from end to end so that others cannot listen in. The Skype software is free to use, but it is not free software; the source code is proprietary and not available for modification.

Since Ubuntu 10.04 (Lucid Lynx), Skype is part of the Canonical partner repository. To install Skype add the Canonical Partner Repository.

Go to System > Administration and you should see Software Sources in the menu.

The “Third-Party Software” tab is where you will be able to add the Canonical Partner Repositories. You will see two Canonical Partner repositories listed – one for applications and another for source code (src). The partner repositories offer access to proprietary and closed-source software and are not enabled by default. Users must specifically enable these ‘partner’ repositories. Select “Close” and “Reload” to save and update the database if you chose to add either or both of them.

Now run the following commands in your terminal.

[piyush@ubuntu ~]# sudo apt-get update

[piyush@ubuntu ~]# sudo apt-get install skype

Now you can access Skype from the Applications –> Internet –>Skype.

============================================================================

Enjoy Linux !!!