[SOLVED] Router connected to WiFi but no Inet/IP/Internet - GL-B1300

Hi all,
I've compiled my own OpenWRT for GL.iNet B1300, and I'm trying to connect the OpenWRT router (wireless, not using WAN nor LAN) to a WiFi network (the same one my PC is connected) and then be able to SSH the router from my PC.

I can connect to a WiFi network this way:

root@OpenWrt:~# wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

Everything looks fine, if I check the connection status its connected:

root@OpenWrt:~# iw dev wlan0 link
Connected to 00:a7:42:a3:c0:24 (on wlan0)
	SSID: myWifi_SSID
	freq: 2462
	RX: 17018 bytes (154 packets)
	TX: 782 bytes (6 packets)
	signal: -37 dBm
	tx bitrate: 1.0 MBit/s
	bss flags:	short-preamble
	dtim period:	1
	beacon int:	100

But when I run:

root@OpenWrt:~# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr E4:95:6E:43:30:4A  
          inet6 addr: fe80::e695:6eff:fe43:304a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:46 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6595 (6.4 KiB)  TX bytes:7004 (6.8 KiB)

wlan0 is not taking the IP address that should be provided by the router I'm connected.
I don't have internet access neither (cant ping anything, google, 8.8.8.8, etc).

I've been looking the files /etc/config/wireless, /etc/config/network, /etc/config/firewall, but don't know exactly what should I change/add.

I've tryied with another WiFi's network and it's the same.
If I connect the router through etherent cable, it has internet and everything works fine, but I need to use it in wireless mode.

Any suggestions? Thanks!!

In OpenWRT, the "raw" interfaces are typically bridged, so the IP address will appear on the bridge, not the interface. br-blah or the like

Hi Jeff, thanks for the answer.
I can only see the fixed IP address of the router itself in br-lan:

br-lan    Link encap:Ethernet  HWaddr E4:95:6E:43:30:4A  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fd1f:774:7776::1/60 Scope:Global
          inet6 addr: fe80::e695:6eff:fe43:304a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:635 errors:0 dropped:0 overruns:0 frame:0
          TX packets:419 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:77327 (75.5 KiB)  TX bytes:46707 (45.6 KiB)

Not the one that should be assigned, like the one in my PC "10.102.10.xxx".
Also there's this problem that don't have internet access when connected to this WiFi.

Have you read this article?
https://wiki.openwrt.org/doc/recipes/routedclient#usingmasquerade

Not sure exactly what you're trying to accomplish, but it might be that you want your existing router to continue supplying ISP connectivity, DHCP, DNS, and the like, but extend that service to wired clients plugged into your "new" OpenWRT box. In that case, you might want to look at "WDS" or the like to extend the network to the new box. There are multiple ways to do this, but WDS is probably the simplest when you aren't using VLANs on your network.

I haven't read through it in detail, but https://openwrt.org/docs/guide-user/network/wifi/atheroswds looks like it outlines the process reasonably well.

Thanks for your answers. I've read the articles -and implemented masquerade-, but I think that's not what I'm looking for, or if it is, it didn't work. I'm not trying to implement a bridge nor nothing fancy.
I need to connect my OpenWRT router to a WiFi AP in another router -which I don't have access to-.
Once the connection is established, there should be a DHCP conversation in which the AP router assigns an IP address to the OpenWRT router. But even when the connection is established, I don't get any IP from the AP router.
If instead I use wired connection, an IP address is assigned in eth0. But I need the wireless connection to work.
Is there any way I can debug this DHCP proccess? Maybe the AP router is not recognizing the OpenWRT router as a DHCP client, thus is not assigning and IP to it.
The idea is, once I have this working, being able to SSH the router from my laptop (connected to the same AP as the OpenWRT router).
OpenWRT router -->wifi_SSID
laptop -->wifi_SSID

laptop -->SSH-->OpenWRT router

Edit:
I found in this post that I should do:
$ sudo dhclient wlan0
But I don't have dhclient in openwrt!

You first need to setup the WiFi to be a client to the other access point. Since your WiFi will be a WWAN client, first create that new Interface and SSID to be used (DO NOT MAKE IT A BRIDGE). You can easily do this on by hitting "Scan" and "Join" on the wireless page of the web GUI.

Then you'll setup the firewall to allow traffic from LAN to WWAN, and enable masquerade on WWAN (unless you plan add routes into the upstream router for the downstream LAN subnet).

Thanks @lleachii, I don't have the GUI in the OpenWRT I'm using, though I found the solution in a similar way you're proposing:

Adjust the wan config zone in /etc/config/firewall adding wwan to the network list:

config zone
        option name             wan
        list   network          'wan'
        list   network          'wan6'
        list   network          'wwan'
        option input            REJECT
        option output           ACCEPT
        option forward          REJECT
        option masq             1
        option mtu_fix          1

edit /etc/config/wireless: enable radio0 and set router as client:

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'platform/soc/a000000.wifi'
        option htmode 'HT20'
        option disabled '0'

config wifi-iface 'client'
        option device 'radio0'
        option ssid '<SSID>'
        option mode 'sta'
        option encryption 'psk2'
        option key '<PASSWORD>'
        option network 'wwan'
 
#The following config (default) generates a WiFi
#network as a bridge of the one configured above
config wifi-iface 
        option device 'radio0'  
        option ssid 'OpenWrt'
        option mode 'ap'
        option encryption 'none'
        option network 'lan'

Allow the wwan to get it's IP via DHCP by adding the following to /etc/config/network:

config interface 'wwan'
	option proto 'dhcp'

So, after rebooting the device:

root@OpenWrt:/# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=57 time=9.818 ms
64 bytes from 8.8.8.8: seq=1 ttl=57 time=6.139 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 6.139/7.978/9.818 ms

root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr E4:95:6E:43:30:4A  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::e695:6eff:fe43:304a/64 Scope:Link
          inet6 addr: fd80:983f:74ec::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1738 (1.6 KiB)

eth0      Link encap:Ethernet  HWaddr E4:95:6E:43:30:4A  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:3297 (3.2 KiB)

eth1      Link encap:Ethernet  HWaddr E4:95:6E:43:30:4B  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:14026 (13.6 KiB)  TX bytes:14026 (13.6 KiB)

wlan0     Link encap:Ethernet  HWaddr E4:95:6E:43:30:4A  
          inet addr:10.102.12.28  Bcast:10.102.12.255  Mask:255.255.255.0
          inet6 addr: fe80::e695:6eff:fe43:304a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:99 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:15757 (15.3 KiB)  TX bytes:11810 (11.5 KiB)

wlan0-1   Link encap:Ethernet  HWaddr E6:95:6E:43:30:4A  
          inet6 addr: fe80::e495:6eff:fe43:304a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1440 (1.4 KiB)

Now I should be able to SSH the OpenWRT router through my PC using the IP 10.102.12.28
Thanks guys for your answers!!

1 Like

Excellent, be sure to add "[SOLVED]" to the title if your problem's resolved.

Will do. I did a few more changes, because I couldn't SSH from my PC to the router without editing the firewall.
In order to avoid that, I changed to a WLAN instead of WWAN:

/etc/config/firewall

config zone
        option name             lan
        list   network          'lan'
        list   network          'wlan'
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT

/etc/config/network

config interface 'wlan'
        option proto 'dhcp'

/etc/config/wireless

config wifi-iface 'client'
        option device 'radio0'
        option ssid '<SSID>'
        option mode 'sta'
        option encryption 'psk2'
        option key '<PASSWORD>'
        option network 'wlan'

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.