LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2015, 10:59 PM   #1
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Rep: Reputation: Disabled
SIOCADDRT error and two gateway for same destination when I use pptp?


Before I use
Code:
pppd call
Code:
$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    1024   0        0 wlp8s0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlp8s0
And then I call the code
server: 50.117.*.*
Code:
	sudo pppd call shayu13
	sudo route add -net 0.0.0.0 dev ppp0
I get the error:
Quote:
SIOCADDRT: Network is down
I must change the code by adding the sleep code.
Code:
	sudo pppd call shayu13
	sleep 15
	sudo route add -net 0.0.0.0 dev ppp0
Why? Thanks

And when I look the route tables:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0
0.0.0.0         192.168.1.1     0.0.0.0         UG    1024   0        0 wlp8s0
50.117.**.**  192.168.1.1     255.255.255.255 UGH   0      0        0 wlp8s0
172.16.**.**     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlp8s0
It seems that 0.0.0.0 has two gateway. Is that OK? Thanks

Last edited by ytyyutianyun; 02-18-2015 at 11:06 PM.
 
Old 02-19-2015, 03:38 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It takes some time for the network to be initialized, and until the network is initialized the route command can't work. Normally, the previous default route would be removed, but I think it works because the system will use the first one found in the route table.

What is going on is that the pppd service is authenticating connecting, and authenticating.

To avoid that, pppd has a "defaultroute" option that will set your default route after the connection is established, and avoid having to do it manually. I believe this should be in the configuration file for shayu13.

Last edited by jpollard; 02-19-2015 at 03:40 PM.
 
1 members found this post helpful.
Old 02-19-2015, 10:24 PM   #3
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
It takes some time for the network to be initialized, and until the network is initialized the route command can't work. Normally, the previous default route would be removed, but I think it works because the system will use the first one found in the route table.

What is going on is that the pppd service is authenticating connecting, and authenticating.

To avoid that, pppd has a "defaultroute" option that will set your default route after the connection is established, and avoid having to do it manually. I believe this should be in the configuration file for shayu13.
Can you give more suggestion about "defaultroute" . Actually, the configuration is I created by the pptpsetup. Thanks
 
Old 02-20-2015, 07:05 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
I got the info from the manpage on pppd:

Code:
       call name
              Read additional options from the file /etc/ppp/peers/name.  This
              file may contain privileged options, such  as  noauth,  even  if
              pppd  is  not  being run by root.  The name string may not begin
              with / or include .. as a pathname component.  The format of the
              options file is described below.
...
       defaultroute
              Add a default route to the system routing tables, using the peer
              as the gateway, when IPCP negotiation is successfully completed.
              This entry is removed when the PPP connection is  broken.   This
              option is privileged if the nodefaultroute option has been spec‐
              ified.
Thus I concluded that the defaultroute option needs to be in the /etc/ppp/peers/shayu13 configuration.

It is also quite possible that you have to add a script to /etc/ppp/ip-up.d/... to get it to work at the right time.

http://pptpclient.sourceforge.net/routing.phtml (the section on automatic routing), but the other sections might help as well.

Last edited by jpollard; 02-20-2015 at 07:12 AM.
 
1 members found this post helpful.
Old 02-20-2015, 09:53 PM   #5
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
I got the info from the ...but the other sections might help as well.
I know I could add the code
in
Code:
 /etc/ppp/ip-up.d/route-traffic
Code:
#!/bin/bash
NET="10.0.0.0/8" #< Modify
IFACE="ppp0"     #< Modify
#IFACE=$1
route add -net ${NET} dev ${IFACE}
But I could not found any directory which name is
Code:
ip-up.d/route-traffic
May be my OS is centos 7
 
Old 02-20-2015, 10:22 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
The directory is /etc/ppp/ip-up.d

The directory might not exist (not that many use CentOS with PPP - I've never needed it) and you would have to create it.

If you haven't tried it yet, I would suggest using the "defaultroute" in the options file in /etc/ppp/options file first. It is also possible it won't try the ip-up.d directory unless it is trying to set the network parameters... (and not having one should give an error message)
 
Old 02-20-2015, 11:07 PM   #7
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
The directory is /etc/ppp/ip-up.d

The directory might not exist (not that many use CentOS with PPP - I've never needed it) and you would have to create it.

If you haven't tried it yet, I would suggest using the "defaultroute" in the options file in /etc/ppp/options file first. It is also possible it won't try the ip-up.d directory unless it is trying to set the network parameters... (and not having one should give an error message)
Thank you

I add the "defaultroute" in end line of the options file in /etc/ppp/options.pptp. And then in my shayu13 configuration. I add
Code:
file /etc/ppp/options.pptp
. But it doesn't work.

I browse the website and it shows my ip is
Code:
172.16.*.*
The fourth line of the
Quote:
Originally Posted by ytyyutianyun View Post
172.16.*.*

Last edited by ytyyutianyun; 02-20-2015 at 11:12 PM.
 
Old 02-21-2015, 04:34 AM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
If you read the pppd manpage you will find that it reads the file "options".
Code:
OPTIONS FILES
       Options  can  be  taken  from  files as well as the command line.  Pppd
       reads  options  from   the   files   /etc/ppp/options,   ~/.ppprc   and
       /etc/ppp/options.ttyname  (in that order) before processing the options
       on the command line.  (In fact, the command-line options are scanned to
       find  the  terminal  name before the options.ttyname file is read.)  In
       forming the name of the options.ttyname  file,  the  initial  /dev/  is
       removed  from  the  terminal  name,  and any remaining / characters are
       replaced with dots.

       An options file is parsed into a series of words, delimited  by  white‐
       space.   Whitespace  can be included in a word by enclosing the word in
       double-quotes (").  A backslash (\) quotes the following character.   A
       hash  (#)  starts a comment, which continues until the end of the line.
       There is no restriction on using the file or  call  options  within  an
       options file.
So it shouldn't be using options.pptp
 
Old 02-22-2015, 08:23 PM   #9
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
If you read the pppd manpage you will find that it reads the file "options".
....

So it shouldn't be using options.pptp
Thank you, when I put
Code:
defaultroute
in options
And just run
Code:
sudo pppd call shayu03
. It doesn't work until I run the code
Code:
	sudo route add -net 0.0.0.0 dev ppp0
 
Old 02-22-2015, 09:40 PM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
So now put the setup in the routing setup script as per the reference.
 
Old 02-23-2015, 04:14 AM   #11
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
So now put the setup in the routing setup script as per the reference.
Sorry, but I can't understand what the "routing setup script" and "reference" refers to. Would you mind talking more details. I'll appreciate it. Thanks
 
Old 02-23-2015, 05:36 AM   #12
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
The reference I gave earlier:

http://pptpclient.sourceforge.net/routing.phtml
 
Old 02-23-2015, 11:05 PM   #13
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jpollard View Post
I know, Thank you. But the server seems fixed. And I need to change if one server is blocked.
I then tried to manually add it
 
  


Reply

Tags
gateway, pptp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ping a destination server passing by a certain gateway madpsycho Linux - Networking 2 11-16-2011 11:42 AM
Destination HOST Unreachable - cannot ping gateway rpkosuri Linux - Networking 5 06-16-2008 11:38 PM
Ping error "Destination Host Unreachable" from the gateway cristi_ro Linux - Networking 4 10-30-2006 04:32 PM
Gateway Destination PC sound problems tjacobs Linux - Hardware 1 12-22-2004 11:49 AM
siocaddrt error after Suse 9.1 upgrade t3___ Linux - Newbie 1 06-21-2004 11:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration