Add or delete a route

Source: Internet
Author: User

Add or delete route 1, specify interface 1, add host route # route add 10.10.10.2 dev tun0 or # route add-host 10.10.10.2 dev tun02, delete host route # route del 10.10.10.2 dev tun0 or route del -host 10.10.10.2 dev tun03: add a network route # route add-net 10.10.10.0/24 dev eth1 or # route add-net 10.10.10.0 netmask route 255.255.0 dev tun04, delete a network route # route del-net 192.168.1.0 /24 dev eth1 or # route del-net 10.10.10.0 netmask route 255.255.0 dev tun05, add default route # route add default Dev eth06, delete default route # route del default dev eth0 2. Specify gateway 1. add host route # route add 10.10.10.0 gw 192.168.0.1 or # route add-host 10.10.0 gw 192.168.0.12, delete host route # route del 10.10.0 gw 192.168.0.1 or # route del-host 10.10.10.0 gw 192.168.0.1 note: 192.168.0.1 is a gateway address in the actual network. 3. add the network route add-net 10.10.0.0/24 gw 192.168.0.1 or route add-net 10.10.0.0 netmask gw 192.168.0.14, delete the network route del-net 10.10.0.0/24 gw 192.168.0.1 or route del- net 10.10.0.0 netmask 255.255.255.0 gw 192.168.0.1 note: remember-net gw dev three options! Note: 192.168.0.1 is a meaningful address in the actual network. Note: The Gateway and interface must be associated! Note: The restart network configured with the route command is invalid! Note: The permanent configuration is in the/etc/rc. local or network file!

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.