Jump to content
  • Announcements

    • spinynorman

      Mandriva Official Documentation

      Official documentation for extant versions of Mandriva can be found at doc.mandriva.com.   Documentation for the latest release may take some time to appear there. You can install all the manuals from the main repository if you have Mandriva installed - files are prefixed mandriva-doc.
    • paul

      Forum software upgrade   10/29/17

      So you may have noticed the forum software has upgraded !!!
      A few things that have changed. We no longer have community blogs (was never really used) We no longer have a portal page.
      We can discuss this, and decide whether it is needed (It costs money) See this thread: Here
Sign in to follow this  
artlk

Linux Default gateway

Recommended Posts

Hi

 

i have 2 nic connected to centos server etho to lan and eth1 to bsnl isp

and set default gateway ip 10.10.1.169 in /etc/sysconfig/network file when i make /sbin/ifdown ppp0 then the server take default gateway 10.10.1.169 but when

i remove telepone line from modem then default gateway ip 10.10.1.169 is not set , pls suggest what is wrong and what i have to do

Share this post


Link to post
Share on other sites

Just taking the phone line out, your system still thinks that the ppp0 connection is active, and so you have two default routes. Which is probably why it works when you do ifdown ppp0. You said eth1 is your isp, so why are you using ppp0 unless of course that is also connected with eth1 for user authentication to bring the link up (PPPoE)?

 

I expect we need more information on your computer setup before we can help you further. But I expect it is related to the scenario I listed above that you have two default routes and everything is attempting to go via the one created by the ppp0 link until you drop the link.

 

In fact you don't need two default routes as such. You don't need this for your internal network if you are not accessing the internet from it. Perhaps explain more on what you are trying to achieve.

Share this post


Link to post
Share on other sites

Thanks for reply

 

i try to achieve that if my internet from centos server is down then i have to take internet from another window pc on which net is connected .

as i told i have centos on which 2 nic card one etho connected to eth0 and bsnl isp line connected to eth1 via adsl modem.

set default gateway ip 10.10.1.169 (this is ip of window pc on which net is connected) in /etc/sysconfig/network file when i make /sbin/ifdown ppp0(ppp0 is bsnl link when bsnl link is working) then the server take default gateway 10.10.1.169 and net start in centos server but when

i remove telepone line from modem then default gateway ip 10.10.1.169 is not set ,if i manually set default gateway to 10.10.1.169 it set checked by route -n but after 3-4 min it is remove automatically pls suggest what is wrong and what i have to do

Share this post


Link to post
Share on other sites

As I said, just removing the telephone line, CentOS still thinks the ppp0 connection is active, and it's not responding, and so this is your problem. Ideally ppp0 should disconnect when there is no longer an internet connection. I don't have such a setup to be able to tell you what to do. You need some kind of timeout for ppp0 when it's not in use, or when no traffic is able to go across the link. This would then initiate an ifdown and you would have the default route via your Windows machine.

 

Maybe this google search for an idle timeout will help give you the info you need:

 

https://www.google.co.uk/?gws_rd=ssl#q=linux+ppp0+idle+timeout

Share this post


Link to post
Share on other sites

As I said, just removing the telephone line, CentOS still thinks the ppp0 connection is active, and it's not responding, and so this is your problem. Ideally ppp0 should disconnect when there is no longer an internet connection. I don't have such a setup to be able to tell you what to do. You need some kind of timeout for ppp0 when it's not in use, or when no traffic is able to go across the link. This would then initiate an ifdown and you would have the default route via your Windows machine.

 

Maybe this google search for an idle timeout will help give you the info you need:

 

https://www.google.co.uk/?gws_rd=ssl#q=linux+ppp0+idle+timeout

Share this post


Link to post
Share on other sites

Hi

 

you are right but when i make /sbin/ifdown ppp0(here link is connected to adsl modem) then the server take default gateway 10.10.1.169 and net start in centos server but what do you think if i dont remove telephone line from modem and if real condition occur i.e net is down from bsnl then in that case default gateway 10.10.1.169 is set automatically or not

Share this post


Link to post
Share on other sites

I expect it won't do it automatically, because it seems you do not have a ppp0 idle timeout. Your simulation with pulling the telephone cable shows that this is the case. So you need to set some kind of idle timeout for ppp0, and then perhaps that will fix your problem.

Share this post


Link to post
Share on other sites

I expect it won't do it automatically, because it seems you do not have a ppp0 idle timeout. Your simulation with pulling the telephone cable shows that this is the case. So you need to set some kind of idle timeout for ppp0, and then perhaps that will fix your problem.

Share this post


Link to post
Share on other sites

If you don't have an idle timeout, then your ppp0 connection will stay active. Which is what you have now. If you have an idle timeout set for 3 minutes, then if nothing happens for 3 minutes, the connection will then drop and your system will work how you want it.

 

So you need to do this.

Share this post


Link to post
Share on other sites

If you don't have an idle timeout, then your ppp0 connection will stay active. Which is what you have now. If you have an idle timeout set for 3 minutes, then if nothing happens for 3 minutes, the connection will then drop and your system will work how you want it.

 

So you need to do this.

Share this post


Link to post
Share on other sites

you mean to say that if ppp0 is time out after 3 min then i have to run my script right but one thing i like to share when i disconnect phone line from modem then if i checked link status by /sbin/adsl-status it shows ppp0 is connected and after 2 min if i checked status then it shows error as "link is attached to ppp0 but ppp0 is down " in that case if i set gateway as 10.10.1.169 then it set but it automatically removed again

Share this post


Link to post
Share on other sites
idle n

 

If this option is configured, pppd will disconnect the link whenever this timer expires. Idle times are specified in seconds. Each new active data packet will reset the timer.

 

From here:

 

http://www.tldp.org/LDP/nag2/x7297.html

 

obviously n you set a number for in seconds to specify an idle timeout. As I said earlier, I don't have a set up like yours, so it helps if you use google and search for the info I provided you with.

Share this post


Link to post
Share on other sites

you mean to say that if ppp0 is time out after 3 min then i have to run my script right but one thing i like to share when i disconnect phone line from modem then if i checked link status by /sbin/adsl-status it shows ppp0 is connected and after 2 min if i checked status then it shows error as "link is attached to ppp0 but ppp0 is down " in that case if i set gateway as 10.10.1.169 then it set but it automatically removed again

 

No, you set the config option in my previous post to set the idle time, then ppp0 will be dropped, and your route should be active. I don't know what else you are doing or what your script is for.

Share this post


Link to post
Share on other sites

where i need to set idle n option in centos server pls explain and if it pppo is drop after timer then link is down but what happend when link is up then this timer how works i am get little bit confuse

Edited by artlk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×