实践网络命令之route Posted on 2021-05-12 | In 网络 | Visitors 12345678910111213141516171819$ route -h Usage: route [-nNvee] [-FC] [<AF>] List kernel routing tables route [-v] [-FC] {add|del|flush} ... Modify routing table for AF. route {-h|--help} [<AF>] Detailed usage syntax for specified AF. route {-V|--version} Display version/author and exit. -v, --verbose be verbose -n, --numeric don't resolve names -e, --extend display other/more information -F, --fib display Forwarding Information Base (default) -C, --cache display routing cache instead of FIB <AF>=Use -4, -6, '-A <af>' or '--<af>'; default: inet List of possible address families (which support routing): inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) x25 (CCITT X.25) 1234567$ route add Usage: inet_route [-vF] del {-host|-net} Target[/prefix] [gw Gw] [metric M] [[dev] If] inet_route [-vF] add {-host|-net} Target[/prefix] [gw Gw] [metric M] [netmask N] [mss Mss] [window W] [irtt I] [mod] [dyn] [reinstate] [[dev] If] inet_route [-vF] add {-host|-net} Target[/prefix] [metric M] reject inet_route [-FC] flush NOT supported 12345678# route add default gw 140.207.91.161 # route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.1.1 # route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 # route add -net 192.168.168.0 netmask 255.255.255.0 gw 192.168.1.1 # route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.1.10 # route add -net 192.168.168.0 netmask 255.255.255.0 eth0 # route add -net 192.168.1.0/24 eth1