sroute
显示/添加/删除/更改源路由表。
格式
sroute [add | del | chg] [start src] [end src] [start dest] [end dest] [INC/EXC] [HIGH/DEF] dev [dev]
说明
[root@sylixos:/root]# help sroute
show, add, delete, change source route table
eg. sroute
sroute add 192.168.1.1 192.168.1.10 123.0.0.1 126.0.0.1 INC DEF dev en1
add source ip from 192.168.1.1 ~ 192.168.1.10 dest 123.0.0.1 ~ 126.0.0.1 route to en1 as default priority.
sroute chg 192.168.1.1 192.168.1.10 123.0.0.1 126.0.0.1 EXC HIGH dev en2
change source ip from 192.168.1.1 ~ 192.168.1.10 route to en2 as high priority.
sroute del 192.168.1.1 192.168.1.10 123.0.0.1 126.0.0.1
delete source ip from 192.168.1.1 ~ 192.168.1.10 dest 123.0.0.1 ~ 126.0.0.1 route
sroute [add | del | chg] [start src] [end src] [start dest] [end dest] [INC/EXC] [HIGH/DEF] dev [dev]
[root@sylixos:/root]#
此命令有 2 种用法:
- 不加参数用于显示源路由表。
- 后接参数用于添加/删除/更改源路由表。
样例
[root@sylixos:/root]# sroute
IPv4 Source route Table:
Source(s) Source(e) Flags Destination(s) Destination(e) Mode Prio Iface
IPv6 Source route Table:
Source(s) Source(e) Flags Destination(s) Destination(e) Mode Prio Iface
[root@sylixos:/root]# sroute add 192.168.1.10 123.0.0.1 126.0.0.1 INC DEF dev en1
[root@sylixos:/root]# sroute
IPv4 Source route Table:
Source(s) Source(e) Flags Destination(s) Destination(e) Mode Prio Iface
192.168.1.1 192.168.1.10 U 123.0.0.1 126.0.0.1 INC DEF en1
IPv6 Source route Table:
Source(s) Source(e) Flags Destination(s) Destination(e) Mode Prio Iface
[root@sylixos:/root]# sroute del 192.168.1.1 192.168.1.10 123.0.0.1 126.0.0.1
[root@sylixos:/root]# sroute
IPv4 Source route Table:
Source(s) Source(e) Flags Destination(s) Destination(e) Mode Prio Iface
IPv6 Source route Table:
Source(s) Source(e) Flags Destination(s) Destination(e) Mode Prio Iface
字段说明:
字段 | 说明 |
---|---|
IPv4 Source route Table | |
Source(s) | 源地址起始 IP |
Source(e) | 源地址结束 IP |
Flags | 路由标志,U-路由有效,H-目标是个主机,G-需要使用网关,D-路由是由重定向报文创建的 |
Destination(s) | 目标地址起始 IP |
Destination(e) | 目标地址结束 IP |
Mode | 路由模式(EXC / INC) |
Prio | 路由优先级(HIGH / DEF) |
Iface | 网络接口名 |
IPv6 Source route Table: | |
Source(s) | 源地址起始 IP |
Source(e) | 源地址结束 IP |
Flags | 路由标志,U-路由有效,H-目标是个主机,G-需要使用网关,D-路由是由重定向报文创建的 |
Destination(s) | 目标地址起始 IP |
Destination(e) | 目标地址结束 IP |
Mode | 路由模式(EXC / INC) |
Prio | 路由优先级(HIGH / DEF) |
Iface | 网络接口名 |