Lubuntu

Internet sharing from wireless to eth0

2 5109
TooMeeK  
Post Last Edited by TooMeeK at 2014-8-8 17:33

Hello,
I needed small Internet sharing device (temporary, since my USB is failing), so to let You know how to fast configure small routing device:
1. start Lubuntu 3.0
2. pick up iptables script from:
http://www.debuntu.org/iptables-how-to-share-your-internet-connection-page-2/
and save it as: /etc/scripts/internet.sh
3. replace WAN and LAN values with desired config
(wlan0 - WAN, br0 - LAN in my case)
4. make it executable:
sudo chmod +x /etc/scripts/internet.sh
5. check if wlan0 driver is loaded
sudo ifconfig -a
if it returns different name, example wlan3 then rename it under:
/etc/udev/rules.d/70-persistent-net.rules
6. now edit /etc/network/interfaces, this is just example for WPA2 network and bridged interface:
auto lo
iface lo inet loopback

#Manual mode for Gigabit NIC
auto eth0
iface eth0 inet manual

# Bridge for VM traffic
auto br0
iface br0 inet static
    address 192.168.0.222
    netmask 255.255.255.0
    network 192.168.0.0
    broadcast 192.168.0.255
#    gateway 192.168.0.1
#    dns-nameservers 192.168.0.1 8.8.8.8
    bridge-ports  eth0
    bridge-fd     9
    bridge-hello  2
    bridge-maxage 12
    bridge-stp    off

#Wireless
auto wlan0
iface wlan0 inet dhcp
    wpa-ssid Network-Name-Here
    wpa-psk Network-Pass-Here


7. test config, if it works (espieccialy wireless) then update /etc/rc.local:


#Reboot on kernel panic
echo "1" > /proc/sys/kernel/panic

#ssh
/usr/sbin/sshd

#Enable offload for onboard Gigabit NIC
ethtool -K eth0 rx on tx on sg on gso on gro on

#Swap
swapon /swapfile.swp

#Internet sharing
/etc/scripts/internet.sh


8. Of course there is no DNS service on Banana, You'll have to use external address like Google's cached servers 8.8.8.8 on Your client.

Hope this helps somebody else..
Thanks for sharing...could come in handy.

TooMeeK  
Post Last Edited by TooMeeK at 2014-8-9 17:58

There is an error.
I think /etc/rc.local script is starting before wlan0 is up, so there is no internet access until it's started second time after full OS boot.
I'm investigating this issue.
UPDATE:
WORKAROUND - start via init scripts.
Move Your firewall script to file:
/etc/init.d/internet-sharing
mark it executable
chmod +x /etc/init.d/internet-sharing
update header to:

### BEGIN INIT INFO
# Provides:        internet-sharing
# Required-Start:  $network $remote_fs $syslog
# Required-Stop:   $network $remote_fs $syslog
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Start Internet sharing on Banana Pi from wlan0 to br0
### END INIT INFO

update init scripts:
update-rc.d internet-sharing defaults 99
check if these values exists with 99:
ls -l /etc/rc3.d/
if something goes wrong then remove it from init:
update-rc.d -f internet-sharing remove

You have to log in before you can reply Login | Sign Up

Points Rules