OpenWrt Forum Archive

Topic: OpenWrt how to add persistent static route

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

Network topology is as follows:

http://firewallengineer.files.wordpress.com/2013/09/openwrt-network-diagram1.png

I’ve added the following route to OpenWrt1 but it doesn’t work after I rebooted the host. Please advise.

NEW ROUTE

config route
        option interface lan
        option target 172.16.0.3
        option gateway 10.0.0.2

VERIFY ROUTE

root@OpenWrt1:~# cat /etc/config/network
# Copyright (C) 2006 OpenWrt.org

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 type     bridge
        option proto    static
        option ipaddr   192.168.10.11
        option netmask  255.255.255.0

config interface lan2
        option ifname   eth1
#       option type     bridge
        option proto    static
        option ipaddr   10.0.0.1
        option netmask  255.255.255.0

config route
        option interface lan
        option target 172.16.0.3
        option gateway 10.0.0.2

root@OpenWrt1:~#

ROUTE AFTER REBOOT

root@OpenWrt1:~# ip route
10.0.0.0/24 dev eth1  proto kernel  scope link  src 10.0.0.1
192.168.10.0/24 dev eth0  proto kernel  scope link  src 192.168.10.11
root@OpenWrt1:~#

(Last edited by FirewallEngineer on 8 Sep 2013, 15:32)

I guess:

config route
        option interface lan2
        option target 172.16.0.0/24
        option gateway 10.0.0.2

The discussion might have continued from here.