route-displaying and setting the network routing table in the Linux kernel

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.