The route command Network Configuration Route command is used to display and set the network routing table in the Linux kernel, and the route command sets the routing primarily to static routes. To achieve communication between two different subnets, you need a router that is connected to two networks, or a gateway to two networks.
Grammar
Route (options) (parameters)
Options
-A: Set the address type;
-C: Print the route cache of the Linux kernel;
- V: detailed information mode;
-N: Do not perform DNS reverse lookup, directly display the digital form of IP address;
-e:netstat format displays the routing table;
-net: The routing table to a network;
-host: The routing table to a host.
Parameters
add: Adds the specified route record;
Del: Deletes the specified route record;
Target: Destination network or destination host;
GW: Set default gateway;
MSS: Set the maximum block length of TCP (MSS), in megabytes;
window: Specifies the TCP window size of the TCP connection through the routing table;
Dev: The network interface represented by the route record.
To add a gateway/Setup gateway:
Route add-net 224.0.0.0 netmask 240.0.0.0 dev eth0//Add a route to 244.0.0.0.
To block a route:
Route add-net 224.0.0.0 netmask 240.0.0.0 reject//Add a shielded route, the destination address is 224.x.x.x will be rejected.
To delete a route record:
Route del-net 224.0.0.0 netmask 240.0.0.0
Route del-net 224.0.0.0 netmask 240.0.0.0 Reject
To delete and add a default gateway for settings:
Route add default GW 192.168.120.240
Route del default GW 192.168.120.240
route-displaying and setting the network routing table in the Linux kernel