OpenWrt Forum Archive

Topic: Internet through wireless and NOT WAN

The content of this topic has been archived on 13 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all

I was thinking if it's possible to obtain internet through Wireless and NOT WAN.
I need this for a few units that are not able to implement wireless themselves but just need a conn. to the net.
Additionally I am curious about the tweaking of the transmitting power of the WRT54G. It can be increased to 251 mW. How does this affect the range/durability?
I imagine that it will not tweak the recievers sensitivity accordingly big_smile

Regards

I was thinking if it's possible to obtain internet through Wireless and NOT WAN.

the short answer is remove eth1 from nvram lan_ifnames and set nvram wan_ifname (be careful of the s) to eth1.

for a v1.x it's eth2, not eth1.

something along the lines of

nvram set lan_ifnames=vlan0
nvram set wan_ifname=eth1
nvram commit
reboot

should just about do it.

you can use set lan_ifnames='vlan0 vlan1' to add the wan port to the switch.

the general rule is interfaces in lan_ifnames get added to the bridge, and the interface in wan_ifname is the WAN interface.

WARNING: please don't just type in these commands. read about them first.  you could easily make your router inaccessible.

This is how I did it in openWRT:

I start by "turning around" the firewall: normally it's open from LAN and WLAN, and closed from WAN. Doing this first allows you to connect to the WAN port in case you accidentally mess up the LAN ports.
The WAN port will still be in DHCP mode, so you can simply plug it into your hub/switch.

/etc/init.d/S45firewall is:
#!/bin/sh
. /etc/functions.sh

WAN=$(nvram get wan_ifname)
WIFI=$(nvram get wifi_ifname)

IPT=/usr/sbin/iptables

for T in filter nat mangle ; do

  $IPT -t $T -F
  $IPT -t $T -X
done

$IPT -t filter -A INPUT -m state --state INVALID -j DROP
$IPT -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
$IPT -t filter -A INPUT -i $WIFI -j DROP

$IPT -t filter -A FORWARD -m state --state INVALID -j DROP 
$IPT -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT 
$IPT -t filter -A FORWARD -i $WIFI -j DROP
$IPT -t filter -A FORWARD -o $WIFI -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

$IPT -t nat -A POSTROUTING -o $WIFI -j MASQUERADE                                                    

Next step is breaking down the bridge, keep an eye on http://openwrt.org/OpenWrtNVRAM for details.

nvram set lan_ifname=vlan0        # [ "vlan2"on v1 ]
nvram set lan_proto=static
nvram set lan_ipaddr=192.168.102.1    # Use some obscure IP to prevent conflicts with any AP

nvram set wifi_ifname=eth1        # [ "eth2" on v1 ]
nvram set wifi_proto=static

nvram commit
reboot

Then put the box into client mode:

nvram set wl0_mode=sta            # Station mode (client mode)
nvram commit
reboot

Install the wl package:

cd /etc
rm ipkg.conf
cp /rom/etc/ipkg.conf .
vi ipkg.conf

And add this line to ipkg.conf:

src free.fr http://wrt54g.free.fr/openwrt/b4/ipkg/

Then install wl:

ipkg update
ipkg install wl

Now you can use

wl scan; sleep 2; wl scanresults
wl join SSID amode open
udhcp -q -n -i eth1    # eth2 on v1.1

I made some ash scripts that automatically keep scanning for APs and then automatically connect and create a VPN to a server of mine. I plan to package it when I finished the details.

As far as I understood things, 84mW is the maximum the Linksys can do anyway. The nvram setting can go higher (it's 255 by default on openwrt), but I'm still a little confused how it really works.

You can check some of the settings using

wl curpower

and

wl txpwr

Hope this helps.

Jannes

The discussion might have continued from here.