OpenWrt Forum Archive

Topic: Wlan Client on Attitude not reachable without rj45 cable

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

I have TP-Link 842ND. I set up wlan client and can ping the ip of the new wwan interface and its also bound to that interface.
When i unplug the lan, the ip is no more reachable. Why is this?

Also i tried to setup bridging between wwan and lan but failed. I tried also parprouted:
http://randomtristan.blogspot.de/2011/0 … -wpa2.html
and failed too.

I just want to have that wwan interface reachable, what can i do?

/etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '11'
        option macaddr 'localmac'
        list ht_capab 'SHORT-GI-20'
        list ht_capab 'SHORT-GI-40'
        list ht_capab 'TX-STBC'
        list ht_capab 'RX-STBC1'
        list ht_capab 'DSSS_CCK-40'
        option hwmode '11g'
        option country 'DE'
        option txpower '20'
        option disabled '0'

config wifi-iface
        option ssid 'myssid'
        option encryption 'psk2'
        option device 'radio0'
        option mode 'sta'
        option bssid 'remotemac'
        option key 'pass'
        option network 'WWAN'

/etc/config/network

confg interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.2.5'
        option gateway '192.168.2.1'
        option dns '192.168.2.1'
        option _orig_ifname 'eth0'
        option _orig_bridge 'true'
        option ifname 'eth0'

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'

config switch
        option name 'eth0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'eth0'
        option vlan '1'
        option ports '0 1 2 3 4'

config interface 'WWAN'
        option proto 'static'
        option ipaddr '192.168.2.6'
        option netmask '255.255.255.0'
        option gateway '192.168.2.1'
        option dns '192.168.2.1'

iwconfig

wlan0     IEEE 802.11bgn  ESSID:"myssid"
          Mode:Managed  Frequency:2.462 GHz  Access Point: remotemac
          Bit Rate=24 Mb/s   Tx-Power=20 dBm
          RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=70/70  Signal level=-40 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:7   Missed beacon:0
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.2.1     0.0.0.0         UG    0      0        0 wlan0
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
192.168.2.0     *               255.255.255.0   U     0      0        0 wlan0
eth0      Link encap:Ethernet  HWaddr localmac1
          inet addr:192.168.2.5  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1064 errors:0 dropped:7 overruns:0 frame:0
          TX packets:816 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:142494 (139.1 KiB)  TX bytes:326967 (319.3 KiB)
          Interrupt:5

wlan0     Link encap:Ethernet  HWaddr localmac2
          inet addr:192.168.2.6  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:453 errors:0 dropped:7 overruns:0 frame:0
          TX packets:114 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:60055 (58.6 KiB)  TX bytes:10808 (10.5 KiB)

(Last edited by xrated on 26 Apr 2014, 11:51)

I'd be happy to hear an explanation of why this must be so in openWrt, but in my experience, a client's wired and wireless interfaces cannot be on the same net. 

For something which is purely a client, when the wifi ip is in the range of 192.168.2.x (for instance), I make the wired ip 192.168.0.x so that I can access and configure it via the lan if something gets botched on the wireless connection. 

Sorry if this doesn't address the actual problem which you are facing.

Yes, a new subnet for lan works fine.
Maybe its possible to setup routing from wan to lan ? How?

Or i configured bridging wrong, not sure on what interface it needs to be bridged.

Edit: i got in wrong section, if somebody could move topic would be great

(Last edited by xrated on 27 Apr 2014, 13:43)

Since you are on Atheros, yes, you need to make a bridged client.
Only AP wifi and LAN ports can be on the same net
STA wifi (client mode) and LAN cannot be on the same net, unless with bridge (relayd)
This should work


Install Relayd

opkg update 
opkg install relayd
/etc/init.d/relayd enable


/etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '11'
        option macaddr 'localmac'
        list ht_capab 'SHORT-GI-20'
        list ht_capab 'SHORT-GI-40'
        list ht_capab 'TX-STBC'
        list ht_capab 'RX-STBC1'
        list ht_capab 'DSSS_CCK-40'
        option hwmode '11g'
        option country 'DE'
        option txpower '20'
        option disabled '0'

config wifi-iface
        option ssid 'myssid'
        option encryption 'psk2'
        option device 'radio0'
        option mode 'sta'
        option bssid 'remotemac'
        option key 'pass'
        option network 'wwan'


/etc/config/network

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config interface 'lan'
    option ifname 'eth0'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.10.1'   #not an error. Leave as this!
    option gateway '192.168.2.1'
    option netmask '255.255.255.0'
    option dns     '192.168.2.1'

config interface 'wwan'
        option proto 'static'
        option ipaddr '192.168.2.6'
        option netmask '255.255.255.0'
        option gateway '192.168.2.1'
        option dns '192.168.2.1'

config 'interface' 
    option 'proto' 'relay' 
    option 'network' 'lan wwan' 
    option ipaddr '192.168.2.6'

You can access the openwrt router from devices connected to the main router and also from the connected to it, at the IP 192.168.2.6

/etc/config/dhcp

config dhcp lan
    option interface    lan
    option start     100
    option limit    150
    option leasetime    12h
    option ignore    1

config dhcp wan
    option interface    wan
    option ignore    1

As we want to make all the same network, we can disable the firewall:

/etc/init.d/firewall stop
/etc/init.d/firewall disable

.


Good luck!

(Last edited by dabyd64 on 28 Apr 2014, 03:17)

Thanks, dabyd64, for the full presentation on relayd and proper usage of the configuration files to enable it.  I've seen many mentions of relayd and bridging, but haven't seen it laid out so clearly.

Yes, is a problem with openwrt. Not easy to start with it, strange config files and unknown commands eveywhere.
Once you play with it, its great. But you have to play a lot with it lol

Let me know if it worked for you! I tried this on a spare router with openwrt that I had frogotten in a box, it worked at the first time wink

Yes, openWrt (and Linux) is a vast field.  I've been playing with openWrt since 2008, using it mostly as a headless operating system for little computers--on several dozen devices for logging sensor readings and controlling things about the house.  Aside from relatively simple networking, router stuff remains a mystery to me, so I'm happy when someone plainly reveals another piece of the puzzle (not that it's not explained elsewhere--it's a matter of it coming to me at a time when I'm able to understand and absorb it).

So, did it work in the end?

sorry for delay.
I tried config but the only difference i saw that i could access 192.168.2.6 on lan in addition to my 192.168.3.1. And that worked also without relayd.

What would be also interesting, that if i client is connected to this openwrt box, if it could reach the main network. If openwrt could act as an wlan repeater or lan to wwan router.

Another guide
http://wiki.openwrt.org/doc/recipes/relayclient

current config

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.3.1'
        option gateway '192.168.2.1'
        option dns '192.168.2.1'
        option ifname 'eth0'

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'

config switch
        option name 'eth0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'eth0'
        option vlan '1'
        option ports '0 1 2 3 4'

config interface 'wwan'
        option proto 'static'
        option ipaddr '192.168.2.6'
        option netmask '255.255.255.0'
        option gateway '192.168.2.1'
        option dns '192.168.2.1'
        option _orig_ifname 'eth1'
        option _orig_bridge 'false'

config interface 'stabridge'
        option proto 'relay'
        option network 'lan wwan'

firewall

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option network 'lan wwan'
        option forward 'ACCEPT'

(Last edited by xrated on 6 May 2014, 11:58)

So, what is the current problem?
With relayd enabled and firewall disabled, any device can connect the main network, and also from the main network to the openwrt box connected devices

nope, cannot access main network from clients on openwrt and also cannot access those clients from main network.

Also i cannot access lan interface from main network.

How any client in main network should know that 192.168.3.0 network is reachable over 192.168.2.6 host?


In the past i could also not get bridging to work.

(Last edited by xrated on 7 May 2014, 20:05)

Something must be wrong.
Bridged network should be in the same net as the main router (all 192.168.2.x)
The 192.168.3.1 is just to access the openwrt router, configuring your ip manually, just in  the case that the main router goes down or something else.
All the clients should be getting 192.168.2.x IPs. If they are being assigned with 3.x IPs then you didn't disable DHCP!
/etc/config/dhcp

config dhcp lan
    option interface    lan
    option ignore    1

(Last edited by dabyd64 on 7 May 2014, 20:43)

I was wrongly assuming that i had to use 192.168.3.0 subnet on clients and it didnt work because i manually set ip address.
Now it fully works, the only thing doesnt work, i cannot access clients from main network.

firewall

config zone
        option name 'lan'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option network 'lan wwan'
        option forward 'ACCEPT'

dhcp

config dhcp 'lan'
        option interface 'lan'
        option ignore '1'

wireless

config wifi-iface
        option ssid 'ssidofmainwlan'
        option encryption 'psk2'
        option device 'radio0'
        option mode 'sta'
        option bssid 'macofmainwlan'
        option key 'secret'
        option network 'WWAN wwan'

config wifi-iface
        option device 'radio0'
        option mode 'ap'
        option ssid 'OpenWrt'
        option network 'lan'
        option encryption 'psk2+ccmp'
        option key 'secret'

network

config interface 'lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.3.1'
        option gateway '192.168.2.1'
        option dns '192.168.2.1'
        option ifname 'eth0'
        option type 'bridge'

config interface 'wwan'
        option proto 'static'
        option ipaddr '192.168.2.6'
        option netmask '255.255.255.0'
        option gateway '192.168.2.1'
        option dns '192.168.2.1'

config interface 'stabridge'
        option proto 'relay'
        option network 'lan wwan'
        option ipaddr '192.168.2.6'

The last line is there so that the router can be accessed from the client network.
I dont know why luci added the option type bridge to lan, maybe its not needed.
Do reboot if it doesnt work.

(Last edited by xrated on 8 May 2014, 15:29)

Try with automatic IP?

100% sure that you disabled the firewall?

(Last edited by dabyd64 on 8 May 2014, 17:10)

All is in same zone (lan wwan) and everything set to accept, so firewall should be no issue.

The gold rule there is to don't suppose anything. Try and see!
/etc/init.d/firewall disable
reboot

The discussion might have continued from here.