ip rule show
0: from all lookup local
30998: from all oif route0 lookup 3
30999: from 111.6.3.52 lookup 3
31000: from all iif sd0.2 lookup 3 (3 is the name of table)
32766: from all lookup main
32767: from all lookup default
Add routing rule to different table
Explain:
ip routing rule is all network domain from 192.168.0.0/24 will go to sd0.2 this interface.ip route add default via 10.8.0.1 table 1
ip route add 192.168.0.0/24 dev sd0.2 table 1
ip route add 10.8.0.0/24 dev tun21 table 1
Add routing rule to ip rule
Explain:
All output packet to tun21 will apply routing rule 1, the priority is 31001All input packet to sd0.2 will apply routing rule 1, the priority is 31002
ip rule add oif tun21 lookup 1 priority 31001
ip rule add iif sd0.2 lookup 1 priority 31002
ip rule add from 192.168.1.20 lookup 1 priority 31002
Add routing rule to ip route
Explain:ip routing rule is all network domain from 192.168.1.0/24 will go to 10.8.0.6 this IP address.
# ip route add 192.168.1.0/24 via 10.8.0.6
# ip route show
default via 111.6.1.254 dev wan0
192.168.1.0/24 via 10.8.0.6 dev tun0
192.168.100.0/24 dev lan0 proto kernel scope link src 192.168.100.1
0 意見:
張貼留言