Gentoo Archives: gentoo-user

From: Norbert Kamenicky <noro@××××××.sk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Howto setup tunnel in gentoo scripts
Date: Tue, 30 May 2006 22:38:29
Message-Id: 447CC6EF.4070809@xmedia.sk
In Reply to: Re: [gentoo-user] Howto setup tunnel in gentoo scripts by Neil Bothwick
1 Neil Bothwick wrote:
2 > On Tue, 30 May 2006 22:29:02 +0200, Norbert Kamenicky wrote:
3 >
4 >
5 >>to establish gre tunnel, these commands have to be run:
6 >>(e.g. from local.start)
7 >>
8 >># ip tunnel add vpn0 mode gre remote 1.1.1.1 local 2.2.2.2 dev eth0
9 >># ip addr add 3.3.3.3 dev vpn0
10 >># ip link set vpn0 mtu 1420 up
11 >>
12 >>Does anybody know, how to put it into /etc/conf.d/net ?
13 >>I didn't succeed yet, 'cause I found no clear doc.
14 >
15 >
16 > I take it you want these run when the interface comes up? If so, put them
17 > in the postup() function in /etc/conf.d/net. Something like
18 >
19 > postup() {
20 > if [ ${IFACE} == "eth0" ]; then
21 > ip tunnel add vpn0 mode gre remote 1.1.1.1 local 2.2.2.2 dev eth0
22 > ip addr add 3.3.3.3 dev vpn0
23 > ip link set vpn0 mtu 1420 up
24 > fi
25 > }
26 >
27 > You may need to put the shutdown commands in predown().
28 >
29 > See /etc/conf.d/net.example for more info. I use ~arch, so I don't know
30 > for sure how much of this works in the current stable baselayout, but
31 > I've been using these functions for over a year, so I guess it's in
32 > stable by now.
33 >
34
35 Hi Neil,
36
37 thanks for the reply ... yes, I want to start it, if eth0 goes up.
38
39 Ok, it will probably work (not tested yet), but ...
40 it's not a big difference if it is in local.start,
41 postup() function or some another script.)
42
43 I feel that's not the right way how it should be done.
44
45 This is probably a bit closer to rc-script author idea:
46
47 modules=( "iptunnel" ) # no info about it in net.example
48 iptunnel_vpn0=( "mode gre remote 1.1.1.1 local 2.2.2.2 dev eth0" )
49 config_vpn0=( "3.3.3.3" )
50
51 postup(){
52 [ ${IFACE} == "vpn0" ] && ip link set vpn0 mtu 1420 up
53 }
54
55
56
57 Next I like to add this route:
58
59 ip route add 4.4.4.0/24 dev vpn0
60
61 which IMO should be possible to write as:
62
63 routes_vpn0=( "4.4.4.0/24" )
64
65 but it fails with "[!!]" error, which tells me exactly nothing
66
67 Any idea ?
68
69 noro
70
71
72
73
74
75
76
77
78
79
80 --
81 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] Howto setup tunnel in gentoo scripts Neil Bothwick <neil@××××××××××.uk>