PDA

View Full Version : Problems forwarding traffic between 2 interfaces on same device .



pedropt
2015-11-29, 23:15
Hi everyone , i am doing here a project with my RPI , and i have some issues on forwarding traffic between 2 interfaces on my raspberry .

The main Objective is this one :
http://s21.postimg.org/k68ayomo7/design.jpg

This will work like this :

- Rpi using Wireless card will get internet from one of the wireless routers
- RPI will forward traffic from eth0 to wlan0 and vice-versa
-RPI will act as a dhcp router
-Connected to ETH0 port of RPI will be a network switch

What did i installed so far :
-isc-dhcp-server

Status of the project :

- RPI is delivering dhcp leases on lan
- RPI is retrieving internet from wifi routers

What is not working :
-Clients connected to switch dont have internet access

Configurations made so far on RPI :


/etc/dhcp/dhcpd.conf

subnet 10.5.5.0 netmask 255.255.255.224 {
range 10.5.5.26 10.5.5.30;
option routers 10.5.5.1;
option broadcast-address 10.5.5.31;
option domain-name-servers 10.5.5.1;
default-lease-time 600;
max-lease-time 7200;
}


RPI is using static Ip address :

/etc/network/interfaces
iface eth0 inet static
address 10.5.5.1
netmask 255.255.255.224
gateway 10.5.5.0

-Sysctl.conf have forward ipv4 rule activated .
-no iptables installed


/etc/default/isc-dhcp-server

is listening on eth0 interface
Anyone have an idea why i cant get packet forward on eth0 to wlan0 ?

pedropt
2015-11-30, 18:52
Problem Solved .
Solution was to remove ics-dhcp-server and installing dnsmasq in its place .
Configuring dnsmasq to deliver dhcp leases over eth0 .

Was not working due some possible conflict between ics-dhcp-server and dnsmasq .
iptables was also installed using these temporary rules :


*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o wlan0 -j MASQUERADE
COMMIT
# Completed on Mon Nov 30 18:32:42 2015
# Generated by iptables-save v1.4.21 on Mon Nov 30 18:32:42 2015
*filter
:INPUT ACCEPT [117:8424]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [70:11696]
-A FORWARD -i eth0 -o wlan0 -j ACCEPT
-A FORWARD -i wlan0 -o eth0 -j ACCEPT
COMMIT


Tips taken from this link in ubuntu , however , the example they were giving was the inverse i was doing here , so i had to change the interfaces in configuration .
No hostapd was installed because i was not providing an Access point .
http://ubuntuforums.org/showthread.php?t=2184949

and also some tips taken from this link from RPI Website :
http://raspberrypihq.com/how-to-turn-a-raspberry-pi-into-a-wifi-router/

duxim
2015-11-30, 19:37
Good work!
thanks for idea and solution