Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Aug 2015 06:59:51 +0200
From:      "Herbert J. Skuhra" <herbert@oslo.ath.cx>
To:        Jim Long <list@museum.rain.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: rc.conf, ifconfig, VLANs and named interfaces
Message-ID:  <20150815045951.GA40785@oslo.ath.cx>
In-Reply-To: <20150814221855.GB71219@ns.umpquanet.com>
References:  <20150814221855.GB71219@ns.umpquanet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 14, 2015 at 03:18:56PM -0700, Jim Long wrote:
> 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?

Try:

vlans_em0="public"
create_args_public="vlan 4"
ifconfig_public="inet 10.0.1.10/24"

-- 
Herbert



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