Code: Select all
less /etc/resolv.conf
domain localdomain
search localdomain
nameserver 192.168.1.1
nameserver 192.168.1.1
Code: Select all
iptables -A PREROUTING -t nat -i wlan0 -p tcp --dport 8200 -j DNAT --to 192.168.2.10:8200
iptables -A INPUT -p tcp -m state --state NEW --dport 8200 -i wlan0 -j ACCEPT
iptables -A PREROUTING -t nat -i wlan0 -p udp --dport 1900 -j DNAT --to 192.168.2.10:1900
iptables -A INPUT -p udp -m state --state NEW --dport 1900 -i wlan0 -j ACCEPT
Ok, this is now my /etc/iptables.ipv4.natSirLagz wrote:That way of doing things is still routing, which will cause issues like what you're experiencing with the TV.
The reason why you're experiencing issues is because the packets go from one network to another network. Unless you have port forwarded all the ports required for MiniDLNA from the PI to the TV, it won't work.
Add the following lines to iptables and see how you go.Code: Select all
iptables -A PREROUTING -t nat -i wlan0 -p tcp --dport 8200 -j DNAT --to 192.168.2.10:8200 iptables -A INPUT -p tcp -m state --state NEW --dport 8200 -i wlan0 -j ACCEPT iptables -A PREROUTING -t nat -i wlan0 -p udp --dport 1900 -j DNAT --to 192.168.2.10:1900 iptables -A INPUT -p udp -m state --state NEW --dport 1900 -i wlan0 -j ACCEPT
I wrote a wrong thing: my approach also uses iptable, routing not bridge.# Generated by iptables-save v1.4.20 on Sun Nov 10 18:50:55 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth0 -o wlan0 -j ACCEPT
COMMIT
# Completed on Sun Nov 10 18:50:55 2013
# Generated by iptables-save v1.4.20 on Sun Nov 10 18:50:55 2013
*nat
REROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
OSTROUTING ACCEPT [0:0]
-A POSTROUTING -o wlan0 -j MASQUERADE
-A PREROUTING -t nat -i wlan0 -p tcp --dport 8200 -j DNAT --to 192.168.2.10:8200
-A INPUT -p tcp -m state --state NEW --dport 8200 -i wlan0 -j ACCEPT
-A PREROUTING -t nat -i wlan0 -p udp --dport 1900 -j DNAT --to 192.168.2.10:1900
-A INPUT -p udp -m state --state NEW --dport 1900 -i wlan0 -j ACCEPT
COMMIT
# Completed on Sun Nov 10 18:50:55 2013
Hi,dodu wrote:nearly got it,
setup works corretly but, afterwards pc on eth0 cant ping anything in network connected to wlan0.
br0 hast ip 192.168.178.37 via DHCP
from Rpi i can ping my router 192.168.178.1 and google.de successfully but the connected pc on eth0 doesnt even receive dhcp ip and static ip doens't work either.
seems that the bridge is up but the connection doesn't work?
They probably read this board...The AP at my work must have safegaurds in place to prevent it working.
Code: Select all
0bda:8176 Realtek semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Code: Select all
ioctl[SIOCSWIAP]: Operation not permitted
ioctl[SIOCSIWEMCODEEXT]: Invalid argument
ioctl[SIOCSIWEMCODEEXT]: Invalid argument
Waiting for br0 to get ready (MAXWAIT is 5 seconds).
Internet Systems Consortium DHCP Client 4.2.2
All rights reserverd.
For info. please visit https://www.isc.org/software/dhcp/
Listening on LPF/br0/00:13:ef:50:0e:5d
Sending on LPF/br0/00:13:ef:50:0e:5d
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 4
DHCPOFFER from 10.0.0.254
DHCPACK from 10.0.0.254
Stopping NTP server: ntpd
Starting NTP server: ntpd
bound to 10.0.0.1 -- renewal in 431540 seconds
done.
Code: Select all
Mar 19 19:30:33 matchbox kernel: [45763.039162] br0: port 1(wlan0) entered forwarding state
Mar 19 19:30:33 matchbox kernel: [45763.039238] br0: port 1(wlan0) entered forwarding state
Mar 19 19:30:33 matchbox kernel: [45763.040030] br0: port 1(wlan0) entered disabled state
Mar 19 19:30:33 matchbox ifplugd(wlan0)[1719]: Link beat detected.
Mar 19 19:30:37 matchbox ifplugd(wlan0)[1719]: Link beat lost.
Code: Select all
[ 28.705411] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[ 28.798028] device eth0 entered promiscuous mode
[ 28.861362] device wlan0 entered promiscuous mode
[ 28.927519] br0: port 2(wlan0) entered forwarding state
[ 28.927727] br0: port 2(wlan0) entered forwarding state
[ 28.927784] br0: port 1(eth0) entered forwarding state
[ 28.927839] br0: port 1(eth0) entered forwarding state
Code: Select all
auto lo0
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
auto br0
iface br0 inet dhcp
bridge ports eth0 wlan0
bridge_stp off
bridge_maxwait 5
Code: Select all
# /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet manual
auto ath0
iface ath0 inet manual
bridge_ports eth0
bridge_hw <mac-address-of-wireless-dongle>
bridge_stp off
bridge_maxwait 5
allow-hotplug wlan0
auto wlan0
iface wlan0 inet manual
pre-up wpa_supplicant -Dwext -i wlan -b ath0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
#iface default inet dhcp
Code: Select all
# /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant Group=netdev
update_config=1
ap_scan=2
eapol_version=1
network={
ssid="Your-SSID"
scan_ssid=1
mode=0
proto=WPA
pairwise=TKIP
group=TKIP
key_mgmt=WPA-PSK
psk="Your-Pre-Shared-Key"
}
Code: Select all
#!/bin/sh -e
#
# /etc/rc.local
brctl addif ath0 wlan0
ebtables -t nat -A POSTROUTING -o wlan0 -j snat --to-src <mac-address-of-wireless-dongle> --snat-arp --snat-target ACCEPT
ebtables -t nat -A PREROUTING -p IPv4 -i wlan0 --ip-dst <IP-address-of-device> -j dnat --to-dst <mac-address-of-device> --dnat-target ACCEPT
ebtables -t nat -A PREROUTING -p ARP -i wlan0 --arp-ip-dst <IP-address-of-device> -j dnat --to-dst <mac-address-of-device> --dnat-target ACCEPT
Excellent, thanks! I will have a play next week when I am back homebaantonia wrote:Success yesterday! ......
Although SiriusHardware only required a temporary connection.This may be a crazy question, but is there any way to easily allow a Pi with a working wi-fi connection to 'share' its internet connection with anything plugged into the ethernet conenctor, in much the same way as Windows computers can be set to do that?
Code: Select all
auto lo
iface lo inet loopback
iface eth0 inet manual
auto wlan0
iface wlan0 inet manual
pre-up wpa_supplicant -B w -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
auto br0
iface br0 inet dhcp
bridge_ports wlan0 eth0
bridge_stp off
bridge_maxwait 5
bridge_fd 0
Code: Select all
# This file may be changed either manually or by running dpkg-reconfigure.
#
# N.B.: dpkg-reconfigure deletes everything from this file except for
# the assignments to variables INTERFACES, HOTPLUG_INTERFACES, ARGS and
# SUSPEND_ACTION. When run it uses the current values of those variables
# as their default values, thus preserving the administrator's changes.
#
# This file is sourced by both the init script /etc/init.d/ifplugd and
# the udev script /lib/udev/ifplugd.agent to give default values.
# The init script starts ifplugd for all interfaces listed in
# INTERFACES, and the udev script starts ifplugd for all interfaces
# listed in HOTPLUG_INTERFACES. The special value all starts one
# ifplugd for all interfaces being present.
#INTERFACES=""
#HOTPLUG_INTERFACES=""
#ARGS="-q -f -u0 -d10 -w -I"
#SUSPEND_ACTION="stop"
Code: Select all
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="your ssid here"
psk="your preshared key here"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
mean?ifplugd(eth0) Link beat detected
Code: Select all
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="mynetwork"
psk="secret"
key_mgmt=WPA-PSK
}
Code: Select all
sudo apt-get install bridge-utils
sudo brctl addbr br0
sudo brctl addif br0 wlan0 eth0
Code: Select all
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Code: Select all
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
brctl addbr br0
brctl addif br0 wlan0 eth0
exit 0