Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Aug 2015 15:18:56 -0700
From:      Jim Long <list@museum.rain.com>
To:        freebsd-questions@freebsd.org
Subject:   rc.conf, ifconfig, VLANs and named interfaces
Message-ID:  <20150814221855.GB71219@ns.umpquanet.com>

next in thread | raw e-mail | index | archive | help
I am trying to figure out what to put into my rc.conf to yield the following
configuration:

# ifconfig public
public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1a:6b:35:05:9a
        inet 10.0.1.10 netmask 0xffffff00 broadcast 10.0.1.255
        media: Ethernet autoselect
        status: no carrier
        vlan: 4 parent interface: em0

If I use these rc.conf entries:

# head -6 /etc/rc.conf
hostname="host.example.com"
IP="10.0.0.10/24"

vlans_em0='4'
ifconfig_em0="inet $IP"
ifconfig_em0_4='inet 10.0.1.10/24'

I get:

t60 : 20:18:37 /root# ifconfig em0.4
em0.4: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1a:6b:35:05:9a
        inet 10.0.1.10 netmask 0xffffff00 broadcast 10.0.1.255
        media: Ethernet autoselect
        status: no carrier
        vlan: 4 parent interface: em0

That's very close!  Now I just need /etc/rc.d/netif to rename the interface.
But the interface name has a dot in it.  I'm going to guess that if I replace
that dot with an underscore, rc.conf and netif will know what I mean.

Unfortunately,

# head -8 /etc/rc.conf
hostname="host.example.com"
IP="10.0.0.10/24"

vlans_em0='4'
ifconfig_em0="inet $IP"
ifconfig_em0_4='inet 10.0.1.10/24'

ifconfig_em0_4_name='public'

Yields no 'public' interface:

# ifconfig -l
em0 wpi0 lo0 em0.4 wlan0
# ifconfig em0.4
em0.4: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1a:6b:35:05:9a
        inet 10.0.1.10 netmask 0xffffff00 broadcast 10.0.1.255
        media: Ethernet autoselect
        status: no carrier
        vlan: 4 parent interface: em0

The renaming doesn't happen.  Manually renaming the interface DOES work, so I
know it's possible:

# ifconfig -l
em0 wpi0 lo0 em0.4 wlan0
# ifconfig em0.4 name public
# ifconfig -l
em0 wpi0 lo0 public wlan0
# ifconfig public
public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:1a:6b:35:05:9a
        inet 10.0.1.10 netmask 0xffffff00 broadcast 10.0.1.255
        media: Ethernet autoselect
        status: no carrier
        vlan: 4 parent interface: em0

But how can I get netif to do it automatically, so that I can boot up with a
named, vlan-tagged interface?

Thanks!

Jim





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150814221855.GB71219>