# Three subnet on gif interface



## combat (Oct 12, 2012)

Hello all.
Help me please set up a tunnel IP-IP.
There are three subnets:
192.168.11.0/24 Int. IP: xx.xx.xx.xx (my server)
192.168.22.0/24 Int. IP: zz.zz.zz.zz
192.168.33.0/24Ð²Ð½. IP: zz.zz.zz.zz
The second and third subnets external IP identical

```
I set up a tunnel between from the first and second subgrid seq. this:
ifconfig gif0 create
ifconfig gif0 192.168.11.1 192.168.22.1
ifconfig gif0 tunnel xx.xx.xx.xx zz.zz.zz.zz
ifconfig gif0 mtu 1500 up
route add -net 192.168.22.0/24-interface gif0

when I set up next subnet
ifconfig gif0 create
ifconfig gif0 192.168.11.1 192.168.22.1
ifconfig gif0 tunnel xx.xx.xx.xx zz.zz.zz.zz
Following this line falls error 
Ifconfig: SIOCSIFPHYADDR: Can't assign requested address.
```


----------



## SirDice (Oct 12, 2012)

It's a point-to-point connection and as such it cannot have multiple IP addresses. There shouldn't be a need for it as you can simply add more static routes.


----------



## combat (Oct 15, 2012)

I do the following:
route add -net 192.168.3.1 192.168.2.1 

Thus gateway third subnet pinged. How to create a route on the entire third subnet?

This is my route table:

```
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            xxx.xxx.xxx.xxx    UGS       166  8827523    xl1
127.0.0.1          link#6             UH          0      261    lo0
192.168.2.0/24     gif0               US          0   119090   gif0
192.168.2.1        link#8             UH          0       47   gif0
192.168.3.1/32     192.168.2.1        UGS         0        2   gif0
192.168.1.0/24     link#1             U           3  7746052    xl0
192.168.1.1        link#1             UHS         1        0    lo0
xxx.xxx.xxx/30     link#2             U           0        0    xl1
xxx.xxx.xxx        link#2             UHS         0        0    lo0
```


----------



## mamalos (Oct 15, 2012)

`# route add -net 192.168.3.0/24 192.168.2.1`


----------

