List-all-ip-route-tables列出所有路由表:修订间差异

来自三线的随记
(创建页面,内容为“= 技巧-- list all ip route tables in linux kernel = === Related knowledge points === 可以在 /etc/iproute2/rt_tables 文件定义路由表(ip routing table)id…”)
 
无编辑摘要
 
第1行: 第1行:
= 技巧-- list all ip route tables in linux kernel =
=技巧-- list all ip route tables in linux kernel=


=== Related knowledge points ===
===Related knowledge points===
可以在 /etc/iproute2/rt_tables 文件定义路由表(ip routing table)id以及它的别名
可以在 /etc/iproute2/rt_tables 文件定义路由表(ip routing table)id以及它的别名
  Route tables: Linux-2.x can pack routes into several routing tables identified by a number in the range from 1 to 2^32-1 or by name from the file /etc/iproute2/rt_tables  
  Route tables: Linux-2.x can pack routes into several routing tables identified by a number in the range from 1 to 2^32-1 or by name from the file /etc/iproute2/rt_tables  
第8行: 第8行:
<br />
<br />


=== Command to list all ip route tables in linux kernel ===
===Command to list all ip route tables in linux kernel===
ip route show table all
 
  ip route show table all | grep "table" | sed 's/.*\(table.*\)/\1/g' | awk '{print $2}' | sort | uniq
  ip route show table all | grep "table" | sed 's/.*\(table.*\)/\1/g' | awk '{print $2}' | sort | uniq



2020年12月13日 (日) 02:32的最新版本

技巧-- list all ip route tables in linux kernel

Related knowledge points

可以在 /etc/iproute2/rt_tables 文件定义路由表(ip routing table)id以及它的别名

Route tables: Linux-2.x can pack routes into several routing tables identified by a number in the range from 1 to 2^32-1 or by name from the file /etc/iproute2/rt_tables 
By default all normal routes are inserted into the main table (ID 254) and the kernel only uses this table when calculating routes.
Values (0, 253, 254, and 255) are reserved for built-in use.


Command to list all ip route tables in linux kernel

ip route show table all
ip route show table all | grep "table" | sed 's/.*\(table.*\)/\1/g' | awk '{print $2}' | sort | uniq
ip route show table all | grep -Po 'table \K[^\s]+' | sort -u