I know how to use 'ip' to set up a static route, e.g.: ip route add 192.168.128.0/17 via 40.53.24.3 dev eth0 But if you reboot or restart network, you loose this. Thus you have to make it persistant. I found: http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html where it says to add to ifcfg-eth0: 192.168.128.0/17 via 40.53.24.3 But this did not work after the interface was restarted. So what is the proper to set up persistant static routes?
On 12 March 2015 at 13:43, Robert Moskowitz <rgm at htt-consult.com> wrote:> I know how to use 'ip' to set up a static route, e.g.: > > ip route add 192.168.128.0/17 via 40.53.24.3 dev eth0 > > But if you reboot or restart network, you loose this. Thus you have to > make it persistant. I found: > > http://www.cyberciti.biz/tips/configuring-static-routes-in- > debian-or-red-hat-linux-systems.html > > where it says to add to ifcfg-eth0: > > 192.168.128.0/17 via 40.53.24.3 > > But this did not work after the interface was restarted. So what is the > proper to set up persistant static routes? > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >I have used this document [0] in the past and it worked for me, let me know if it works for you. [0] https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-networkscripts-static-routes-network-netmask-directives.html -- Kind Regards Earl Ramirez
On Thu, 12 Mar 2015 12:43:27 -0500, Robert Moskowitz <rgm at htt-consult.com> wrote:> I know how to use 'ip' to set up a static route, e.g.: > > ip route add 192.168.128.0/17 via 40.53.24.3 dev eth0 > > But if you reboot or restart network, you loose this. Thus you have to > make it persistant. I found: > > http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html > > where it says to add to ifcfg-eth0: > > 192.168.128.0/17 via 40.53.24.3 >Create the file /etc/sysconfig/network-scripts/route-eth0 Add the following for each static route, incrementing the numeric for each: ADDRESS0=192.168.128.0 NETMASK0=255.255.128.0 GATEWAY0=40.53.24.3> But this did not work after the interface was restarted. So what is the > proper to set up persistant static routes? > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos
On 03/12/2015 01:50 PM, Earl A Ramirez wrote:> On 12 March 2015 at 13:43, Robert Moskowitz <rgm at htt-consult.com> wrote: > >> I know how to use 'ip' to set up a static route, e.g.: >> >> ip route add 192.168.128.0/17 via 40.53.24.3 dev eth0 >> >> But if you reboot or restart network, you loose this. Thus you have to >> make it persistant. I found: >> >> http://www.cyberciti.biz/tips/configuring-static-routes-in- >> debian-or-red-hat-linux-systems.html >> >> where it says to add to ifcfg-eth0: >> >> 192.168.128.0/17 via 40.53.24.3 >> >> But this did not work after the interface was restarted. So what is the >> proper to set up persistant static routes? >> >> >> _______________________________________________ >> CentOS mailing list >> CentOS at centos.org >> http://lists.centos.org/mailman/listinfo/centos >> > I have used this document [0] in the past and it worked for me, let me know > if it works for you. > > [0] > https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-networkscripts-static-routes-network-netmask-directives.htmlYes it did. Brings back some really old memories of doing this way some 10 years ago. Back when I built a firewall on Centos4 with lots of ethernets and Shorewall and stuff. thanks
On Mar 12, 2015, at 11:52 AM, Jason Warr <jason at warr.net> wrote:> > On Thu, 12 Mar 2015 12:43:27 -0500, Robert Moskowitz <rgm at htt-consult.com> wrote: > >> I found: >> >> http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html >> >> where it says to add to ifcfg-eth0: >> >> 192.168.128.0/17 via 40.53.24.3That?s only for RHEL 7: http://goo.gl/AtjIyI> ADDRESS0=192.168.128.0 > NETMASK0=255.255.128.0 > GATEWAY0=40.53.24.3This is the scheme used in prior versions of RHEL.
On Thu, Mar 12, 2015 at 01:43:27PM -0400, Robert Moskowitz wrote:> I know how to use 'ip' to set up a static route, e.g.: > > ip route add 192.168.128.0/17 via 40.53.24.3 dev eth0 > > But if you reboot or restart network, you loose this. Thus you have > to make it persistant. I found: > > http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html > > where it says to add to ifcfg-eth0: > > 192.168.128.0/17 via 40.53.24.3 > > But this did not work after the interface was restarted. So what is > the proper to set up persistant static routes? >Are you using NetworkManager? I think you have to specifically remove it although I am not quite sure when RH made it the default (nor am I sure if it would override routes, but it frequently seems to cause issues.) Also, the article doesn't say add the lineifcfg-eth0. The article says add it to route-eth0. Was that just a typo on your part? -- Scott Robbins PGP keyID EB3467D6 ( 1B48 077D 66F6 9DB0 FDC2 A409 FA54 EB34 67D6 ) gpg --keyserver pgp.mit.edu --recv-keys EB3467D6
On 03/12/2015 08:46 PM, Scott Robbins wrote:> On Thu, Mar 12, 2015 at 01:43:27PM -0400, Robert Moskowitz wrote: >> I know how to use 'ip' to set up a static route, e.g.: >> >> ip route add 192.168.128.0/17 via 40.53.24.3 dev eth0 >> >> But if you reboot or restart network, you loose this. Thus you have >> to make it persistant. I found: >> >> http://www.cyberciti.biz/tips/configuring-static-routes-in-debian-or-red-hat-linux-systems.html >> >> where it says to add to ifcfg-eth0: >> >> 192.168.128.0/17 via 40.53.24.3 >> >> But this did not work after the interface was restarted. So what is >> the proper to set up persistant static routes? >> > Are you using NetworkManager? I think you have to specifically remove it > although I am not quite sure when RH made it the default (nor am I sure if > it would override routes, but it frequently seems to cause issues.)No NetworkManager on these systems.> Also, the article doesn't say add the lineifcfg-eth0. The article says add it > to route-eth0. Was that just a typo on your part?Misread on my part. My dyslexia at work (have to have something to blame!).