Problem in gif-tunnel creation

Hallo all. I have to create vpn through 2 FreeBSD 10.0 gateways. With command line I do it successfully. But I cannot do it with rc.conf.

When I write in rc.conf
Code:
cloned_interfaces="gif0"
ifconfig_gif0="tunnel EXTIP1 EXTIP2"
ifconfig_gif0="inet 192.168.51.1 192.168.111.2 netmask 0xffffffff"
i receive
Code:
gif0: flags=8011<UP,POINTOPOINT,MULTICAST> metric 0 mtu 1280
	inet 192.168.51.1 --> 192.168.111.2 netmask 0xffffffff 
	inet6 fe80::76d4:35ff:fe13:3863%gif0 prefixlen 64 tentative scopeid 0x7 
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>


When I write in rc.conf (change line order)
Code:
cloned_interfaces="gif0"
ifconfig_gif0="inet 192.168.51.1 192.168.111.2 netmask 0xffffffff"
ifconfig_gif0="tunnel  EXTIP1 EXTIP2"
I receive
Code:
gif0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1280
	tunnel inet EXTIP1 --> EXTIP2
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

What am I doing wrong?
 
The rc.conf file is a shell script and it uses the /bin/sh shell's variable assignment conventions. What you're now doing is first assigning one value to ifconfig_gif0 and immediately after it overriding the value with another one. Combine the two lines into one:

Code:
ifconfig_gif0="tunnel EXTIP1 EXTIP2 inet 192.168.51.1 192.168.111.2 netmask 0xffffffff"
 
kpa said:
The rc.conf file is a shell script and it uses the /bin/sh shell's variable assignment conventions. What you're now doing is first assigning one value to ifconfig_gif0 and immediately after it overriding the value with another one. Combine the two lines into one:

Code:
ifconfig_gif0="tunnel EXTIP1 EXTIP2 inet 192.168.51.1 192.168.111.2 netmask 0xffffffff"
In this case I receive
Code:
gif0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1280
   tunnel inet EXTIP1 --> EXTIP2
   nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
but I change order parameters
Code:
ifconfig_gif0="inet 192.168.51.1 192.168.111.2 netmask 0xffffffff tunnel EXTIP1 EXTIP2"
and receive
Code:
 gif0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1280
	tunnel inetEXTIP1 --> EXTIP2
	inet 192.168.51.1 --> 192.168.111.2 netmask 0xffffffff
Thank you for your help!
 
Back
Top