You are not logged in.

#1 2012-03-25 10:15:19

rado3105
Member
Registered: 2011-10-09
Posts: 103

How to make a script which adds more default routes...

I created file with this commands inside:

#!/bin/bash
ip route add 10.13.58.0/24 dev ppp0
ip route add 10.13.57.0/24 dev ppp0
ip route add 10.13.56.0/24 dev ppp0
ip route add 10.13.54.0/24 dev ppp0
ip route add 192.168.76.0/24 dev ppp0

and named it: vpn-routes and saved in my home folder, when i start it using command:
sudo ./vpn-routes it doesnt create new routes.
What I am doing wrong? thanks

Offline

#2 2012-03-25 10:19:54

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: How to make a script which adds more default routes...

Show the error messages. We're not psychic.

Offline

#3 2012-03-25 10:38:28

rado3105
Member
Registered: 2011-10-09
Posts: 103

Re: How to make a script which adds more default routes...

When I execute command:
ip route add 10.13.58.0/24 dev ppp0
which is inside that script, then I can ping that ip from my pc, but when I just execute script(where is that route) I cant ping ip from the network 10.13.58.0/24

Offline

#4 2012-03-25 10:49:40

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: How to make a script which adds more default routes...

Useful debugging command:

route -n

Or:

ip route list

Offline

#5 2012-03-25 10:56:53

rado3105
Member
Registered: 2011-10-09
Posts: 103

Re: How to make a script which adds more default routes...

[r-c@r-c-laptop ~]$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
10.13.58.0      0.0.0.0         255.255.255.0   U     0      0        0 ppp0
192.168.0.0     0.0.0.0         255.255.255.0   U     2      0        0 eth0
192.168.44.1    0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
213.151.203.22  192.168.0.1     255.255.255.255 UGH   0      0        0 eth0

Offline

#6 2012-03-25 11:09:10

rado3105
Member
Registered: 2011-10-09
Posts: 103

Re: How to make a script which adds more default routes...

ips from that script are not there...

Offline

#7 2012-03-25 11:44:51

Gcool
Member
Registered: 2011-08-16
Posts: 1,456

Re: How to make a script which adds more default routes...

It should be perfectly possible to do it that way I think. Do the routes exist if you enter the commands manually one by one?

If so, perhaps try to put some pauses between each command. So something among the lines of...

#!/bin/bash
ip route add 10.13.58.0/24 dev ppp0
sleep 1
ip route add 10.13.57.0/24 dev ppp0
sleep 1
ip route add 10.13.56.0/24 dev ppp0
sleep 1
ip route add 10.13.54.0/24 dev ppp0
sleep 1
ip route add 192.168.76.0/24 dev ppp0

Burninate!

Offline

#8 2012-03-25 17:35:52

Blµb
Member
Registered: 2008-02-10
Posts: 224

Re: How to make a script which adds more default routes...

Gcool wrote:

It should be perfectly possible to do it that way I think. Do the routes exist if you enter the commands manually one by one?

If so, perhaps try to put some pauses between each command. So something among the lines of...

#!/bin/bash
ip route add 10.13.58.0/24 dev ppp0
sleep 1
(...)

No, that's neither a fix, nor a good workaround. It would suggest that the kernel/network driver, or something else fails to do proper locking at some place.
I can run a loop to create multiple routes quickly one after another, and it works, too.

The initally pasted script works for me. Though I had to s/ppp0/eth0/ sicne I have no ppp0

Last edited by Blµb (2012-03-25 17:41:18)


You know you're paranoid when you start thinking random letters while typing a password.
A good post about vim
Python has no multithreading.

Offline

Board footer

Powered by FluxBB