MandrivaUsers.org : Linux Default gateway - MandrivaUsers.org

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Linux Default gateway

#1 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 05 October 2015 - 10:05 AM

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
0

#2 User is offline   ianw1974 

  • Platinum
  • Group: Admin
  • Posts: 14,092
  • Joined: 09-March 05

Posted 06 October 2015 - 08:34 AM

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.
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........

My Linux Solutions | Linux Systems Limited
0

#3 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 06 October 2015 - 10:24 AM

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
0

#4 User is offline   ianw1974 

  • Platinum
  • Group: Admin
  • Posts: 14,092
  • Joined: 09-March 05

Posted 09 October 2015 - 05:59 AM

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.c...p0+idle+timeout
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........

My Linux Solutions | Linux Systems Limited
0

#5 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 09 October 2015 - 06:32 AM

View Postianw1974, on 09 October 2015 - 05:59 AM, said:

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.c...p0+idle+timeout

0

#6 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 09 October 2015 - 06:51 AM

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
0

#7 User is offline   ianw1974 

  • Platinum
  • Group: Admin
  • Posts: 14,092
  • Joined: 09-March 05

Posted 09 October 2015 - 08:14 AM

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.
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........

My Linux Solutions | Linux Systems Limited
0

#8 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 09 October 2015 - 08:45 AM

View Postianw1974, on 09 October 2015 - 08:14 AM, said:

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.

0

#9 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 09 October 2015 - 08:46 AM

Hi
i cant understand that need to set some kind of idle timeout for ppp0 can you please explain me in detail
0

#10 User is offline   ianw1974 

  • Platinum
  • Group: Admin
  • Posts: 14,092
  • Joined: 09-March 05

Posted 09 October 2015 - 10:29 AM

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.
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........

My Linux Solutions | Linux Systems Limited
0

#11 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 09 October 2015 - 12:08 PM

View Postianw1974, on 09 October 2015 - 10:29 AM, said:

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.

0

#12 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 09 October 2015 - 12:14 PM

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
0

#13 User is offline   ianw1974 

  • Platinum
  • Group: Admin
  • Posts: 14,092
  • Joined: 09-March 05

Posted 09 October 2015 - 12:15 PM

Quote

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/...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.
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........

My Linux Solutions | Linux Systems Limited
0

#14 User is offline   ianw1974 

  • Platinum
  • Group: Admin
  • Posts: 14,092
  • Joined: 09-March 05

Posted 09 October 2015 - 12:16 PM

View Postartlk, on 09 October 2015 - 12:14 PM, said:

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.
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........

My Linux Solutions | Linux Systems Limited
0

#15 User is offline   artlk 

  • New Here
  • Group: Members
  • Posts: 11
  • Joined: 05-October 15

Posted 09 October 2015 - 12:33 PM

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

This post has been edited by artlk: 09 October 2015 - 12:41 PM

0

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users