Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/conf.d/net, routes, postup/postdown handlers right way
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
modnaruved
Apprentice
Apprentice


Joined: 21 Mar 2011
Posts: 160

PostPosted: Tue Jun 03, 2014 2:26 pm    Post subject: /etc/conf.d/net, routes, postup/postdown handlers right way Reply with quote

Hi!

I saw in net.examples.bz2 note about some disadvantages in postup/postdown handlers:

Quote:

...
#
# Note in earlier versions of openrc, this was provided as an example in
# postup/postdown, however that implementation suffered some bugs in corner
# cases, which are now fixed with this merger. If you used the previous
# example, you should only need to drop the relevent portions of your
# postup/postdown functions, and review the quoting in your rules_IFACE
# variables.
...


I need just add route something like:

Code:

route add -host 192.168.1.100 tap0



How can I add in /etc/conf.d/net that route correctly by syntax like this (as in example):
Code:

# Here's how to do routing if you need it
# We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
#routes_eth0="default via 192.168.0.1
#10.0.0.0/8 via 192.168.0.1
#::/0"

?


I cant find any comprehensive guide about syntax and rules how to write simple rule like route add -host $IP $I in /etc/conf.d/net

As tempo solution this works for me in /etc/conf.d/net :

Code:



$ii=wlp3s0
$idest=tap0

postup()
{
        if [[ $IFACE == $ii ]] ; then
           route add -host 192.168.1.100 $idest
        fi
        return
}

postdown()
{
        if [[ $IFACE == $ii ]] ; then
           route del -host 192.168.1.100 $idest
        fi
        return
}


Thanks for any solutions
Back to top
View user's profile Send private message
massimo
Veteran
Veteran


Joined: 22 Jun 2003
Posts: 1226

PostPosted: Wed Jun 04, 2014 8:38 am    Post subject: Reply with quote

Does it work if you add the following to the config (routes_eth0):

Code:
192.168.1.100/32 dev tap0

_________________
Hello 911? How are you?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum