LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions
User Name
Password
Linux - Distributions This forum is for Distribution specific questions.
Red Hat, Slackware, Debian, Novell, LFS, Mandriva, Ubuntu, Fedora - the list goes on and on... Note: An (*) indicates there is no official participation from that distribution here at LQ.

Notices


Reply
  Search this Thread
Old 03-14-2015, 02:34 PM   #1
aristosv
Member
 
Registered: Dec 2014
Posts: 263

Rep: Reputation: 3
multiple IP addresses - source nat


I want to configure multiple IP addresses on a Debian machine, and depending on which IP address I use to ssh on it, it should forward the request on a specified port, on localhost.

I think this is called source nat. But I'm not sure.

Which file should I edit? Can you provide an example?

Thanks
 
Old 03-15-2015, 09:38 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
As you said that you want to configure multiple IPs on Debian machine and assuming that the machine has got one interface I think you are talking about IP aliasing.

Keeping that in mind you might want to have a look at this: https://wiki.debian.org/NetworkConfi..._One_Interface

For making ssh to listen on multiple IPs you would have to do as mentioned in this document: http://www.cyberciti.biz/tips/howto-...p-address.html

If you are planning to access these IPs from outside your network then you have to use different ports for each IP otherwise your router will get confused where to forward the traffic. It might work with same port as all are requesting for same service on the same machine but I personally wont prefer that way.
 
Old 03-16-2015, 10:43 PM   #3
aristosv
Member
 
Registered: Dec 2014
Posts: 263

Original Poster
Rep: Reputation: 3
Thanks for your reply. This answers the first part of my question.

What I want to achieve eventually is that when I ssh on a specific IP address on the ssh server, it will forward my request to localhost on a specific port. For example.

If I ssh on IP address 192.168.0.50 the ssh server should forward my request to localhost:5000
If I ssh on IP address 192.168.0.51 the ssh server should forward my request to localhost:5001
If I ssh on IP address 192.168.0.52 the ssh server should forward my request to localhost:5002

and so on..

Multiple reverse ssh tunnels will be connected on this ssh server, each tunnel using a different port (5000,5001,5002)
I want to access the remote hosts using IP address only. Not IP addressort.
 
Old 03-16-2015, 11:05 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You're welcome.

To be honest that is something I haven't tried before but there is another thread yesterday which had somewhat similar requirement. Here is the link: http://www.linuxquestions.org/questi...ng-4175536876/

And following is the section you will be more interested in:

Code:
-A PREROUTING -p tcp --dport 1433 -j DNAT --to-destination backend-server:1433
-A POSTROUTING -p tcp -d backend-server --dport 1433 -j SNAT --to-source bastion-server
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying the NAT source ip and mac addresses with iptables fedaim Linux - Networking 1 08-18-2014 03:20 PM
[SOLVED] iptables - NAT - multiple source exclusions for DNAT morphix Linux - Security 3 11-05-2013 04:53 AM
Using NAT and want to do intranet email using IP addresses instead of names n56 Linux - Software 3 01-10-2011 09:41 PM
NAT with multiple internet addresses FireRaven Linux - Networking 4 03-08-2010 08:51 PM
NAT Outside Addresses to Inside with same address shizzilla Linux - Networking 2 06-23-2006 04:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions

All times are GMT -5. The time now is 08:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration