LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-06-2012, 02:56 PM   #1
ipmasq
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
Unhappy sshd dynamic port forwarding 2 NICs


Hey,

I am having a problem with my network interfaces routing and I hoped you may help me to solve this problem. (also this forum seems the most appropriate so I hope its the right one)

0) I am running Fedora 8 my kernel version is: 2.6.23.1-42.fc8
1) I have 2 network interfaces: one (eth0) is bound to 192.168.0.1 and the other (eth0:1) to 192.168.0.2
*) eth0:0 is newly created
2) on 192.168.0.10 I have a PHP page which would show you the ip you are connecting with ($_SERVER['REMOTE_ADDR'])


I can use ssh dynamic port forwarding connecting to the machine like this:
Code:
ssh -N -D 1234 root@192.168.0.1
and when I use that connection and query the page on 192.168.0.10 I do get the 192.168.0.1 as expected

however when I try to dynamic port forwarding on the second interface like this:
Code:
ssh -N -D 1234 root@192.168.0.2
the connection is made but when I query the page on 192.168.0.10 I get the same result: 192.168.0.1


where have I gone wrong?



Note: by googling it I found that you can also use iptables to re-write the source IP address so it will result in the same effect.
so I tried it, but with no effect:
Code:
iptables -t nat -I POSTROUTING -p tcp --dport 80 -s 192.168.0.1 -j SNAT --to 192.168.0.2



Thanks in advance
 
Old 05-06-2012, 11:05 PM   #2
mpapet
Member
 
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548

Rep: Reputation: 72
Quote:
Originally Posted by ipmasq View Post
however when I try to dynamic port forwarding on the second interface like this:
Code:
ssh -N -D 1234 root@192.168.0.2
the connection is made but when I query the page on 192.168.0.10 I get the same result: 192.168.0.1

where have I gone wrong?
In my experience, virtual interfaces aren't reported. What's reported is the hardware interface. Virtual interfaces are good for listening more than initiating traffic.

Last edited by mpapet; 05-06-2012 at 11:07 PM.
 
  


Reply



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
Port number used by server when using dynamic port forwarding in SSH? kreeder Linux - Networking 4 11-21-2011 02:07 PM
SSH dynamic port forwarding Jeroen1000 Linux - Networking 2 02-02-2010 02:15 AM
sshd port forwarding jdavidow Linux - Networking 4 04-16-2006 02:14 PM
Port Forwarding With Dynamic PPP0 rwyarbrough Linux - Security 2 12-22-2003 08:53 PM
Port Forwarding With Dynamic PPP0 rwyarbrough Linux - Networking 1 12-19-2003 02:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:42 PM.

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