# vlan ip lost after netif restart



## romeor (May 10, 2011)

Hi,
Got in situation, when I get my vlans lose their IP addreses after I execute the [cmd=]/etc/rc.d/netif restart && /etc/rc.d/routing restart[/cmd] command. I've got some vlans configured in /etc/rc.conf.


```
ifconfig_igb0="up"
cloned_interfaces="vlan5 vlan20 vlan25 vlan1110"
ifconfig_vlan5="inet 10.128.50.1 netmask 255.255.255.0 vlan 5 vlandev igb0"
ifconfig_vlan1110="inet 192.168.250.1 netmask 255.255.255.0 vlan 1110 vlandev igb0"
ifconfig_vlan20="inet 192.168.251.1 netmask 255.255.255.0 vlan 20 vlandev igb0"
ifconfig_vlan25="inet 192.168.255.253 netmask 255.255.255.252 vlan 25 vlandev igb0"
```

after the netif restart all of them are loosing their IP addresses:


```
igb0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=1bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4>
        ether 98:4b:e1:64:25:06
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
vlan5: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3<RXCSUM,TXCSUM>
        ether 98:4b:e1:64:25:06
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        vlan: 5 parent interface: igb0
vlan20: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3<RXCSUM,TXCSUM>
        ether 98:4b:e1:64:25:06
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        vlan: 20 parent interface: igb0
vlan25: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3<RXCSUM,TXCSUM>
        ether 98:4b:e1:64:25:06
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        vlan: 25 parent interface: igb0
vlan1110: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=3<RXCSUM,TXCSUM>
        ether 98:4b:e1:64:25:06
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        vlan: 1110 parent interface: igb0
```

Any ideas to solve this?

UPD:

```
ifconfig: create: bad value
ifconfig: create: bad value
ifconfig: create: bad value
ifconfig: create: bad value
ifconfig: SIOCSETVLAN: Device busy
ifconfig: SIOCSETVLAN: Device busy
ifconfig: SIOCSETVLAN: Device busy
ifconfig: SIOCSETVLAN: Device busy
```

Seems, like the netif script doesn't destroy the vlan interfaces before revoking them. If I destroy vlans manually and then revoke the netif script, it creates those vlans.

Any patch somewhere there? 

UPD:
as a simple workaround one could use this line (or create simple sh script)
[CMD=]/etc/rc.d/netif restart && /etc/rc.d/netif clonedown && /etc/rc.d/netif cloneup && /etc/rc.d/routing restart[/CMD]


----------



## quintessence (May 11, 2011)

Hello,

If you're using a new release of FreeBSD you should use the "new way" of setting vlans during boot. You can take a look at rc.conf(5) or /etc/defaults/rc.conf for examples.


```
vlans_age0="5 6 7"
ifconfig_age0_5="inet 10.6.6.5/24"
ifconfig_age0_6="inet 10.7.7.5/24"
ifconfig_age0_7="inet 10.8.8.5/24"
```


```
age0.5: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1e:8c:80:fa:22
        inet 10.6.6.5 netmask 0xffffff00 broadcast 10.6.6.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 5 parent interface: age0
age0.6: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1e:8c:80:fa:22
        inet 10.7.7.5 netmask 0xffffff00 broadcast 10.7.7.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 6 parent interface: age0
age0.7: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1e:8c:80:fa:22
        inet 10.8.8.5 netmask 0xffffff00 broadcast 10.8.8.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 7 parent interface: age0
```


```
vlans_age0="vlan8 vlan9 vlan10"
create_args_vlan8="vlan 8 inet 10.9.9.5/24"
create_args_vlan9="vlan 9 inet 10.10.10.5/24"
create_args_vlan10="vlan 10 inet 10.11.11.5/24"
```


```
vlan8: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1e:8c:80:fa:22
        inet 10.9.9.5 netmask 0xffffff00 broadcast 10.9.9.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 8 parent interface: age0
vlan9: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1e:8c:80:fa:22
        inet 10.10.10.5 netmask 0xffffff00 broadcast 10.10.10.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 9 parent interface: age0
vlan10: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1e:8c:80:fa:22
        inet 10.11.11.5 netmask 0xffffff00 broadcast 10.11.11.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
        vlan: 10 parent interface: age0
```


----------



## romeor (May 11, 2011)

Thank you, quintessence, very much. This way it works fine.


----------



## romeor (May 11, 2011)

How do I mark this thread as solved?


----------



## SirDice (May 11, 2011)

romeor said:
			
		

> how do i mark this thread as solved?



Edit the first post of the thread, click on "Go Advanced". There you can set the the thread to "Solved". It's right next to the thread's title.


----------

