route

The syntax of the route command is
route [-CFvnee]
route [-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw]
[metric N] [mod] [reinstate] [[dev ] If]
route [-v] [-A family] del [-net|-host] target [gw Gw] [netmask Nm] [metric
N] [[dev] If]
route [-V] [--version] [-h] [--help]
The common parameters of route are explained as follows
-v Use redundant output mode
-A family Specify a specific address family such as "inet" "inet6"
-n Use numerically displayed addresses such as 202.38.75.75 instead of to interpret the domain name
-e use the same output format as netstat
-ee parameter produces a long output including almost all information from the kernel routing table
-net target target is a network segment
-host target target is a single host
-F show kernel FIB routing table results may be changed by -e and -ee parameters
-C Display routing cache information in the kernel
del Delete a routing table entry
add Add a routing table entry
Target Configured destination network segment or host can be IP or network or host name
netmask Nm indicates the netmask of the routing table entry to be added
gw Gw Any IP packet to the destination target must pass through this gateway
metric M Set the metric field of the entry in the routing table Add a routing table entry for M
Example
1 The network segment 192.168.0.x should be from the interface "eth0" Go
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth0
2 Add a default route
route add 0.0.0.0 gw gateway address
If there is no other matching route entry, use this routing rule
3 Delete the default route
route del 0.0.0.0 gw gateway address
4 route command output example shows
the output format has the following columns
Destination destination network segment or host
Gateway gateway address If not set, it will be "*" means
Genmask Netmask
Flags Some possible flags are as follows
U Route is active The
H target is a host
G using the gateway gateway
R reinstate route table entry generated by dynamic routing
D dynamically installed by daemon or redirect
M modified from routing daemon or redirect
! reject route
Metric routing distance
Ref Routing item reference times The number of times the linux kernel does not use
Use to find routing items.
Iface The output interface corresponding to this routing table item

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327039725&siteId=291194637