Find the answer to your Linux question:
Results 1 to 7 of 7
Hi All, I was wondering if it was possible to route packets coming in my eth0 interface to the lo interface. I'm trying to send traffic destined for the 10.10.10.0 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    4

    route eth0 -> lo


    Hi All,

    I was wondering if it was possible to route packets coming in my eth0 interface to the lo interface. I'm trying to send traffic destined for the 10.10.10.0 network, of which my eth0 is a part of, to a server service running on my local loopback. Is this possible? If so how?

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Yes, you can do this.

    Code:
    iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
    For example would redirect all packets entering your box with port 80 to the internal service at port 8080

    REDIRECT is the command in IPTABLES you want to use to keep traffic on the box it is entering.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    Why not just configure the service to listen on eth0?

  4. #4
    Just Joined!
    Join Date
    Nov 2007
    Posts
    4
    heya Lazydog,

    Thnks a lot for the nudge. Appreciate it

  5. #5
    Just Joined!
    Join Date
    Nov 2007
    Posts
    4
    yea i could run as so, rcgreen, but i'm learning to play with iptables so wanted to settle a curious itch. Thanx for the suggestion though.

  6. #6
    Just Joined!
    Join Date
    Nov 2007
    Posts
    4
    Hi again,

    To try and test the redirect target i did the following. I ran a jabber server serving on lo port 5222. Then i configured kopete on my same very host to seek the server on eth0 port 5222. I then inserted the aforementioned iptable rule with adjustment to the port values. But i couldn't connect. My tables have no other rules except for the one i mentioned. Help.

  7. #7
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    You have to apps listening on the same port. Not good fix this

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

Posting Permissions

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