Install rinetd
Port forwarding/redirection is the simplest traffic manipulation technique we will examine. It involves accepting traffic on a given IP address and port and then simply redirecting it to a different IP address and port . A simple port-forwarding tool such as rinetd is convenient and easy to configure.
root:~ /# apt-get install rinetd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libafpclient0 libcrypt-passwdmd5-perl
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
rinetd
0 upgraded, 1 newly installed, 0 to remove and 32 not upgraded.
Need to get 22.9 kB of archives.
After this operation, 143 kB of additional disk space will be used.
Get:1 http://repo.kali.org/kali/ kali/main rinetd i386 0.62-5.1 [22.9 kB]
Fetched 22.9 kB in 1s (18.4 kB/s)
Selecting previously unselected package rinetd.
(Reading database ... 356615 files and directories currently installed.)
Unpacking rinetd (from .../rinetd_0.62-5.1_i386.deb) ...
Processing triggers for man-db ...
Setting up rinetd (0.62-5.1) ...
update-rc.d: We have no instructions for the rinetd init script.
update-rc.d: It looks like a non-network service, we enable it.
insserv: warning: script 'redis' missing LSB tags and overrides
insserv: warning: script 'dnsmasq' missing LSB tags and overrides
Starting internet redirection server: rinetd.
rinetd service
root:~ /# service rinetd restart
Stopping internet redirection server: rinetd.
Starting internet redirection server: rinetd.
Configuration file
root:~ /# cat /etc/rinetd.conf
#
# this is the configuration file for rinetd, the internet redirection server
#
# you may specify global allow and deny rules here
# only ip addresses are matched, hostnames cannot be specified here
# the wildcards you may use are * and ?
#
# allow 192.168.2.*
# deny 192.168.2.1?
#
# forwarding rules come here
#
# you may specify allow and deny rules after a specific forwarding rule
# to apply to only that forwarding rule
#
# bindadress bindport connectaddress connectport
0.0.0.0 8080 127.0.0.1 80
# logging information
logfile /var/log/rinetd.log
# uncomment the following line if you want web-server style logfile format
# logcommon
You can connect to port 8080, and traffic will be redirected to port 80.