Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5318

Advanced users • Re: How to share internet from WLAN to LAN?

$
0
0
This is the setup for WLAN is connected to the Internet, and you want to serve
a single client via "usb0". I.e., it is running on a ZeroW, where the
wireless connects to your router, and the USB port on the ZeroW is setup in
"gadget mode" - and then it "just works" when you plug the other end of the
USB cable into the USB port of your PC.

I think all you have to do to make it work with the ethernet port is changed
every occurrence of "usb0" with "eth0".

First, put these lines somewhere where they will get executed on startup:

Code:

    . Setup_Tables    ifconfig usb0 192.168.5.1    > /var/lib/misc/udhcpd.leases    busybox udhcpd -S udhcpd.conf
The contents of "Setup_Tables" is:

Code:

    echo 1 > /proc/sys/net/ipv4/ip_forward    iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE    iptables -A FORWARD -i wlan0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT    iptables -A FORWARD -i usb0 -o wlan0 -j ACCEPT
The contents of "udhcpd.conf" is:

Code:

     start 192.168.5.20    end192.168.5.254    interfaceusb0#default: eth0    optdns8.8.8.8    optionsubnet255.255.255.0    optrouter192.168.5.1    optiondomainlocal    optionlease864000# 10 days of seconds

Statistics: Posted by BigRedMailbox — Sun Feb 25, 2024 11:43 pm



Viewing all articles
Browse latest Browse all 5318

Trending Articles