You add a routing entry to your routing table on the box with the two nics using this command :
route add -host 268.23.256.34 gw 192.168.3.1
but I think this command will not survive a reboot. I’ll have to get to my openSUSE to check how to make it permanent or You could check if there is a GUI in Yast to do this.
If you’re SURE you should be going through 3.1 (instead of 1.1) then you
would basically need to add a host route that tells your computer that all
packets destined for 268.23.256.34 (you know this is a completely invalid
IP address, right?) should go through 192.168.3.1.
I think this would do it:
sudo ip route add 268.23.256.34 via 192.168.3.1
Good luck.
On 01/12/2011 08:06 AM, rydman wrote:
>
> Hello OpenSuse community!
>
> Am quite the newbie when it comes to this, so this might be easy, hard
> or impossible, but here goes!
>
> I have a box with two NICs.
>
> eth0 is 192.168.3.3
> eth1 is 192.168.1.7
>
> Default gateway is 192.168.1.1
>
> What I want to do, is access a second computer (268.23.256.34) via ssh.
> and it has to be done through the 192.168.3.1 gateway.
>
> So my questions are:
>
> Can I somehow set up a port forwarding from 192.168.1.7:222 to
> 268.23.256.34:22 via 192.168.3.1 as gateway?
>
> Or is it simpler to do it from 192.168.3.3:222?
>
> And how do I do it?
>
> Have tried to read up a bit on ip, iptables and such, but too much
> information makes me unsure what is the best practice etc…
>
> Cheers,
>
> Richard
> —
>
> :~ # more /etc/SuSE-release
> openSUSE 11.2 (x86_64)
> VERSION = 11.2
> :~ # uname -srv
> Linux 2.6.31.14-0.6-desktop #1 SMP PREEMPT 2010-12-10 11:18:32 +0100
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
On 01/12/2011 08:22 AM, ab@novell.com wrote:
> If you’re SURE you should be going through 3.1 (instead of 1.1) then you
> would basically need to add a host route that tells your computer that all
> packets destined for 268.23.256.34 (you know this is a completely invalid
> IP address, right?) should go through 192.168.3.1.
>
> I think this would do it:
>
> sudo ip route add 268.23.256.34 via 192.168.3.1
>
> Good luck.
>
>
>
>
>
> On 01/12/2011 08:06 AM, rydman wrote:
>
>> Hello OpenSuse community!
>
>> Am quite the newbie when it comes to this, so this might be easy, hard
>> or impossible, but here goes!
>
>> I have a box with two NICs.
>
>> eth0 is 192.168.3.3
>> eth1 is 192.168.1.7
>
>> Default gateway is 192.168.1.1
>
>> What I want to do, is access a second computer (268.23.256.34) via ssh.
>> and it has to be done through the 192.168.3.1 gateway.
>
>> So my questions are:
>
>> Can I somehow set up a port forwarding from 192.168.1.7:222 to
>> 268.23.256.34:22 via 192.168.3.1 as gateway?
>
>> Or is it simpler to do it from 192.168.3.3:222?
>
>> And how do I do it?
>
>> Have tried to read up a bit on ip, iptables and such, but too much
>> information makes me unsure what is the best practice etc…
>
>> Cheers,
>
>> Richard
>> —
>
>> :~ # more /etc/SuSE-release
>> openSUSE 11.2 (x86_64)
>> VERSION = 11.2
>> :~ # uname -srv
>> Linux 2.6.31.14-0.6-desktop #1 SMP PREEMPT 2010-12-10 11:18:32 +0100
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
Um… when you say that the destination box will only accept a
connection from a certain box then routing is not the right way to go
since routing doesn’t change a source IP. You may be looking for
something more like tunneling or port forwarding in that case. Knowing
that requirement makes a big difference.
Good luck.
On 01/12/2011 09:36 AM, rydman wrote:
>
> Thanks for all the replies! Will try tomorrow when I have access to the
> box.
>
> And just to clarify, I want to able to type
>
> ssh 192.168.1.7 -p 222 (alt 192.168.3.3)
> and end up at 268.23.256.34:22 using the 192.168.3.3 gw.
>
> 268.23.256.34 (yes, fake i know) only accepts connections from this gw,
> so has to use that one.
>
> And will read up a bit more on this!
>
> Cheers,
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
On 01/12/2011 06:36 PM, rydman wrote:
>
> Thanks for all the replies! Will try tomorrow when I have access to the
> box.
>
> And just to clarify, I want to able to type
>
> ssh 192.168.1.7 -p 222 (alt 192.168.3.3)
> and end up at 268.23.256.34:22 using the 192.168.3.3 gw.
>
> 268.23.256.34 (yes, fake i know) only accepts connections from this gw,
> so has to use that one.
>
Assuming you can ssh to “gatewaymachine” and your “finalmachine” accepts
ssh from “gatewaymachine”, then basically: