Results 1 to 1 of 1

Thread: IP Forward

  1. #1
    Join Date
    Jul 2015
    Beans
    1

    IP Forward

    Hi all,

    For my work we have a testing space with a Ubuntu server which is also a router.
    Yesterday we placed a new in the rack and our meaning was to make it a webserver which is accessible from the internet.
    The Ubuntu server/router was only a router first, which redirects the traffic from inside to the outside and it was a DHCP server.

    To make the router route to the internet we used iptables for NAT:
    Code:
    # Generated by iptables-save v1.4.21 on Tue Mar 10 11:09:24 2015
    *nat
    :PREROUTING ACCEPT [323:23056]
    :INPUT ACCEPT [59:6795]
    :OUTPUT ACCEPT [31:2677]
    :POSTROUTING ACCEPT [0:0]
    -A POSTROUTING -o eth5 -j MASQUERADE
    -A POSTROUTING -o eth2 -j MASQUERADE
    COMMIT
    # Completed on Tue Mar 10 11:09:24 2015
    # Generated by iptables-save v1.4.21 on Tue Mar 10 11:09:24 2015
    *filter
    :INPUT ACCEPT [278:36336]
    :FORWARD ACCEPT [18603:9408689]
    :OUTPUT ACCEPT [105:12060]
    -A INPUT -i lo -j ACCEPT
    -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
    -A OUTPUT -o lo -j ACCEPT
    -A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
    COMMIT
    # Completed on Tue Mar 10 11:09:24 2015


    Now we want to redirect some traffic to the webserver, but we have a few public IP addresses.
    We want to route all traffic to IP address xxx.xxx.xxx.14 to the intern IP address 10.10.10.10.

    I tried to apply the following rules in the iptables:
    Code:
    iptables -t nat -A PREROUTING -d xxx.xxx.xxx.14 -j DNAT --to 10.10.10.10
    iptables -t nat -A PREROUTING -d xxx.xxx.xxx.14 -j DNAT --to 10.10.10.10

    But it doesn't seem to do the trick.

    Since my Ubuntu/Linux skills are very low, I don't exactly what I am doing wrong.
    Can somebody help me with my problem?

    The meaning is that all traffic to IP xxx.xxx.xxx.14 is being redirected to 10.10.10.10.
    All the other traffic doesn't need to be touched and can be redirected as normal NAT traffic to eth5.

    eth2 is the outside ethernet port.
    eth5 is the inside ethernet port.

    Thanks in advance.


    Rens
    Last edited by rens3; July 14th, 2015 at 03:46 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •