This is a discussion on forwarding requests to another ip using IPTABLES within the Linux software forums, part of the Linux Getting Started category; Dear all, I am trying to forward packets coming to one ip address(say 192.168.1.222 port 4080) to another ip address ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
Dear all,
I am trying to forward packets coming to one ip address(say 192.168.1.222 port 4080) to another ip address (say 192.168.1.11 I tried the following rule: iptables -t nat -A PREROUTING -p tcp -d 192.168.1.222 --dport 4080 -j DNAT --to-destination 192.168.1.118 But it did not work. I also observed that, iptables -t nat -A PREROUTING -p tcp -d 192.168.1.118 --dport 4080 -j DNAT --to-destination 192.168.1.118:4088 works, i.e, port redirection works. I tried out google and also read a couple of tutorials but unfortuately I am still unable to find the problem. I am using Red Hat 8 on both the computers. Can any one point me to the right direction? Thanks, Ranjan |
| Sponsored Links | ||
|
|
|
||||
|
Code:
iptables -t nat -A PREROUTING -p tcp -d 192.168.1.222 --dport 4080 -j DNAT --to-destination 192.168.1.118 Because you did not specified the port in --to-destination IP:PORT. You need to give port also it can not guess it Code:
iptables -t nat -A PREROUTING -p tcp -d 192.168.1.118 --dport 4080 -j DNAT --to-destination 192.168.1.118:4088 Answer it as above for second This port redirection (iptables based) will only works if the destination is in the same network on locally attached interface. If you need to forward it to other network then you need tiny utility called rinetd which is a TCP port redirector. See http://www.boutell.com/rinetd/ for more and to download it. |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Restricting Port forwarding in SSH server | ricc | Networking, Firewalls and Security | 2 | 08-07-2008 09:14 PM |
| Port forwarding | satimis | Networking, Firewalls and Security | 0 | 02-02-2008 08:45 AM |
| Iptables | nixsen | CentOS / RHEL / Fedora | 2 | 11-29-2007 04:01 PM |
| iptables help | vitaminme | Networking, Firewalls and Security | 1 | 09-04-2007 03:42 AM |
| IPTABLES help | vasanth | Linux software | 1 | 03-09-2005 10:15 AM |