Can't access hosts on lan

I can't access host on my lan via http://192.168.1.10 or http://hostname.lan
I can ping 192.168.1.10. When I have the host plugged into a different router, I can access http://hostname.lan

I have tried a bunch of different settings in luci... Messing with firewall zones, traffic rules (but these are lan addresses so I thought they didn't hit the firewall zones), custom DNS server (192.168.1.1) on lan zone, custom DNS server (192.168.1.1) on eth1 zone, accept packets with local source address in the bridge device as well as eth1 device. local domain on dhcp general settings is lan.

I think this is an easy fix but I don't know enough about openwrt to figure it out.

Help is appreciated. Thanks.

The firewall and routing engine will not be involved assuming you have a single subnet/lan.

Let's start with the following:

  • How are you trying to access the host at 192.168.1.10? Is it from another host in the 192.168.1.0/24 network?
  • Is either (or both) hosts wireless? Or are they wired? Or one each?
  • What is the address of the host that is trying to access 192.168.1.10?
  • Have you verified that the host you believe to be at 192.168.1.10 is actually using that address?
  • And is that host listening for incoming http (port 80) requests? (Pro-tip: if it is a windows machine, you may need to turn off the firewall)

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/wireless
cat /etc/config/dhcp
cat /etc/config/firewall

Name resolution works (using default dhcp/ dns settings) if you either:

  • set up a static DHCP lease (with option dns '1')
  • if there is no static lease, if the client requested a DHCP lease and provided its hostname to the DHCPd during the DHCP request (this is optional, not all clients do)
    this also means if you just replaced routers without making the clients request a DHCP lease (e.g. by rebooting them), the router won't know about it until they do (may take hours to half a day+).

The static DHCP lease is preferred.

For anything beyond these, you will have to provide more information (as indicated by psherman).

1 Like

both devices are eth. router has wireless but nothing connected yet. my pc is wired at 192.168.1.40. hostname i'm trying to connect to is rpi.

BOARD
{
        "kernel": "5.10.176",
        "hostname": "route",
        "system": "ARMv8 Processor rev 3",
        "model": "Raspberry Pi 4 Model B Rev 1.4",
        "board_name": "raspberrypi,4-model-b",
        "rootfs_type": "ext4",
        "release": {
                "distribution": "OpenWrt",
                "version": "22.03.5",
                "revision": "r20134-5f15225c1e",
                "target": "bcm27xx/bcm2711",
                "description": "OpenWrt 22.03.5 r20134-5f15225c1e"
        }
}

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

config globals 'globals'
        option packet_steering '1'

config device
        option name 'br-lan'
        option type 'bridge'
        option bridge_empty '1'
        list ports 'eth1'
        option ipv6 '0'
        option acceptlocal '1'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr '192.168.1.1'
        list dns '192.168.1.1'
        option delegate '0'

config interface 'wan'
        option device 'eth0'
        option proto 'dhcp'

config interface 'eth1'
        option device 'eth1'
        option proto 'none'
        option type 'bridge'
        list dns '192.168.1.1'

config device
        option name 'eth0'
        option acceptlocal '0'
        option sendredirects '0'

config device
        option name 'eth1'
        option acceptlocal '1'

DHCP
config dnsmasq
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option domain 'lan'
        option expandhosts '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option ednspacket_max '1232'
        option localservice '0'
        option boguspriv '0'
        list address '/route.lan/192.168.1.1'

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

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 'eth1'
        option interface 'eth1'

config host
        option dns '1'
        option ip '192.168.1.30'
        option name 'rpi'

FIREWALL
config defaults
        option input 'ACCEPT'
        option output 'ACCEPT'
        option synflood_protect '1'
        option flow_offloading '1'
        option forward 'REJECT'

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

config rule
        option name 'Allow-DHCP-Renew'
        option src 'wan'
        option proto 'udp'
        option dest_port '68'
        option target 'ACCEPT'
        option family 'ipv4'

config rule
        option name 'Allow-Ping'
        option src 'wan'
        option proto 'icmp'
        option icmp_type 'echo-request'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-IGMP'
        option src 'wan'
        option proto 'igmp'
        option family 'ipv4'
        option target 'ACCEPT'

config rule
        option name 'Allow-DHCPv6'
        option src 'wan'
        option proto 'udp'
        option dest_port '546'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-MLD'
        option src 'wan'
        option proto 'icmp'
        option src_ip 'fe80::/10'
        list icmp_type '130/0'
        list icmp_type '131/0'
        list icmp_type '132/0'
        list icmp_type '143/0'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Input'
        option src 'wan'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        list icmp_type 'router-solicitation'
        list icmp_type 'neighbour-solicitation'
        list icmp_type 'router-advertisement'
        list icmp_type 'neighbour-advertisement'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config rule
        option name 'Allow-ICMPv6-Forward'
        option src 'wan'
        option dest '*'
        option proto 'icmp'
        list icmp_type 'echo-request'
        list icmp_type 'echo-reply'
        list icmp_type 'destination-unreachable'
        list icmp_type 'packet-too-big'
        list icmp_type 'time-exceeded'
        list icmp_type 'bad-header'
        list icmp_type 'unknown-header-type'
        option limit '1000/sec'
        option family 'ipv6'
        option target 'ACCEPT'

config zone
        option name 'vpn'
        option input 'ACCEPT'
        option output 'ACCEPT'
        option forward 'REJECT'
        option masq '1'
        list network 'vpn'

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

config forwarding
        option src 'vpn'
        option dest 'wan'

config forwarding
        option src 'lan'
        option dest 'vpn'

config rule
        option name 'lan access'
        option family 'ipv4'
        list proto 'all'
        option src 'lan'
        option dest 'lan'
        option target 'ACCEPT'
        option enabled '0'

Remove these.. the first one is causing conflicts, the other two are unnecessary.

Remove this from your dhcp file:

Remove network eth1 from the lan zone:

Remove this as it is unnecessary:

Reboot and try again.

made the changes, rebooted and everything is still the same. can access outside wan. can ping 192.168.1.10, tracert rpi shows rpi.lan [192.168.1.10] but I still can't access http://192.168.1.10. I can't ssh to 192.168.1.10 either. systemctl status NetworkManager shows active on rpi (using monitor/keyboard) and ifconfig shows eth0 ip 192.168.1.10 with packets moving through it.

You were previously talking about 192.168.1.10, now you're talking about 192.168.1.30... I'll assume that this doesn't matter... but...

from the pi at 192.168.1.30 (or 192.168.1.10), what is the output of

netstat -plnt

You mentioned that both hosts are wired... how are these things all connected to each other... do you have a switch? Can you draw a quick network diagram (a photo of a sketch on paper is sufficient here).

you're right, 192.168.1.10.
accessing 192.168.1.10 from pc connected to the same router through eth1 (connected to switch). pc ip is 192.168.1.40.
both hosts wired.
have verified rpi is using 192.168.1.10. Yes, verified listening on port 80 by plugging into my other router without rebooting and can access http://192.168.1.10.

netstat -plnt:
0.0.0.0:80 nginx
0.0.0.0:22 sshd
127.0.0.1:8470 node
127.0.0.1:9502, 9503, 9500, 9502 docker-proxy
127.0.0.1:9050 tor
:::22/sshd: /usr/sbin
foreign addresses are 0.0.0.0:*

lol, draw a diagram. i guess I can try. this is probably faster though:
cable modem -> eth0 rpi -> openwrt -> eth1 -> usb eth adapter -> cat5 -> 5 port unmanaged switch -> rpi (192.168.1.10) & pc (192.168.1.40)

I can draw a diagram if that would help though. let me know.

The OpenWrt Pi is absolutely not involved in any of the connections here. That is guaranteed because the PC (192.168.1.40) and the other Pi (192.168.1.10) connected to the same switch and are on the same subnet. This means connections between hosts happens at L2 (switching) and will never reach the router. The router doesn't even know that these connections are happening.

If you plug in your other router, are you changing this part or does it remain the same:

my other router has 4 eth ports so I don't need the switch. plug directly to router.

so pi and pc aren't getting their ip from dhcp? the switch is handing them off?
is there a way for devices connected to the switch to pull from dhcp?

wifi is setup on rpi... I can connect to that and see if I can access rpi.
ya, pc on wlan0, tracert rpi shows the same thing -> rpi.lan [192.168.1.10].

The problem, then, can be narrowed down to the switch. I have 99.99% confidence that this is the problem.

They are getting their IP address from the OpenWrt Pi, yes... but that is all it really needs to do... you could have a DHCP server that is stand-alone (i.e. not part of a router)... it just simply assigns addresses. Once obtained, the devices are able to communicate with each other at layer 2 (you could even simply set static IP addresses if you wanted).

The simple test to prove this is as follows:

Take this:

And replace the OpenWrt router with your other one...
cable modem -> wan port on old router -> [router] -> lan port on old router -> cat5 -> 5 port unmanaged switch -> rpi (192.168.1.10) & pc (192.168.1.40)

When you do this, you will see that the problem remains since the 5 port unmanaged switch is the issue.

i'm guessing the solution is a managed switch, huh? to pass off the routes?
of course. i asked what kind of switch I should get for this config in the raspberrypi forum and was quickly told unmanaged is fine. fantastic.

i've set rpi to have 192.168.1.10 as static based on mac and gave it rpi hostname, which should resolve to rpi.lan.

I would never discourage the use of a managed switch, but no, you don't actually need one.
Your existing switch isn't working properly... or maybe it is actually a low end managed switch with a form of port isolation enabled...

  • What model is your switch?

And, for the record, it's not "passing off the routes" -- host-to-host connections on the same network are switched, which involves forwarding of packets at layer 2. It's not routed. Traffic that is going to other networks (i.e. the internet) is routed, though.

A switch will internally directly forward packets between the two machines that need to talk to each other, or between a host and the router so that you can reach the internet.

as you can probably tell I know enough to get in trouble but not enough to get out. I thought I was getting a decent switch: DLink DSG-105

what do you suggest I do?

D-Link switches are usually fine, but try another brand... Netgear, TP-Link, ZyXel, etc. Unmanaged is fine unless you might want to use VLANs in the future.

Edit: if that dlink switch is relatively new, or under warranty, get a replacement unit.

I'm just returning it. I bought it last week. Netgear 305E is about same price as 305. I guess I don't need to use managed right? Alrighty 305E on the way... amz is going to get pissed at me pretty soon with all of the returns i've had lately. finding a usb wifi 5+ adapter/extender that works with openwrt/rpi4 has been a challenge. onboard wifi works ok but I've heard maxes out at 150 Gbs, which seems to be the case.

All of this nonsense because I can't find a decently priced (under $200) high speed router that uses openwrt. but its too late now, I'm committed to making my rpi a high speed router.

I really appreciate your help. you've saved me a lot of time this weekend.

Edit: in the meantime solution, I guess I can have the pi node connect via wifi and it should route fine.

I actually recommend against the low end netgear and tp link managed switches. They are really bad. I have experienced the tp- link tl-sg1xxe series and can tell you first hand that they should be avoided. I have not used the netgear equivalent, but I’ve heard the same about those.

As for WiFi - don’t use a usb stick. You will get so much better performance by using a proper ap. There are many to choose from, and you don’t have to limit yourself to openwrt for the APs - I have unifi APs and they are great. Tp-link’s omada series is apparently also really good. And several other options are out there that are worth considering. Even an order ap will outperform the usb sticks.

Great! Glad I could help.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Thanks! :slight_smile:

is the netgear GS305E low end? i think it's normally $35. should I look for higher model numbers? 405, 505, etc?

I don't know much about APs. I was hoping to stay simple but with each new challenge I'm forced to get some other piece of hardware. I'll check out the unifi APs.