I am using a device that only has WiFi (so it doesn't have any ethernet ports) and I would like to configure OpenWrt so that it can act as a "normal" WiFi client for my existing home WiFi network.
I know this may not be the standard use case for OpenWrt, but the device (a Kickstarter project) is delivered with a specific OpenWrt installation and so I'm trying to configure that for my use case.
The default config creates a bridge and makes the device act as an AP. In addition you can then enable an 'apcli0' device so that the device itself can connect to the internet using your existing WiFi network.
Now I would like to change the configuration so I can omit the AP part and only make the device connect and act as a client to my existing WiFi network. From what I understand I will always need to create a separate LAN configured with a separate subnet, is that correct? It would be nice if it could be configured without that, but if not that's acceptable. As long as I can prevent it from acting as an AP.
The existing (default) configs looks like this:
/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 globals 'globals'
option ula_prefix 'fd78:1a07:d46d::/48'
config interface 'lan'
option ifname 'eth0.1'
option force_link '1'
option macaddr '9c:65:f9:1d:c6:2b'
option type 'bridge'
option proto 'static'
option netmask '255.255.255.0'
option ip6assign '60'
option ipaddr '192.168.100.1'
option ipv6 '0'
config interface 'wan'
option force_link '1'
option proto 'dhcp'
option ifname 'apcli0'
option macaddr '9E:65:F9:0D:81:28'
config interface 'wan6'
option ifname 'eth0.2'
option proto 'dhcpv6'
/etc/config/wireless
config wifi-device 'radio0'
option type 'ralink'
option variant 'mt7628'
option country 'TW'
option hwmode '11g'
option htmode 'HT40'
option channel 'auto'
option disabled '0'
config wifi-iface 'ap'
option device 'radio0'
option mode 'ap'
option network 'lan'
option ifname 'ra0'
option encryption 'none'
option ssid 'ReSpeaker1DD45B'
option seq '1'
config wifi-iface 'sta'
option device 'radio0'
option mode 'sta'
option network 'wan'
option ifname 'apcli0'
option led 'mediatek:orange:wifi'
option ssid 'UplinkAp'
option key 'SecretKey'
option encryption 'psk'
option disabled '1'
Now I would think that something like this should work:
/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 proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
config interface 'wan'
option ifname 'ra0'
option proto 'static'
option ipaddr '172.16.100.12'
option netmask '255.255.255.0'
option gateway '172.16.100.1'
option dns '172.16.100.1'
/etc/config/wireless
config wifi-device 'radio0'
option type 'ralink'
option variant 'mt7628'
option country 'TW'
option hwmode '11g'
option htmode 'HT40'
option channel 'auto'
config wifi-iface 'sta'
option device 'radio0'
option mode 'sta'
option network 'wan'
option ifname 'apcli0'
option ssid 'xxxxxxx'
option encryption 'psk2'
option key 'xxxxxxx'
But sadly it doesn't. Maybe unrelated, but during a reboot I see this error ERROR!!! RTMPReadParametersHook failed, Status[=0x00000001]
and the wan
interface doesn't come up on it's own. When I run ifup wan
manually the interface is enabled and ifconfig
now gives me:
eth0 Link encap:Ethernet HWaddr 9C:65:F9:1D:C6:2B
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::9e65:f9ff:fe1d:c62b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:138 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:27618 (26.9 KiB)
Interrupt:5
eth0.1 Link encap:Ethernet HWaddr 9C:65:F9:1D:C6:2B
inet6 addr: fe80::9e65:f9ff:fe1d:c62b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:7777 (7.5 KiB)
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:106 errors:0 dropped:0 overruns:0 frame:0
TX packets:106 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7028 (6.8 KiB) TX bytes:7028 (6.8 KiB)
ra0 Link encap:Ethernet HWaddr 9C:65:F9:1D:D4:5B
inet addr:172.16.100.12 Bcast:172.16.100.255 Mask:255.255.255.0
inet6 addr: fe80::9e65:f9ff:fe1d:d45b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:589 (589.0 B) TX bytes:0 (0.0 B)
Interrupt:6
So almost there, but still no connect apcli0
interface. When it try wictl
it does "see" my network and lets me connect to it, after which everything works how I would want/expect it except for the fact that the apcli0
interface does DHCP and gets a random IP instead of my statically configured IP. So how do I config that so it works without these manual steps and uses the static IP? Any ideas/pointers would be very much appreciated! Thanks!