e1000 + vlan = connection lost after ifconfig + vlanid + vlandev

Rudolph Sand r.sand at new-net.net
Tue Nov 23 02:36:02 UTC 2010


Hi, I noticed that *something has changed* regarding vlan creation since 8.0-rel and 7.1-rel, compared to 8.1-rel / 7-stable

When creating a vlan under 8.1-rel (csup'ed the sources yesterday), the box looses all connectivity

I'm using the following cards:
em0 at pci0:1:0:0:	class=0x020000 card=0x10d315d9 chip=0x10d38086 rev=0x00 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'Intel 82574L Gigabit Ethernet Controller (82574L)'

I was used to create my vlan with the following (works on 8.0 and 7.1):
	ifconfig vlan0 create
	ifconfig vlan0 10.0.0.1 netmask 255.0.0.0 vlan 1234 vlandev em0
	<connectivity lost>

Now I don't have the proper knowledge to say *what* changed and *why*, but I did manage to find a possible fix (with a little inspiration, thanks Darius)

At some point, I realized the kernel wasn't panic'ing, since my 'sleep 200 && reboot &' command, issued before the ifconfig, was executed, and the box was indeed rebooting after 200 secs

... Bottom line, is we realized a simple "ifconfig em0 down" than "ifconfig em0 up" would fix the issue !

So i made a simple script for /usr/local/etc/rc.d/000.vlan.sh enclosed below

I'm still wondering if there isn't a cleaner way to do this via rc.conf ...

But at least, it's a working fix-of-the-poor

Home this can still help someone

Ps: sorry if this is the wrong place to post this info, that's my very first humble contribution

Rud.



000.vlan.sh :
-----
#!/bin/sh

ip=10.0.0.1
mask=255.0.0.0
vlanid=1234
vlandev=vlan0
cloneddevice=em0

case $1 in
       start)
               log=/var/log/vlan.log
               touch $log
               ifconfig $vlandev create >> $log
               ifconfig $vlandev $ip netmask $mask vlan $vlanid vlandev $cloneddevice >> $log
               ifconfig $cloneddevice down >> $log                                    
               ifconfig $cloneddevice up >> $log                                      
# for debug ...
# mv /usr/local/etc/rc.d/000.vlan.sh /root/000.vlan.sh && sleep 800 && reboot &                                        
       ;;                                                                   
       stop)                                                                
       ;;                                                                   
esac  



More information about the freebsd-stable mailing list