Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Connect clients from two different networks.


  • Please log in to reply
3 replies to this topic

#1 rul3s

rul3s

  • Members
  • 2 posts
  • OFFLINE
  •  
  • Local time:10:51 AM

Posted 02 January 2017 - 08:04 AM

Hello people, let's see if someone can give me a little help, I'm stuck with that.

I have two clients:

 

Client1:

192.168.43.1/24

no gateway defined

 

Client2:

192.168.10.1/24

no gateway defined

 

I need them both to have connectivity between then BUT! I CAN'T change them network configuration, if not, i would change netmask and problem solved :P

If i connect them directly I think that it's imposible to get connectivity because they dont know each other network neither know how to reach it.

So... my idea was to put another device with two interfaces between them and redirect paquets from a "virtual ip" to the other client in the other network, this "router" configuration would be like this:

 

Router (Linux machine with debian and 2 ethernet ifaces):

eth0: 192.168.43.254/24

eth1: 192.168.10.254/24

 

The idea is that when client1 ping's 192.168.43.254 router is who answers, but when he ping's to, p.e. 192.168.43.20, this is redirected to 192.168.10.1 and viceversa.

 

I think this has to be done with iptables DNAT and SNAT but I'm not making it work, I always get a "destination unreachable". What I've configured to the "router" is:

 

echo 1 > /proc/sys/net/ipv4/ip_forwarding

iptables -t nat -A  PREROUTING -d 192.168.43.20 -j DNAT –to-destination 192.168.10.1
iptables -t nat -A POSTROUTING -s 192.168.10.1 -j SNAT –to-source 192.168.43.20
 
What do you think guys? Is my idea correct but not my implementation or my idea is noway going to work?
 
Thanks you all.

 



BC AdBot (Login to Remove)

 


#2 Wand3r3r

Wand3r3r

  • Members
  • 2,027 posts
  • OFFLINE
  •  
  • Local time:02:51 AM

Posted 02 January 2017 - 12:12 PM

This is simple routing.

 

eth0: 192.168.43.254/24

eth1: 192.168.10.254/24

are the two gateways.

 

when a request for a ip address not on the local subnet the request goes to the local gateway [which you will have to define at the client or it has no way of knowing where to send it].  The router knows its on the other subnet and then routes it to that subnet.

 

Routing is not done to the specific device like your example of routing to 10.1 or 43.20


Edited by Wand3r3r, 02 January 2017 - 12:15 PM.


#3 rul3s

rul3s
  • Topic Starter

  • Members
  • 2 posts
  • OFFLINE
  •  
  • Local time:10:51 AM

Posted 03 January 2017 - 02:39 AM

This is simple routing.

 

eth0: 192.168.43.254/24

eth1: 192.168.10.254/24

are the two gateways.

 

when a request for a ip address not on the local subnet the request goes to the local gateway [which you will have to define at the client or it has no way of knowing where to send it].  The router knows its on the other subnet and then routes it to that subnet.

 

Routing is not done to the specific device like your example of routing to 10.1 or 43.20

Hello mate,
First of all thanks for your help, but, those devices have no gateway defined, and I can't define one, so when I ask for a network wich is unknown it says "destination unreachable", do you agree with me?


Edited by rul3s, 03 January 2017 - 02:51 AM.


#4 Wand3r3r

Wand3r3r

  • Members
  • 2,027 posts
  • OFFLINE
  •  
  • Local time:02:51 AM

Posted 03 January 2017 - 11:01 AM

"those devices have no gateway defined, and I can't define one"

 

then you can't route.  period end of story.

 

and why can't you edit or have someone edit those devices settings?


Edited by Wand3r3r, 03 January 2017 - 11:02 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users