rc.conf, ifconfig, VLANs and named interfaces
Herbert J. Skuhra
herbert at oslo.ath.cx
Sat Aug 15 05:00:04 UTC 2015
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
More information about the freebsd-questions
mailing list