How to share internet between STA and AP

hello everyone !!!
I am trying to create a device wifi sta + ap. Mode Ap is setup bridge mode, STA is connected to "wifi-home", but when my smart phone access to wifi ap, it can't connect to internet. Help me, please !! Thanks.

Try the travelmate package

2 Likes

Have a look to this guide: https://openwrt.org/docs/guide-user/network/wifi/relay_configuration

1 Like

I have followed but still not

Post your config files here, please.

1 Like

This is my config files :
/etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'platform/10300000.wmac'
        option htmode 'HT20'

config wifi-iface 'wifinet0'
        option ssid 'mn-audio'
        option encryption 'psk2'
        option device 'radio0'
        option mode 'ap'
        option network 'ap'
        option key '12345678'

config wifi-iface 'wifinet1'
        option ssid 'BKHUP'
        option device 'radio0'
        option mode 'sta'
        option key 'Up@BKhup'
        option network 'sta'
        option encryption 'psk2'
        option ifname 'sta'

/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 'fda3:b3cc:a166::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config device 'lan_dev'
        option name 'eth0'
        option macaddr '40:a3:6b:c4:72:ee'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '0'

config interface 'ap'
        option proto 'static'
        option ipaddr '192.168.4.1'
        option netmask '255.255.255.0'
        option broadcast '192.168.4.225'
        option ip6assign '60'
        option ip6hint '1'
        option gateway '192.168.12.1'
        option type 'bridge'

config interface 'sta'
        option proto 'dhcp'

config interface 'Share_net'
        option proto 'relay'
        list network 'ap'
        list network 'sta'

/etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.auto'
        option nonwildcard '1'
        option localservice '1'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option dhcpv6 'server'
        option ra 'server'
        option ra_slaac '1'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

config odhcpd 'odhcpd'
        option maindhcp '0'
        option leasefile '/tmp/hosts/odhcpd'
        option leasetrigger '/usr/sbin/odhcpd-update'
        option loglevel '4'

config dhcp 'ap'
        option start '100'
        option leasetime '12h'
        option limit '150'
        option interface 'ap'
        option ra 'server'
        option dhcpv6 'server'
        option ra_management '1'

Who is 192.168.12.1? How are devices on the AP or STA networks supposed to reach it?

1 Like

For initial testing, and really for production as long as security is not an issue (that is, you can trust all the users of the AP side), it is simplest to just attach the AP to the default lan network and the STA to the default wan network. Don't create any new networks. Remove all other interfaces (such as ethernet) from the wan network-- a STA can't be in a bridge.

Also if the IP you get from the upstream WAN is 192.168.1.X, that conflicts with the default LAN-- you can't reach the Internet without changing your lan to something outside that range.

1 Like