Results 1 to 6 of 6

Thread: Redirecting an IP address to another IP address and port

  1. #1
    Join Date
    Dec 2010
    Beans
    6

    Redirecting an IP address to another IP address and port

    I'm running Ubuntu 10.10 and I need to redirect IP address to another on an outgoing connection from my machine. For example, I open a web browser and go to:
    10.0.0.1:1625

    It redirects me to 192.168.1.1:921 but I still see 10.0.0.1:1625 in the address bar. I can't achieve this by editing /etc/hosts. I would be very thankful if you help me.

    Thanks in advance!

  2. #2
    Join Date
    Mar 2008
    Beans
    180
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Redirecting an IP address to another IP address and port

    This cant be achieved by /etc/hosts file.

    you may want to use iptables specially if you want port forwarding as I understood from your example, its available in ubuntu.
    Code:
    iptables -t nat -A OUTPUT -j REDIRECT -p tcp -d 10.0.0.1/24 --dport 1625 --to-ports 921
    if you want to remove this again:
    Code:
    sudo iptables -t nat -F
    Last edited by Mosabama; December 18th, 2010 at 03:12 AM.

  3. #3
    Join Date
    Dec 2010
    Beans
    6

    Re: Redirecting an IP address to another IP address and port

    Thanks, but I also need to redirect the IP to another IP like "hosts" does.

  4. #4
    Join Date
    Feb 2010
    Location
    Silicon Valley
    Beans
    1,898
    Distro
    Xubuntu 12.04 Precise Pangolin

    Re: Redirecting an IP address to another IP address and port

    Sounds like you want a simple proxy tool. Take a look at tinyproxy.

  5. #5
    Join Date
    Mar 2008
    Beans
    180
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: Redirecting an IP address to another IP address and port

    Quote Originally Posted by YPwn View Post
    Thanks, but I also need to redirect the IP to another IP like "hosts" does.
    You can always change the ip in the example to any ip you want in the network.

  6. #6
    Join Date
    Dec 2010
    Beans
    6

    Re: Redirecting an IP address to another IP address and port

    Thanks, your help is appreciated.

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
  •