IPTables forward from only one ip on my server

Posted by user1307079 on Server Fault See other posts from Server Fault or by user1307079
Published on 2013-06-30T22:03:04Z Indexed on 2013/06/30 22:22 UTC
Read the original article Hit count: 240

Filed under:
|

I was able to get my server to forward connections on a certain port to a different IP, but when I add -d to specify an IP to froward from, It does not work. This is what I am trying, iptables -t nat -A PREROUTING -d 173.208.230.107 -p tcp --dport 80 iptables -t nat -nvL-j DNAT --to-destination 38.105.20.226:80. It works fine without the -d. Here is my ifconfig dump:

em1       Link encap:Ethernet  HWaddr 00:A0:D1:ED:D0:54
          inet addr:173.208.230.106  Bcast:173.208.230.111  Mask:255.255.255.248
          inet6 addr: fe80::2a0:d1ff:feed:d054/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:100058 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18941701 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12779711 (12.1 MiB)  TX bytes:825498499 (787.2 MiB)
          Memory:fbde0000-fbe00000

em1:9     Link encap:Ethernet  HWaddr 00:A0:D1:ED:D0:54
          inet addr:173.208.230.107  Bcast:173.208.230.111  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Memory:fbde0000-fbe00000

em1:10    Link encap:Ethernet  HWaddr 00:A0:D1:ED:D0:54
          inet addr:173.208.230.108  Bcast:173.208.230.111  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Memory:fbde0000-fbe00000

em1:11    Link encap:Ethernet  HWaddr 00:A0:D1:ED:D0:54
          inet addr:173.208.230.109  Bcast:173.208.230.111  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Memory:fbde0000-fbe00000

em1:12    Link encap:Ethernet  HWaddr 00:A0:D1:ED:D0:54
          inet addr:173.208.230.110  Bcast:173.208.230.111  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Memory:fbde0000-fbe00000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

© Server Fault or respective owner

Related posts about centos

Related posts about iptables