Port Forwarding with Rinetd tool

Port Forwarding with Rinetd tool

To make it clear, we have the following machines: Machine1 - IP: 111.111.111.111 - Behind firewall, and wants to connect to Machine3 which can’t be connected directly. Machine2 - IP: 222.222.222.222 - Forwards incomming connections to Machine3 Machine3 - IP: 333.333.333.333 on port 21 as machine2 has access to connect to machine 3. Here, machine2 act like gateway b/w other

  • Now, login to to machine2 which has rinetd tool installed

  • nano /etc/rinetd.conf and below line

# bindadress    bindport  connectaddress  connectport
111.111.111.111    80     333.333.333.333       21
  • This will forward connection received from ip 111.111.111.111 on port 80 to ip 333.333.333.333 port 21 . ALso , instead of 111.111.111.111 , 0.0.0.0 can be used to receive connection from any ip on port 80 to ip 111.111.111.111

  • sudo service rinetd restart

  • ss -antp | grep "80” to check if config is successful

  • Now, login to machine1 & connect to machine2 on port 80 nc -nv 222.222.222.222 80

  • Instead of ip 222.222.222.222 , we will be connected to machine3

Last updated