### 4.6 Network interfaces ¶

Before tinc can start transmitting data over the tunnel, it must set up the virtual network interface.

First, decide which IP addresses you want to have associated with these devices, and what network mask they must have.

Tinc will open a virtual network device (`/dev/tun`, `/dev/tap0` or similar), which will also create a network interface called something like ‘`tun0`’, ‘`tap0`’. If you are using the Linux tun/tap driver, the network interface will by default have the same name as the netname. Under Windows you can change the name of the network interface from the Network Connections control panel.

You can configure the network interface by putting ordinary ifconfig, route, and other commands to a script named `/etc/tinc/netname/tinc-up`. When tinc starts, this script will be executed. When tinc exits, it will execute the script named `/etc/tinc/netname/tinc-down`, but normally you don’t need to create that script.

An example `tinc-up` script:

    #!/bin/sh
    ifconfig $INTERFACE 192.168.1.1 netmask 255.255.0.0

This script gives the interface an IP address and a netmask. The kernel will also automatically add a route to this interface, so normally you don’t need to add route commands to the `tinc-up` script. The kernel will also bring the interface up after this command. The netmask is the mask of the entire VPN network, not just your own subnet.

The exact syntax of the ifconfig and route commands differs from platform to platform. You can look up the commands for setting addresses and adding routes in Platform specific information, but it is best to consult the manpages of those utilities on your platform.