P
P
prabhu2015-02-02 16:48:06
linux
prabhu, 2015-02-02 16:48:06

How to route the second subnet?

Hello colleagues.
There is a gateway under Gentoo in the network 192.168.1.1
But the problem is that 255 subnet addresses are not enough.
How to make subnet routing 192.168.1.1 and new 192.168.2.1
On the gateway did:

# Route to 192.168.1.0/24
iptables -A POSTROUTING -t nat --dst 192.168.1.0/255.255.255.0 -j SNAT --to-source 192.168.1.1
# Route to 192.168.2.0/24
iptables -A POSTROUTING -t nat --dst 192.168.2.0/255.255.255.0 -j SNAT --to-source 192.168.2.1

But as before, a machine with static 192.168.2.2 does not ping from the gateway, although ping goes to the gateway from static, but not to other machines in the 1st subnet.
I ask for help to figure this out, I promise, when I figure it out, to help those in need like me.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Armenian Radio, 2015-02-02
@gbg

And just add a bit to the mask in any way? Why build a separate network, and even with NAT?

C
Cool Admin, 2015-02-02
@ifaustrue

Register the second address from the new subnet on the interface, check that there are no blocking policies for incoming traffic.

S
Stepan Kuksenko, 2015-02-13
@stxtasy

Indeed, why bother with routing, if you can just change the mask on all computers and that's it. Instead of 255.255.255.0, make 255.255.252.0 on all computers and you have an ip range from 192.168.0.0 to 192.168.3.0 at your disposal.
Set IP addresses for new computers from this range and they will be on the same network.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question