# FreeBSD 9, interface alias(es) not created



## DutchDaemon (Oct 19, 2011)

I'm trying to get some confirmation of a problem I've been having on two separate FreeBSD 9 machines, one i386, one amd64, where interface aliases configured in /etc/rc.conf are not actually created, using the legacy ifconfig_nic0_alias0 method.

Syntax of Machine 1:

```
ifconfig_em0="inet aa.bb.141.196 netmask 255.255.255.224 polling"
ifconfig_em0_alias0="aa.bb.141.205 netmask 255.255.255.255 polling"
```

Syntax of Machine 2:

```
ifconfig_re0="inet xx.yy.159.11 netmask 255.255.255.255 polling"
ifconfig_re0_alias0="192.168.1.170 netmask 255.255.255.0 polling"
```

This worked flawlessly in and before FreeBSD 8, and it fails in FreeBSD 9 consistently over at least two months (I rebuild world once/twice a month).

There are zero errors anywhere. The *dmesg -a* output shows that the interfaces get created normally -- the alias creation however is nowhere to be seen. Creating the alias by hand is never a problem.

Any ideas? Is this syntax on the way out and being replaced with the ipv4_addrs_nic0 syntax, and if so, can 'polling' be activated using that syntax too? I'd rather not have a combination of both to achieve the exact same result ..


----------



## DutchDaemon (Oct 19, 2011)

I have switched to:


```
ipv4_addrs_em0="aa.bb.141.196/27 aa.bb.141.205/32"
ifconfig_em0="polling"
```

This created the primary IP address and the alias correctly, and switches on polling, so at least I have a working alternative. Still: the ifconfig_nic0_alias0 syntax should not be broken at this point, and I wonder if others see the same behavior.


----------



## gkontos (Oct 19, 2011)

I am using a cloned loopback interface for my jails without any problems:


```
cloned_interfaces="lo1"
ifconfig_lo1="inet 192.168.30.1  netmask 255.255.255.0"
ifconfig_lo1_alias0="inet 192.168.30.10 netmask 255.255.255.255"
ifconfig_lo1_alias1="inet 192.168.30.11 netmask 255.255.255.255"
ifconfig_lo1_alias2="inet 192.168.30.12 netmask 255.255.255.255"
```

I haven't tried this to my main NIC though.
This is a development server running 9.0-RC1


----------



## DutchDaemon (Oct 19, 2011)

I see this behavior on 9.0-BETA3. Not sure which was the first version of FreeBSD 9 that showed this 'alias dementia'.


----------



## ecazamir (Oct 19, 2011)

I prefer the ipv4_addrs_ifname address setting method:
Sample /etc/rc.conf:

```
ifconfig_ifname="up"
ipv4_addrs_ifname="1.2.3.4/24 1.2.4.1/24 1.2.5.1/24"
```


----------



## DutchDaemon (Oct 19, 2011)

You don't need the "up". Assigning an IP address to an interface sets it to "up" automatically.


----------



## DutchDaemon (Oct 19, 2011)

Still interested to know if anyone else sees the 'failing alias' problem on a 'regular' interface on 9.0 (-BETA3 in my case).


----------



## gkontos (Oct 19, 2011)

I think your problem has to do with device polling. Perhaps a bug in the INTEL driver. 

Have you tried to remove the polling argument completely ?


----------



## phoenix (Oct 19, 2011)

Does it work if you remove the *polling* keywords from the *_aliasX=* line?  You don't need it there.

The polling option is set on the interface itself, not on the IP assigned to the interface.  So you only need to list it in the *ifconfig_nic0=* line.

That's the way I have it set on all my systems (well, actually it's *-polling* on all my systems to disable it) and there's been no issues.

Granted, I don't have any 9.x systems yet.


----------



## DutchDaemon (Oct 20, 2011)

Haven't tried, and can't imagine that would be something that got "fixed/broken" between 8 and 9, really .. AFAIK, the polling keyword corresponds with the ifconfig command it belongs to, whether it's in the primary or the alias IP setting, and so long as doing something like [cmd=]ifconfig nic0 polling[/cmd] does not result in an error when performed twice (it doesn't), this shouldn't really affect that part of the configuration. But programming doesn't always adhere to human logic, so I may give it a twirl tomorrow.

FTR, on my laptop (which doesn't have an alias, normally), this is no problem whatsoever:
[cmd=]ifconfig em0 alias 192.168.3.1 netmask 255.255.255.0 polling[/cmd]

As noted earlier, running the exact same ifconfig command as is configured in /etc/rc.conf on the command-line always works. So this would have to be a very specific (and particular) error in the rc system that does not trigger any visual error anywhere ..


----------



## ecazamir (Oct 20, 2011)

It's unusual to put 'polling' into an alias definition line. Your rc.conf line seems to be:

```
ifconfig_em0_alias0="aa.bb.141.205 netmask 255.255.255.255 polling"
```
Try 

```
ifconfig_em0_alias0="aa.bb.141.205 netmask 255.255.255.255"
```


----------



## DutchDaemon (Oct 20, 2011)

I had that suggestion two posts ago, and there is no real logic as to why it would fail (the 'polling' keyword works on 'ifconfig', and 'ifconfig' doesn't/shouldn't care what else is on that line), and esp. why it would fail in 9.x, not in < 9.x.


----------



## phoenix (Oct 20, 2011)

Time to enable rc debugging and look at the output?


----------



## DutchDaemon (Oct 21, 2011)

I guess. I just tried this with my 9.0-BETA3/amd64 laptop:


```
ifconfig_em0_alias0="inet 192.168.155.1 netmask 255.255.255.0 polling"
```

and it succeeded without a hitch. It has the same SVN revision number as the two servers where aliases are not created when defined in /etc/rc,conf. Maybe it has to do with something I put in (or left out of) the kernel, because I always build minimal and specific kernels for everything.

Anyway, I don't think this is of any wider interest. If it was a real problem it would have been all over the lists by now. So I'll take this in stride (have put ipv4_addrs_nic0 alternatives in place everywhere anyway) and move on.


----------



## DutchDaemon (Oct 21, 2011)

Just as an afterburner: had the same problem again on another machine, with these settings (so no polling anywhere):

```
ifconfig_fxp0="inet aaa.bbb.169.74  netmask 255.255.255.248"
ifconfig_fxp0_alias0="inet aaa.bbb.169.78 netmask 255.255.255.255"
```

Addition: this took place on *9.0-RC1*  as opposed to earlier *9.0-BETA3* reports.


----------



## wblock@ (Oct 21, 2011)

A PR wouldn't hurt.  Too many times, several people had a problem but each thought it was unique to them.


----------



## DutchDaemon (Oct 21, 2011)

Which is why I was inquiring in here 

It should eventually show up as PR 161885.


----------



## Pacifyer (Aug 30, 2012)

There is an error in your initial syntax. You miss the "inet " keyword in it. It was mentioned in FreeBSD9 docs that rc.conf ifconfig is now more strict in the syntax.

```
ifconfig_em0_alias0="[color="Red"]inet [/color]aa.bb.141.205 netmask 255.255.255.255 polling"
```


----------

