Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I agree with ComputerErik, the correct way would be to use standard scripts.
Anyway, if you do a script which is supposed to be run during boot sequence, always use full path, I mean you should specify "/sbin/route", because nothing guarantee you that PATH is correctly set during boot.
Actually my servers has two NICs and both NICs have been assigned IP addresses and default gateways. Linux by default picks only one default gateway and puts it in routing table which can be viewed in 'route -n' command. Now purpose of dual NICs and IPs is that if one NIC or even router gets down then traffic will be received using send NIC or router and after processing send traffic back to router.
I have defined default gateways of both NICs using scripts placed at /etc/sysconfig/network-scripts/ but only one default gateway is used by linux and if that gateways gets down then traffic can't be sent from the server. Now if I execute command route add default gw 192.168.0.1 netmask 0.0.0.0 dev eth3 then it puts second default gateway in routing table and this way I can achieve redundancy. I hope now my requirement is clear so please suggest me how can I automate above command on startup/boot time.
Ok, I think that this link may help you: http://www.cyberciti.biz/faq/setting...terfaces-file/
I think that if I were you, I would try to "play" with "post-down command" stuff to change the default gateway when an interface comes down. As I have never tried I cannot assert it will work, but it is from my point of view the cleanest way to proceed.
Sorry but unfortunately, I have never used Centos and barely never used Fedora (I think that they are quite similar)... So I cannot help you more.
Maybe have a look at /etc/sysconfig/network-scripts/ directory and ifup-routes file... the best would be to create a similar file named ifdown-routes to change your gateway when an interface bvrings down.