Hello, friends.
Maybe this is not adequated to this forum, but I will share this info with you all. If Pilovali or Fourdee thinks this is not for here, kill this post, I understand.
My goal is having my DietPi RPI2 being my router-firewall-DHCP server-DNS server-squid proxy-dansguardian filter.
eth0-internal ethernet to my ADSL-modem-DHCP router, and eth1-external-usb-asix-88772-ethernet to a switch to the rest of the network( others computer and tablet at home).
I’ve tried it with DietPi Wheezy, Jessie, v102, v103… and Jessie minimal official image… and it doesn’t work.
My DietPi Jessie v103 RPI 2 B hangs out after 2 or 3 minutes, just after 3-4 DNS queries (it seems to work, DHCP and DNS, but just for 2 or 3 queries from my Macbook), it gets disconnect from eth0 and eth1 and I have to hard-reboot. The same happens with DietPi Wheezie or whatever.
I’ve tried tones of options, last I tried is this, and it’s supposed to work: http://qcktech.blogspot.co.uk/2012/08/raspberry-pi-as-router.html
I have a Raspbian image with a very similar config as I’m sharing, and it works like a charm on a RPI 1 B. But it doesn’t work on my RPI 2 B.
So, my project is creating this on DietPi (I love it!) Jessie or Wheezie for the RPI 2B.
My question: Could it be Raspberry Pi 2 B has a bug that makes the routing or NATting or Forwarding impossible? And has DietPi these same bugs because they are maybe firmware related or whatever? Or maybe Raspbian “boot” partition for the RPI 2 B has this bug?
Steps I’ve done:
1- As a root…
2- nano /etc/network/interfaces
auto lo
iface lo inet loopback
#Onboard NIC connecting to the Internet
auto eth0
iface eth0 inet dhcp
#USB NIC serving as internal gateway
auto eth1
iface eth1 inet static
address 192.168.50.1
netmask 255.255.255.0
network 192.168.50.0
broadcast 192.168.50.255
#gateway 192.168.50.1
2- sudo apt-get update
sudo apt-get install dnsmasq
nano /etc/dnsmasq.conf
filterwin2k
no-resolv
server=87.216.1.65
server=87.216.1.66
interface=lo
interface=eth1
expand-hosts
domain=local
dhcp-range=192.168.50.100,192.168.50.150,255.255.255.0,12h
dhcp-option=3,192.168.50.1
dhcp-authoritative
3- sudo echo 1 > /proc/sys/net/ipv4/ip_forward
nano /etc/sysctl.conf
Uncomment line: net.ipv4.ip_forward=1
4- iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables-save > /etc/iptables.up.rules
5- Create a script sudo nano /etc/network/if-pre-up.d/iptables
#!/bin/sh
#This script restores iptables upon reboot
iptables-restore < /etc/iptables.up.rules
exit 0
Change ownership and permissions of the script so it will run at boot.
sudo chown root:root /etc/network/if-pre-up.d/iptables
sudo chmod +x /etc/network/if-pre-up.d/iptables
sudo chmod 755 /etc/network/if-pre-up.d/iptables
6- Reboot.
7- Check iptables is persistent: iptables –t nat -L
8- Connect a computer to eth1 (USB ASIX 88772).
9- In a Terminal ping 8.8.8.8 just to see when RPI2B hangs.
10- After browsing two or three webpages, pings don’t respond, and you cannot access to RPI2B with SSH, not from 192.168.1.x (connected to eth0-onboard LAN) neither from 192.168.50.1 (connected to eth1-USB LAN).
NOTE: I tried “step 2” doing it installing PiHole from DietPi-software, too, and adding the DHCP section to the file /etc/dnsmasq.conf but it didn’t work neither.
Please, can you help me? Am I doing something wrong? Is there any routing bug on RPI 2B?
I’m asking this last question because Michael Tremer, a main developer of IPFire distribution says about the Raspberry Pi 2 that it’s not very good for routing, and Arne.F, another core developer, talks about this, too, in http://forum.ipfire.org/viewtopic.php?t=12541
Thank you, than you very much!!
P.S. Should it be a good solution to forget the RPi 2 and buy an Odroid C1+ or XU4 and working with them with DietPi Debian distros?