Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-user:network:routes_configuration [2021/08/10 16:50] – add links vgaeteradocs:guide-user:network:routing:routes_configuration [2024/11/14 17:48] (current) – [Table] systemcrash
Line 1: Line 1:
 ====== Static routes ====== ====== Static routes ======
-See also: 
-[[docs:guide-user:network:routing|Routing]], 
-[[docs:guide-user:network:ip_rules|Routing rules]], 
-[[docs:guide-user:network:pbr|PBR with netifd]] 
- 
 Netifd supports static //IP route// declarations which are required to implement basic routing. Netifd supports static //IP route// declarations which are required to implement basic routing.
  
Line 45: Line 40:
  
 ==== Options for IPv4 routes ==== ==== Options for IPv4 routes ====
-^ Name ^ Type ^ Required ^ Default ^ Description ^ +^ Name           ^ Type              ^ Required  ^ Default            ^ Description                                                                                                                                                                                                                                                      
-| ''interface'' | string | yes | //(none)// | Specifies the //logical interface name// of the parent (or master) interface this route belongs to; must refer to one of the defined ''interface'' sections | +| ''interface''  | string            | yes       | //(none)//         | Specifies the //logical interface name// of the parent (or master) interface this route belongs to; must refer to one of the defined ''interface'' sections                                                                                                      
-| ''target'' | ip address | yes | //(none)// | Network address | +| ''target''     | ip address        | yes       | //(none)//         | Network address                                                                                                                                                                                                                                                  
-| ''netmask'' | netmask | no | //(none)// | Route netmask. If omitted, ''255.255.255.255'' is assumed which makes ''target'' a //host address// | +| ''netmask''    | netmask           | no        | //(none)//         | Route netmask. If omitted, ''255.255.255.255'' is assumed which makes ''target'' a //host address//                                                                                                                                                              
-| ''gateway'' | ip address | no | //(none)// | Network gateway. If omitted, the ''gateway'' from the parent interface is taken if any, otherwise creates a ''link'' scope route; if set to ''0.0.0.0'' no gateway will be specified for the route | +| ''gateway''    | ip address        | no        | //(none)//         | Network gateway. If omitted, the ''gateway'' from the parent interface is taken if any, otherwise creates a ''link'' scope route; if set to ''0.0.0.0'' no gateway will be specified for the route                                                               
-| ''metric'' | number | no | ''0'' | Specifies the //route metric// to use | +| ''metric''     | number            | no        | ''0''              | Specifies the //route metric// to use                                                                                                                                                                                                                            
-| ''mtu'' | number | no | //interface MTU// | Defines a specific MTU for this route | +| ''mtu''        | number            | no        | //interface MTU//  | Defines a specific MTU for this route                                                                                                                                                                                                                            
-| ''table'' | routing table | no | ''main'' | Defines the table ID to use for the route. The ID can be either a numeric table index ranging from 0 to 65535 or a symbolic alias declared in ''/etc/iproute2/rt_tables''. The special aliases local (255), main (254) and default (253) are recognized as well | +| ''table''      | routing table     | no        | ''main''           | Defines the table ID to use for the route. The ID can be either a numeric table index ranging from 0 to 65535 or a symbolic alias declared in ''/etc/iproute2/rt_tables''. The special aliases local (255), main (254) and default (253) are recognized as well  
-| ''source'' | ip address | no | //(none)// | The preferred source address when sending to destinations covered by the target | +| ''source''     | ip address        | no        | //(none)//         | The preferred source address when sending to destinations covered by the target                                                                                                                                                                                  
-| ''onlink'' | boolean | no | ''0'' | When enabled gateway is on link even if the gateway does not match any interface prefix | +| ''onlink''     | boolean           | no        | ''0''              | When enabled gateway is on link even if the gateway does not match any interface prefix                                                                                                                                                                          
-| ''type'' | string | no | ''unicast'' | One of the types outlined in the routing types table below | +| ''type''       | string            | no        | ''unicast''        | One of the types outlined in the routing types table below                                                                                                                                                                                                       
-| ''proto'' | routing protocol | no | ''static'' | Defines the protocol ID to use for the route. The ID can be either a numeric value ranging from 0 to 255 or a symbolic alias declared in ''/etc/iproute2/rt_protos''.| +| ''proto''      | routing protocol  | no        | ''static''         | Defines the protocol ID for the route. The ID can be either a numeric value ranging from 0 to 255 or a symbolic alias declared in ''/etc/iproute2/rt_protos''i.e. ''kernel'', ''boot'', ''ra'', ''redirect'', ''static''                                       
-| ''disabled'' | boolean | no | ''0'' | Specifies if the static route should be set or not, available since OpenWrt >= 21.02. | +| ''disabled''   | boolean           | no        | ''0''              | Specifies if the static route should be set or not, available since OpenWrt >= 21.02.                                                                                                                                                                            |
- +
-You can disable the route by renaming its config section from ''route'' to ''_route'' and it will be ignored by netifd, only needed for OpenWrt < 21.02: +
- +
-<code bash> +
-config _route 'route_name' +
-</code>+
  
 ===== IPv6 routes ===== ===== IPv6 routes =====
Line 82: Line 71:
  
 ==== Options for IPv6 routes ==== ==== Options for IPv6 routes ====
-^ Name ^ Type ^ Required ^ Default ^ Description ^ +^ Name           ^ Type              ^ Required  ^ Default            ^ Description                                                                                                                                                                                                                                                  
-| ''interface'' | string | yes | //(none)// | Specifies the //logical interface name// of the parent (or master) interface this route belongs to; must refer to one of the defined ''interface'' sections | +| ''interface''  | string            | yes       | //(none)//         | Specifies the //logical interface name// of the parent (or master) interface this route belongs to; must refer to one of the defined ''interface'' sections                                                                                                  
-| ''target'' | ipv6 address | yes | //(none)// | IPv6 network address | +| ''target''     | ipv6 address      | yes       | //(none)//         | IPv6 network address                                                                                                                                                                                                                                         
-| ''gateway'' | ipv6 address | no | //(none)// | IPv6 gateway. If omitted, the ''gateway'' from the parent interface is taken | +| ''gateway''    | ipv6 address      | no        | //(none)//         | IPv6 gateway. If omitted, the ''gateway'' from the parent interface is taken                                                                                                                                                                                 
-| ''metric'' | number | no | ''0'' | Specifies the //route metric// to use | +| ''metric''     | number            | no        | ''0''              | Specifies the //route metric// to use                                                                                                                                                                                                                        
-| ''mtu'' | number | no | //interface MTU// | Defines a specific MTU for this route | +| ''mtu''        | number            | no        | //interface MTU//  | Defines a specific MTU for this route                                                                                                                                                                                                                        
-| ''table'' | routing table | no | ''main'' | Defines the table ID to use for the route. The ID can be either a numeric table index ranging from 0 to 65535 or a symbolic alias declared in /etc/iproute2/rt_tables. The special aliases local (255), main (254) and default (253) are recognized as well | +| ''table''      | routing table     | no        | ''main''           | Defines the table ID to use for the route. The ID can be either a numeric table index ranging from 0 to 65535 or a symbolic alias declared in /etc/iproute2/rt_tables. The special aliases local (255), main (254) and default (253) are recognized as well  
-| ''source'' | ip address | no | //(none)// | The route source address in source-address dependent routes. It's called "from" in the ip command.  +| ''source''     | ip address        | no        | //(none)//         | The route source address in source-address dependent routes. It's called "from" in the ip command.                                                                                                                                                           
-| ''onlink'' | boolean | no | ''0'' | When enabled gateway is on link even if the gateway does not match any interface prefix | +| ''onlink''     | boolean           | no        | ''0''              | When enabled gateway is on link even if the gateway does not match any interface prefix                                                                                                                                                                      
-| ''type'' | string | no | ''unicast'' | One of the types outlined in the Routing Types table below | +| ''type''       | string            | no        | ''unicast''        | One of the types outlined in the Routing Types table below                                                                                                                                                                                                   
-| ''proto'' | routing protocol | no | ''static'' | Defines the protocol ID to use for the route. The ID can be either a numeric value ranging from 0 to 255 or a symbolic alias declared in /etc/iproute2/rt_protos.| +| ''proto''      | routing protocol  | no        | ''static''         | Defines the protocol ID for the route. The ID can be either a numeric value ranging from 0 to 255 or a symbolic alias declared in ''/etc/iproute2/rt_protos''i.e. ''kernel'', ''boot'', ''ra'', ''redirect'', ''static''                                   
-| ''disabled'' | boolean | no | ''0'' | Specifies if the static route should be set or not, available since OpenWrt >= 21.02. |+| ''disabled''   | boolean           | no        | ''0''              | Specifies if the static route should be set or not, available since OpenWrt >= 21.02.                                                                                                                                                                        |
  
 === Routing types === === Routing types ===
  • Last modified: 2024/11/14 17:48
  • by systemcrash