New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FS#2841 - Static routes don't work #7656
Comments
por: gateway 0.0.0.0, where would that go to ? |
xnoreq: @paul Oranje: see the documentation for [[https://openwrt.org/docs/guide-user/network/routes_configuration|Static Routes]] |
por: Okay, but it's not really obvious what you're trying to achieve. If one of the interfaces has an address in the target subnet the net route will automatically be created, otherwise (no direct output on target subnet) a route with a gateway is needed to get packets on their way towards the target. Good luck. |
xnoreq: I want to route packets to the target network (192.168.2.0/24) through the lan interface instead of using the default route (via wan) because the network is directly connected to lan. The onlink is indeed not needed, but removing it doesn't change anything - it still won't create the route. Effectively, I would expect the same result as if running this command: |
jow-: This is not a bug since your configuration is wrong to begin with. The following block: config route ... is equivalent to the following iproute2 command: ip route add 192.168.2.0/24 dev br-lan proto static src 192.168.1.1 onlink ... which is rejected by the kernel with netlink error NLE_INVAL (Invalid argument). The problem is ''onlink'' (''option onlink '1''') and ''src 192.168.1.1'' (''option source '192.168.1.1''') which are rejected by the kernel: root@jj: To achieve what you want, the configuration should be:
... so basically leave out source and onlink. I tested and confirmed that working on my system. |
xnoreq: This works on my system: In your system, your br-lan probably doesn't have the src assigned as ip address, which is why you cannot use it as src. Check with: Does your br-lan have 192.168.1.1 assigned? If not then change it in the commands above to what you have configured in your setup. I see no reason why I shouldn't be allowed to specify a src address through openwrt's configuration. So this is a bug. Please reopen. |
jow-: Correct, my "br-lan" has 10.11.12.13/24 as source IP. Changing this accordingly in the config works for me: root@jj: |
xnoreq: Can you please try through /etc/config/network
uci show network.@route[-1]uci: Entry not found |
jow-: I already tried (but with 10.11.12.13 as source IP since my lan doesn't use 192.168.1.0/24).
That might hint at a syntax error in your network config somewhere before the route declaration. Check the output of |
xnoreq: No error messages. The "config route" block above wasn't even added by hand but through luci. |
jow-: Double checked in an x86/64 19.07.1 VM:
BusyBox v1.30.1 () built-in shell (ash)
|
jow-: Another test with the malta target to rule out 64bit/32bit or big/little endian issues:
BusyBox v1.30.1 () built-in shell (ash)
|
xnoreq:
|
jow-: Anything reported by |
xnoreq: Yes, indeed: ... which is very weird, because
Anyway, it seems to have been these pending changes that lead to the unexpected behavior. |
xnoreq: doesn't work through /etc/config/network |
xnoreq:
Device/versions: ath79, openwrt master, commit 5715b21
Steps to reproduce:
adding a static ipv4 route in luci
or adding a route to /etc/config/network like this:
config route
option netmask '255.255.255.0'
option interface 'lan'
option target '192.168.2.0'
option gateway '0.0.0.0'
option source '192.168.1.1'
option onlink '1'
running:
ip route
Expected result:
192.168.2.0/24 dev ...
But I only see the standard routes.
The text was updated successfully, but these errors were encountered: