Find the answer to your Linux question:
Results 1 to 2 of 2
I have Debian lenny. I'm trying to get the following iptables command to work (response shown on lines 2 & 3): $ sudo iptables -v -A PREROUTING -t nat -p ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    2

    How to get iptables REDIRECT to work


    I have Debian lenny.

    I'm trying to get the following iptables command to work (response shown on lines 2 & 3):

    $ sudo iptables -v -A PREROUTING -t nat -p tcp --dport 80 -j REDIRECT --to-port 8080
    REDIRECT tcp opt -- in * out * 0.0.0.0/0 -> 0.0.0.0/0 tcp dpt:80 redir ports 8080
    iptables: No chain/target/match by that name

    The system config checks I have run are:
    $ cat /proc/sys/net/ipv4/ip_forward
    1


    $ sudo iptables -L
    Chain INPUT (policy ACCEPT)
    target prot opt source destination

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    $ /sbin/lsmod
    Module Size Used by
    xt_tcpudp 2431 0
    iptable_nat 4110 0
    nf_nat 13465 1 iptable_nat
    iptable_filter 1410 0
    ip_tables 14618 2 iptable_nat,iptable_filter
    x_tables 13916 3 xt_tcpudp,iptable_nat,ip_tables
    ipv6 254105 16
    nls_iso8859_15 4734 1
    nls_cp850 4985 1


    It looks as though I am missing a kernel module - one that would supply the PREROUTING and REDIRECT chain targets. Is that what's wrong? What is the name of the missing module(s), where should they be found?

    TIA
    Chris

  2. #2
    Just Joined!
    Join Date
    Oct 2010
    Posts
    2

    Additional info.

    Information additional to my first post above...

    The result of uname -r is
    2.6.32.21-m64-mb1


    On a Ubuntu system the commands in the previous post work OK.

    On executing /sbin/lsmod on the Ubuntu system a module 'ipt_REDIRECT' is listed - which would seem to be what I need on the Debian system.

    I've tried, on the Debian system:
    $ sudo modprobe ipt_REDIRECT
    FATAL: Module ipt_REDIRECT not found.

    Is ipt_REDIRECT the missing module?
    Where do I find it?

    I've looked in /lib/modules/2.6.32.21-m64-mb1/kernel/net/ ipv4/netfilter

    It contains the following filters:
    arptable_filter.ko
    arpt_mangle.ko
    iptable_filter.ko
    iptable_nat.ko
    ip_tables.ko
    ipt_ah.ko
    ipt_ECN.ko
    ipt_MASQUERADE.ko
    ipt_ULOG.ko
    nf_nat.ko
    arp_tables.ko
    ip_queue.ko
    iptable_mangle.ko
    iptable_raw.ko
    ipt_addrtype.ko
    ipt_ecn.ko
    ipt_LOG.ko
    ipt_REJECT.ko
    nf_nat_ftp.ko
    nf_nat_sip.ko

    Looks like there are several there related to ip tables, but not (obviously) the one I need!
    Last edited by clfh; 10-21-2010 at 01:08 AM.

Posting Permissions

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