admin@jr1# set route 10.0.0.4/32 ?
//此处标识路由前缀
Possible completions:
active Remove inactive route from forwarding table
+ apply-groups Groups from which to inherit configuration data
+ apply-groups-except Don't inherit configuration data from these groups
> as-path Autonomous system path
backup-pe-group Multicast source redundancy group
> bfd-liveness-detection Bidirectional Forwarding Detection (BFD) options
> color Color (preference) value
> color2 Color (preference) value 2
+ community BGP community identifier
discard Drop packets to destination; send no ICMP unreachables
install Install route into forwarding table
> lsp-next-hop LSP next hop
> metric Metric value
> metric2 Metric value 2
> metric3 Metric value 3
> metric4 Metric value 4
+ next-hop Next hop to destination
next-table Next hop to another table
no-install Don't install route into forwarding table
no-readvertise Don't mark route as eligible to be readvertised
no-resolve Don't allow resolution of indirectly connected next hops
no-retain Don't always keep route in forwarding table
> p2mp-lsp-next-hop Point-to-multipoint LSP next hop
passive Retain inactive route in forwarding table
> preference Preference value
> preference2 Preference value 2
> qualified-next-hop Next hop with qualifiers
readvertise Mark route as eligible to be readvertised
receive Install a receive route for the destination
reject Drop packets to destination; send ICMP unreachables
resolve Allow resolution of indirectly connected next hops
retain Always keep route in forwarding table
> static-lsp-next-hop Static LSP next hop
> tag Tag string
> tag2 Tag string 2
[edit routing-options static]
admin@jr1#
各种属性解释:
active Remove inactive route from forwarding table
passive Retain inactive route in forwarding table
active 表示如果下一跳可达就下发该路由表,下一跳不可达就不下发,静态路由的缺省选项。passive表示即使下一跳不可达也装入路由表,此时装入路由表的是reject状态的路由。
admin@jr1# show
route 10.0.0.4/32 {
next-hop 1.2.3.4;
passive;
}
[edit routing-options static]
admin@jr1# run show route
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.0.0.1/32 *[Direct/0] 4d 23:31:58
> via lo0.0
10.0.0.4/32 *[Static/5] 00:03:41
Reject
10.123.0.0/24 *[Direct/0] 4d 23:31:58
> via ge-1/3/0.100
10.123.0.1/32 *[Local/0] 4d 23:31:58
Local via ge-1/3/0.100
192.168.0.0/24 *[Direct/0] 4d 22:26:20
> via fxp0.0
192.168.0.1/32 *[Local/0] 4d 22:26:20
Local via fxp0.0
[edit routing-options static]
admin@jr1# run show pfe route ip
IPv4 Route Table 0, default.0, 0x0:
Destination NH IP Addr Type NH ID Interface
------------ --------------- -------- ----- ---------
default Reject 36 RT-ifl 0
0.0.0.0 Discard 34 RT-ifl 0
10.0.0.1 10.0.0.1 Local 538 RT-ifl 0
10.0.0.4 Reject 36 RT-ifl 0
10.123.0/24 Resolve 537 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.0 10.123.0.0 Recv 535 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.1 10.123.0.1 Local 536 RT-ifl 0
10.123.0.2 10.123.0.2 Unicast 540 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.3 10.123.0.3 Unicast 539 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.255 Bcast 534 RT-ifl 67 ge-1/3/0.100 ifl 67
192.168.0/24 Resolve 343 RT-ifl 4 fxp0.0 ifl 4
192.168.0.1 192.168.0.1 Local 342 RT-ifl 0
224/4 mdiscard 35 RT-ifl 0
224.0.0.1 Mcast 31 RT-ifl 0
255.255.255.255 Bcast 32 RT-ifl 0
as-path Autonomous system path
community BGP community identifier
tag Tag string
tag2 Tag string 2
给静态路由加上述额外的属性,引入到其他动态路由协议的时候携带
bfd-liveness-detection Bidirectional Forwarding Detection (BFD) options
//配置对下一跳的BFD检测(好像不能配成ECHO模式,需要对端也配置)
color Color (preference) value
color2 Color (preference) value 2
//配置color标记,但目前不知何用
discard Drop packets to destination; send no ICMP unreachables
reject Drop packets to destination; send ICMP unreachables
//配置该路由条目的动作为丢包,discard是直接丢弃,reject是丢弃后回复icmp不可达报文
install Install route into forwarding table
no-install Don't install route into forwarding table
//配置是否将路由下发到pfe表,install为缺省属性下发,no-install为路由只加入到路由表而不下发到PFE表(相当于路由不生效,无法指导转发)
admin@jr1# show
route 10.0.0.4/32 {
next-hop 10.123.0.2;
no-install;
}
[edit routing-options static]
admin@jr1# run show route
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.0.0.1/32 *[Direct/0] 6d 23:09:23
> via lo0.0
10.0.0.4/32 *[Static/5] 00:01:03
> to 10.123.0.2 via ge-1/3/0.100
10.123.0.0/24 *[Direct/0] 6d 23:09:23
> via ge-1/3/0.100
10.123.0.1/32 *[Local/0] 6d 23:09:23
Local via ge-1/3/0.100
192.168.0.0/24 *[Direct/0] 6d 22:03:45
> via fxp0.0
192.168.0.1/32 *[Local/0] 6d 22:03:45
Local via fxp0.0
[edit routing-options static]
admin@jr1# run show pfe route ip table index 0
IPv4 Route Table 0, default.0, 0x0:
Destination NH IP Addr Type NH ID Interface
------------ --------------- -------- ----- ---------
default Reject 36 RT-ifl 0
0.0.0.0 Discard 34 RT-ifl 0
10.0.0.1 10.0.0.1 Local 538 RT-ifl 0
10.123.0/24 Resolve 537 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.0 10.123.0.0 Recv 535 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.1 10.123.0.1 Local 536 RT-ifl 0
10.123.0.2 10.123.0.2 Unicast 540 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.3 10.123.0.3 Unicast 539 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.255 Bcast 534 RT-ifl 67 ge-1/3/0.100 ifl 67
192.168.0/24 Resolve 343 RT-ifl 4 fxp0.0 ifl 4
192.168.0.1 192.168.0.1 Local 342 RT-ifl 0
224/4 mdiscard 35 RT-ifl 0
224.0.0.1 Mcast 31 RT-ifl 0
255.255.255.255 Bcast 32 RT-ifl 0
[edit routing-options static]
admin@jr1#
resolve Allow resolution of indirectly connected next hops
no-resolve Don't allow resolution of indirectly connected next hops
//当指定的路由下一跳不是直连的时候JUNOS缺省不会做递归解析,需要配置resolve进行递归解析。no-resolve为缺省属性。
preference Preference value
preference2 Preference value 2
metric Metric value
metric2 Metric value 2
metric3 Metric value 3
metric4 Metric value 4
//指定路由的优先级和度量,静态路由的缺省优先级是5,度量是0
active Remove inactive route from forwarding table
passive Retain inactive route in forwarding table
//active如果路由的下一跳不可达(MA网络的话直连都认为可达)路由不会装入路由表,passive则路由的下一跳无论是否可达都装入路由表。
admin@jr1# show
route 10.0.0.4/32 {
next-hop 1.2.3.4;
passive;
}
[edit routing-options static]
admin@jr1# run show route
inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
10.0.0.1/32 *[Direct/0] 6d 23:13:18
> via lo0.0
10.0.0.4/32 *[Static/5] 00:04:58
Reject
10.123.0.0/24 *[Direct/0] 6d 23:13:18
> via ge-1/3/0.100
10.123.0.1/32 *[Local/0] 6d 23:13:18
Local via ge-1/3/0.100
192.168.0.0/24 *[Direct/0] 6d 22:07:40
> via fxp0.0
192.168.0.1/32 *[Local/0] 6d 22:07:40
Local via fxp0.0
[edit routing-options static]
admin@jr1#
readvertise Mark route as eligible to be readvertised
no-readvertise Don't mark route as eligible to be readvertised
//指示该路由是否能够被发布到其他路由协议中去
routing-options {
static {
route 10.0.0.4/32 {
next-hop 10.123.0.2;
no-readvertise;
}
}
autonomous-system 100;
}
protocols {
ospf {
export import-static;
area 0.0.0.0 {
interface ge-1/3/0.100;
}
}
}
policy-options {
policy-statement import-static {
from protocol static;
then accept;
}
}
[edit]
admin@jr1# run show ospf database
OSPF database, Area 0.0.0.0
Type ID Adv Rtr Seq Age Opt Cksum Len
Router *10.0.0.1 10.0.0.1 0x80000007 20 0x22 0x7591 36
Router 10.0.0.2 10.0.0.2 0x80000003 282 0x22 0x7594 36
Network 10.123.0.2 10.0.0.2 0x80000002 282 0x22 0xade0 32
[edit]
admin@jr1#
retain Always keep route in forwarding table
no-retain Don't always keep route in forwarding table
//指示当路由进程关闭后该路由是否从PFE表中删除,no-retain是缺省属性即删除,retain表示不删除。
未测试处该效果
receive Install a receive route for the destination
//此选项尚不明作用
next-table Next hop to another table
//此选项尚不明作用
+ next-hop Next hop to destination
//路由的下一跳属性,可以在同一行中指示多个下一跳,负载均衡。但next-hop语句只能有1条。
qualified-next-hop Next hop with qualifiers
//同next-hop语句,但可以配置多条,各条之间配置不同的preference或metic来进行备份
routing-options {
static {
route 10.0.0.4/32 {
qualified-next-hop 10.123.0.2 {
preference 5;
}
qualified-next-hop 10.123.0.3 {
preference 10;
}
}
}
autonomous-system 100;
}