Find the answer to your Linux question:
Results 1 to 7 of 7
Hey all! I am a novice linux user who happens to be in need of help! I have a dedicated server which runs Red Hat Enterprise Linux and is located ...
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    4

    Iptable?

    Hey all!

    I am a novice linux user who happens to be in need of help! I have a dedicated server which runs Red Hat Enterprise Linux and is located elsewhere.

    We have two ips on the machine, for purpose of this post they will be
    209.139.210.60
    209.139.210.61

    This IP 209.139.210.61 hosts a game on port 4545. I would like to use the secondary ip(209.139.210.60) and port 443 and forward all telnets to 209.139.210.61 port 4545.

    Can anyone help me through this process? Ive researched iptables and ipchains but to be quite honest, it seems quite a bit over my head and Ive been told that one screw up here could actually lock me out of my own machine.


    So basically, forward all traffic from 209.139.210.60:443 to 209.139.210.61:4545

    Any help is greatly appreciated!

    Op

  2. #2
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,281
    I can see that this is over your head along with other things too as you are talking apples and oranges here.

    You state that you want to use telnet but you should really be using SSH. You used the port 443 which is https. So the question is what is it you are really trying to do here? Telnet or https? Or did you configure telnet to listen on another port? If so why telnet and not ssh?

    Are both of these ip addresses are on the same server?
    Is this server running any VM on it?

    If the is just a simple server then you should be able to use REDIRECT see this Tutorial.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  3. #3
    Just Joined!
    Join Date
    Nov 2009
    Posts
    4
    Let me try to answer a few of your questions here.

    Both IP addresses are on the same server.

    One IP is used and hosts a game on port 4545. The game is accessed via clients by telnetting to 209.139.210.61 4545

    I would like to use the second ip with port 443( I was told port 80 would also work?) because the majority of firewalls do not block this port so that players who are normally blocked by our main ip and port could still reach it via the secondary ip and port 443.

    There is no VM on the server.

    I hope this helps, sorry for my lack of knowledge on the topic!

    This is what has been suggested:

    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port
    4545

    I'm just not sure how the above tells which IP to use to do the redirect from and which to receive since both IPs are on the same machine?

  4. #4
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,281
    Because they are both on the same server it doesn't matter what ip address is being used. Just that the port is redirected to the other port and in the case of what you were told and what you have told me this would work.

    One question I have though is there only one Network card in this box or are there 2? If there are 2 then you have to adjust the rule for the interface that the ip address resides on that you want to redirect.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  5. #5
    Just Joined!
    Join Date
    Nov 2009
    Posts
    4
    The server has one NIC card.

    I will try the redirect!

    I appreciate the quick and helpful responses, someday I hope to be able to return the favor.

    Op

  6. #6
    Just Joined!
    Join Date
    Nov 2009
    Posts
    4
    This
    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port
    4545

    probably is not going to work because we only want to forward traffic at 209.139.210.60 port 443 to 209.139.210.61 port 4545

    Is there anyway to specify just one of the IPs to redirect traffic from?

    Op

    Maybe something like

    iptables -t nat -A PREROUTING -p tcp -d 209.139.210.60 --dport 443 -j DNAT --to-destination 209.139.210.61:4545

  7. #7
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,281
    Yes

    Code:
    iptables -t nat -A PREROUTING -i eth0 -p tcp -d 209.139.210.60 --dport 443 -j REDIRECT --to-port
    4545
    You can find all this information in the link I have provided you above.

    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
  •  
...