Network route question

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

Network route question

Post by /RaspberryPi »

I have configured 2 network devices on my RPi:
#/etc/network/interfaces.d/eth0 auto eth0 iface eth0 inet static address 192.168.168.2 netmask 255.255.255.0 gateway 192.168.168.1 #/etc/network/interfaces.d/wlan0 ...
allow-hotplug wlan0 iface wlan0 inet static wpa-ssid SSIDNAME wpa-psk WPAKEY address 192.168.158.2 netmask 255.255.255.0 gateway 192.168.158.1 I can ping both networks. From a another client with IP 192.168.168.36, i can reach also the router on 192.168.168.1 and the RPi itself. To reach also 192.168.158.1, i have used iptables -A FORWARD -i eth0 -j ACCEPT and iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE. After that, i can reach 192.168.158.1 successfully. But this seems not to be a persistent setting. I have to enter both commands after every reboot.
Additionally, for some reason, sometimes /etc/resolve.conf changes the nameserver automatically from 192.168.168.1 to 192.168.158.1. I have no idea why.
Any idea, how i can get a stable configuration?

submitted by /u/Eare1986
[link] [comments]

More...
Post Reply

Return to “Raspberry Pi Forum”