Add a Route entry (permanent)

Source: Internet
Author: User

Method 1:echo "192.168.1.0/24 via 172.17.100.1" >/etc/sysconfig/network-scripts/route-eth0

[[email protected] ~]# echo  "192.168.1.0/24 via 172.17.100.1"  > / Etc/sysconfig/network-scripts/route-eth0[[email protected] ~]# route -nkernel ip  routing tableDestination     Gateway          genmask         flags metric ref     Use Iface192.168.1.0     172.17.100.1     255.255.255.0   UG    0      0         0 eth0172.17.100.0    0.0.0.0          255.255.255.0   u     0       0        0 eth0169.254.0.0      0.0.0.0         255.255.0.0     u      1002   0        0 eth00.0.0.0          172.17.100.1    0.0.0.0          ug    0      0         0 eth0[[email protected] ~]#


Method 2:

[[email protected] ~]# echo -e  "Address0=192.168.1.0\nnetmask0=255.255.255.0\ ngateway0=172.17.100.1 " > /etc/sysconfig/network-scripts/route-eth0[[email protected] ~ ]# cat /etc/sysconfig/network-scripts/route-eth0address0=192.168.1.0netmask0=255.255.255.0gateway0= 172.17.100.1[[email protected] ~]# /etc/init.d/network restartshutting down  interface eth0:                               [  ok   ]Shutting down loopback interface:                           [   OK  ]Bringing up loopback interface:                             [   OK  ]Bringing up interface eth0:  Determining if ip  address 172.17.100.240 is already in use for device eth0...                                                               [  ok  ][[email protected] ~]# route -nkernel  IP routing tableDestination     Gateway          Genmask         Flags Metric  Ref    use iface192.168.1.0     172.17.100.1    255.255.255.0    UG    0      0         0 eth0172.17.100.0    0.0.0.0          255.255.255.0   U     0       0        0 eth0169.254.0.0      0.0.0.0         255.255.0.0     u      1002   0        0  eth00.0.0.0         172.17.100.1    0.0.0.0          UG    0       0        0 eth0[[email protected] ~]# 





This article is from the "Hezhang" blog, make sure to keep this source http://hezhang.blog.51cto.com/1347601/1633122

Add a Route entry (permanent)

Related Article

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.