D
D
DjimiDjimi2021-01-23 21:52:42
linux
DjimiDjimi, 2021-01-23 21:52:42

Routing between 2 interfaces using route?

Hello.
I have a Raspberry Pi with two interfaces eth0 and wlan0 . A DHCP server (isc-dhcp-server) is installed on it, eth0 is specified as an interface on the DHCP server . Through wlan0 it is connected to WiFi and has Internet access. The scheme is as follows:
600c6f07bcb4c503776243.jpeg
On the Raspberry Pi itself, there is Internet access in the console, but the PC does not. But if you run the command:

# iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

then the Internet appears on the PC as well. The question is, how to do the same only with the help of route ?

Raspberry Pi has wlan0 set as the default route.
default via 192.168.0.1 dev wlan0

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aleks-th, 2021-01-23
@aleks-th

Without Nat? No way.
Computers on the Internet know nothing about your internal network and your routing.
It's easier to remember the rule in iptables.
iptables-save > /etc/iptables/iptables.rules this command will save the active configuration to a file.

D
Denis, 2021-01-23
@Rentable

route add 192.168.10.0 mask 255.255.0.0 192.168.0.1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question