这是路由表的示例
root @ svarun:〜#netstat -rn
路由表
Internet: Destination Gateway Flags Netif Expire default 10.0.0.2 UGS tun0 10.0.0.1 link#5 UHS lo0 10.0.0.2 link#5 UHS tun0 127.0.0.1 link#4 UH lo0 192.168.127.0/24 link#2 U rl0 192.168.127.1 link#2 UHS lo0 193.77.156.167 link#5 UHS lo0 213.250.19.90 link#5 UHS tun0
要在表中添加和删除值,请使用以下命令
route add IP/MASK NEXTHOP Add a new path to the network, where IP … network address; MASK … network mask; NEXTHOP … IP-address to where the package should be redirected
route delete IP/MASK Delete the existing path to the specified network, where IP … network address; MASK … network mask;
nexthop IP Outputs where to target the package if we give it a destination IP address.
为使路由在O(m)中进行,其中m是IP地址的长度,我们使用Trie数据结构。
问题:描述如何使用Trie将条目存储在路由表中,并描述route add命令在Trie中的作用。