if on the computers in the subnet the default gateway indicates the use of the server you are configuring, then it is sufficient:
Allow packet transfer between interfaces on this server:
$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
in order for this setting to be applied even after a reboot, uncomment (or add, if not) the line in /etc/sysctl.conf :
net.ipv4.ip_forward=1
- check that these packets are not distorted or blocked by netfilter (see the output of
$ sudo iptables-save ).
if, on these computers, the default gateway is another machine (or no one is specified at all), then, in addition to allowing the transfer of packets between interfaces, you will have to “distort” these packets.
at a minimum, a source address must be substituted for packets arriving at the “external” interface and addressed to computers on the subnet, as well as a reverse substitution of the destination address for return packets.
Both of these actions can be performed by a netfilter directive called snat ( source nat ). An example of its addition using the iptables program:
$ sudo iptables -t nat -A POSTROUTING -o интерфейс -j SNAT --to-source ip-адрес
Where:
интерфейс is the name of the network interface through which this computer is connected to the target subnetip-адрес - the address assigned to this interface
echo 1 > /proc/sys/net/ipv4/ip_forward,iptables -A FORWARD -j ACCEPT. - user194374ip a; ip rip a; ip ron all three key points - “pc within network”, “server”, “computer inside subnet 10.10.0.0/24” - aleksandr barakin