This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
howto:general:routing:static_routing [2015/05/19 11:23] admin [Use-case] |
howto:general:routing:static_routing [2018/05/24 09:05] (current) |
||
---|---|---|---|
Line 10: | Line 10: | ||
==== Use-case ==== | ==== Use-case ==== | ||
- | All requests to dd-wrt.com should be routed throug a given gateway. | + | Static routes can be used to route connections to a specific host or address trough a specific interface, |
+ | which may be a VPN-Connection. | ||
+ | |||
+ | All requests to dd-wrt.com should be routed through a given gateway. | ||
^ Static-Route properties ^^ | ^ Static-Route properties ^^ | ||
| interface | wan | | | interface | wan | | ||
- | | target | 83.141.4.21 | | + | | target | 83.141.4.210 (dd-wrt.com)| |
| netmask | 255.255.255.255 | | | netmask | 255.255.255.255 | | ||
| gateway | 172.27.0.1 | | | gateway | 172.27.0.1 | | ||
Line 32: | Line 35: | ||
==== UCI Config System ==== | ==== UCI Config System ==== | ||
- | * **Add something** | + | * **Add static route section** |
<code> | <code> | ||
- | uci add network rule | + | uci add network route |
- | uci set network.@rule[-1].interface=wan | + | uci set network.@route[-1].interface=wan |
- | uci set network.@rule[-1].target=84.141.4.210 | + | uci set network.@route[-1].target=84.141.4.210 |
- | uci set network.@rule[-1].netmask=255.255.255.255 | + | uci set network.@route[-1].netmask=255.255.255.255 |
- | uci set network.@rule[-1].gateway=172.27.0.1 | + | uci set network.@route[-1].gateway=172.27.0.1 |
</code> | </code> | ||
Line 48: | Line 51: | ||
* **Apply changes** | * **Apply changes** | ||
<code> | <code> | ||
- | /etc/init.d/network restart | + | /etc/init.d/network reload |
</code> | </code> | ||
Line 58: | Line 61: | ||
<code> | <code> | ||
config 'route' | config 'route' | ||
- | option 'interface' 'wan' | + | option interface 'wan' |
- | option 'target' '83.141.4.210' | + | option target '83.141.4.210' |
- | option 'netmask' '255.255.255.255' | + | option netmask '255.255.255.255' |
- | option 'gateway' '172.27.0.1' | + | option gateway '172.27.0.1' |
</code> | </code> | ||
+ | * **Restart service** | ||
+ | <code> | ||
+ | /etc/init.d/network reload | ||
+ | </code> | ||
===== Troubleshooting ===== | ===== Troubleshooting ===== | ||
- | Not available, yet | + | You can check if the route has been applied successful by looking at the routing table with the **route** command |
+ | <code> | ||
+ | # route | ||
+ | Kernel IP routing table | ||
+ | Destination Gateway Genmask Flags Metric Ref Use Iface | ||
+ | default 172.27.0.1 0.0.0.0 UG 0 0 0 eth1 | ||
+ | 84.141.4.210 172.27.0.1 255.255.255.255 UGH 0 0 0 eth1 | ||
+ | 172.27.0.0 * 255.255.255.0 U 0 0 0 eth1 | ||
+ | 192.168.1.0 * 255.255.255.0 U 0 0 0 br-lan | ||
+ | </code> | ||
+ | The field 'Destination' should match the target from the UCI configuration, | ||
+ | Gateway matches Gateway, and the Iface should match the actual interface name. | ||