# starting tap0 interface at boot time?



## mamalos (Jan 9, 2012)

Dear all,

I wish to use a *tap* interface before my jails start, because I use this interface as my jail interface. What do I have to write in /etc/rc.conf in order for it to be created at boot time? (ifconfig_tap0="10.230.0.1/24" does not work; the interface needs to be created first).

Thank you all for your time in advance.


----------



## SirDice (Jan 9, 2012)

What exactly is running on tap0? (the interface can be used for multiple purposes).


----------



## mamalos (Jan 9, 2012)

I am using tap0 as the jail interface:

excerpt from /etc/fstab:


```
jail_redmine_interface="tap0"
```

But apart from my specific configuration, I have always been curious about how I can create a virtual interface on boot using /etc/fstab and not /etc/rc.local (which in my case -I think- it wouldn't help, since -if I remember correctly- rc.local has a lower priority than jail in *rc*).

Thank you for your immediate answer, you're even faster than I remembered  !


----------



## SirDice (Jan 9, 2012)

mamalos said:
			
		

> I am using tap0 as the jail interface:


Yes, I understood that. But what creates the tap0 interface? There are various ways of using that interface.


----------



## mamalos (Jan 9, 2012)

Sorry, I don't understand what you mean...Nothing creates the specific interface, and this is exactly what my problem is. I wish to create it "automatically", somehow, through the use of /etc/rc.conf without running any additional service (instead of having to run *ifconfig tap0 create* manually).


----------



## SirDice (Jan 9, 2012)

If you aren't going to need any networking, why don't you bind your jails to *lo1* (a clone off of *lo0*)?


----------



## mamalos (Jan 9, 2012)

I need networking, but I wish to use natting on my jails (and other firewall features through pf), and not use alias addresses on my outgoing interface. Isn't there a way to tell the kernel to start an interface through rc.conf?


----------



## SirDice (Jan 9, 2012)

mamalos said:
			
		

> I need networking, but I wish to use natting on my jails (and other firewall features through pf), and not use alias addresses on my outgoing interface.


Which you can also do with a cloned lo1.


----------



## SirDice (Jan 9, 2012)

In /etc/rc.conf:

```
cloned_interfaces="lo1"
ifconfig_lo1="10.230.0.1/24"
```

You could try this with *tap0* but I'm not sure it'll work. It should work with *lo1*.

From here you can use PF to forward ports from the 'outside' to *lo1*.


----------



## mamalos (Jan 9, 2012)

Thank SirDice, worked like a charm.

By the way, on my old laptop (FreeBSD) I used to have cloned interfaces for my vlan setup. Now I see that in order to configure my tap interface, I had to use the same variable. Where can I find more information with respect to FreeBSD's cloned interfaces?

Thanx again!


----------



## SirDice (Jan 9, 2012)

mamalos said:
			
		

> Where can I find more information with respect to FreeBSD's cloned interfaces?


Tricky. With things like this I usually just start reading the system's rc scripts.


----------



## mamalos (Jan 9, 2012)

Which was exactly what I had been doing before you sent me your last message, and I was wondering what these clone interfaces were in /etc/network_subr; hoped to find a better way though 

Thanks again for all the immediate help!


----------



## bbzz (Jan 9, 2012)

I use tap to bridge virtual networks with dynamips.

To create it automatically I used:
`# echo -n > /dev/tap0`

This was needed one time only.

Also needed is 
	
	



```
if_tap_load="YES"
```
 in /boot/loader.conf.

I don't know if this helps in your case.


----------

