OpenWrt Forum Archive

Topic: opkg update with bridged AP

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

I have a DIR-825 which I'm trying to configure as a kind of dumb AP. A router with DHCP is connected to the WAN port with address 192.168.0.1, and the DIR-825 has static address 192.168.0.2. Wifi works and gets ip addresses from the router on the WAN, so does anything connected to the LAN ethernet ports. I can easily access LuCI/ssh by going to 192.168.0.2.

When I try to update packages though, it fails. I can ping LAN addresses except for 192.168.0.1, for which the packets get lost. Trying to ping 8.8.8.8 gives me "ping: sendto: Network is unreachable". Here is the output of route:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 br-lan


And here is /etc/config/network (with ula_prefx removed, I don't know if this is important or not), which seems to work, but is probably wrong somehow...:

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 '[   removed ]'

config interface 'lan'
    option type 'bridge'
    option _orig_ifname 'eth0.1 radio0.network1 radio1.network1'
    option _orig_bridge 'true'
    option proto 'static'
    option gateway '192.168.0.1'
    option ifname 'eth0.1 eth1'
    option ipaddr '192.168.0.2'
    option netmask '255.255.255.0'
    option broadcast '192.168.0.1'
    option dns '8.8.8.8'

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

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option ports '0 1 2 3 5t'


Please help!

Ash

Wrong braodcast address. Change to 192.168.0.255

Doesn't your broadcast have to be .255?

ash87 wrote:

Here is the output of route:

Kernel IP routing table
Destination     Gateway         Genmask           Flags  Metric  Ref    Use  Iface
192.168.0.0    *                      255.255.255.0   U         0         0        0      br-lan

This routing table says: "When the destination of the packet is 192.168.0.0/24, send it through the 'br-lan' interface without modifications."

If the destination is anything else (as it is for traffic going to Youtube, Google or anywhere else), your router does not know what to do with it. Hence, you get the error "Network is unreachable".

From the perspective of the routing table, you are missing an entry such as the following:

root@Openwrt: # route -n

Kernel IP routing table
Destination     Gateway         Genmask       Flags Metric Ref  Use Iface
0.0.0.0         192.168.0.1     0.0.0.0       UG    0      0    0   br-lan

FIRST fix the broadcast address from the interface definition, as suggested by the other posters. Then issue '/etc/init.d/network restart' to apply the changes, and use 'route -n' to get the new routing table. Check if the '0.0.0.0' or 'default' destination has now appeared into the routing table.

IF you still do not have the default route after the changes above, try adding the following rule to your '/etc/config/network' file, below the interface definition:

config 'route' 'lan_default_gateway'
        option 'interface' 'lan'
        option 'target' '0.0.0.0'
        option 'netmask' '0.0.0.0'
        option 'metric' '0'

Note that this relies that the 'gateway' option is set on the interface. According to the config you posted, you already have this.

After adding this rule, issue '/etc/init.d/network restart' and check 'route -n' again.

(Last edited by Antek on 3 Jun 2017, 15:35)

Thanks very much, fixing the broadcast address sorted it out big_smile

The discussion might have continued from here.