Answer the question
In order to leave comments, you need to log in
How to connect two networks through a third?
Greetings.
The network 192.168.0.0/22 has several PCs and a Windows XP gateway (192.168.0.1). On the same network, there is a virtual machine on Debian (eth0 192.168.2.6), on the same virtual machine there is another interface eth1 172.16.16.1 (172.16.16.0/29). This network has a piece of iron (172.16.16.2) if you specify it as a gateway, then node 172.20.82.1 will be available. You can’t configure the piece of iron (but 172.16.16.1 is registered on it as a gateway).
Actually how to get access to this node (172.20.82.1) from the network 192.168.0.0/22?
I tried to configure both routes and port forwarding (PCs on the 192.168.0.0/22 network work with 172.20.82.1, thinking that it is 192.168.2.6, this option will also suit), but nothing worked out for me.
Thank you.
UPD 1
route on Debian:
Destination Gateway Genmask Flags Metric Ref Use Iface
172.20.82.1 172.16.16.2 255.255.255.255 UGH 0 0 0 eth1
172.16.16.0 0.0.0.0 255.255.255.248 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.252.0 U 0 0 0 eth0
route add 172.16.16.0 mask 255.255.255.248 192.168.2.6
route add 172.20.82.1 192.168.2.6
iptables -t nat -A POSTROUTING -o eth1 -s 192.168.0.0/22 -d 172.20.82.1 -j MASQUERADE
route add 172.20.82.1 192.168.2.6
Answer the question
In order to leave comments, you need to log in
Get used to drawing diagrams, then you will get high-quality answers. According to the subject from what I understood:
1) check whether everything is allowed on the virtual machine in IPTABLES in ALL chains, primarily FORWARDING. Check if forwarding is enabled on it (/proc/sys/net/ipv4/ip_forward)
2) check the routes on the hardware, maybe it's not default on it?
3) temporarily forget about the win xp gateway and install a virtual machine for everyone as a gateway
4) if it doesn’t work, try to run ping from the virtual machine with the source address 192.168.2.6 parameter
1. On the network 192.168.0.0/22 on all Windows computers, add a permanent route
2. On Debian, enable routing by writing in the /etc/sysctl.conf file
Add a route to the /etc/network/interfaces file for the eth1 interface
Run the same commands so as not to restart the server
# sysctl net.ipv4.ip_forward=1
# route add 172.20.82.1 gw 172.16.16.2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question