# How to add IPs Alias in more Network Card?



## raffo (Oct 31, 2009)

Hello all,

I don't know why i can't add my IP Fail-Over by Alias on FreeBSD.

This is the routing:
94.23.73.101 routung on 87.98.222.131
94.23.159.44 routing on 87.98.222.131
94.23.73.41 routing on 87.98.223.131
94.23.73.42 routing on 87.98.223.131

em0:87.98.222.131
em1:87.98.223.131

I open /etc/rc.conf

And i have edit:

```
ifconfig_em0="inet 87.98.222.131 netmask 255.255.255.0 broadcast 87.98.222.255"
defaultrouter="87.98.222.254"
ifconfig_em1="inet 87.98.223.131 netmask 255.255.255.0 broadcast 87.98.223.255"
ifconfig_em0_alias1="inet 94.23.73.101 netmask 255.255.255.255"
ifconfig_em0_alias2="inet 94.23.159.44 netmask 255.255.255.255"
ifconfig_em1_alias1="inet 94.23.73.41 netmask 255.255.255.255"
ifconfig_em1_alias2="inet 94.23.73.42 netmask 255.255.255.255"
```
*I have slso try to set alias1,2,3,4.. but nothing to do.

When i reboot the ip alias are not configured.

How i can solve?

Thankyou.


----------



## crsd (Oct 31, 2009)

Alias numbers start from 0 and must be continuous.


----------



## raffo (Oct 31, 2009)

crsd said:
			
		

> Alias numbers start from 0 and must be continuous.



Thankyou for reply.

So is that sequence?

```
ifconfig_em0_alias0="inet 94.23.73.101 netmask 255.255.255.255"
ifconfig_em0_alias1="inet 94.23.159.44 netmask 255.255.255.255"
ifconfig_em1_alias2="inet 94.23.73.41 netmask 255.255.255.255"
ifconfig_em1_alias3="inet 94.23.73.42 netmask 255.255.255.255"
```
Or that one?

```
ifconfig_em0_alias0="inet 94.23.73.101 netmask 255.255.255.255"
ifconfig_em0_alias1="inet 94.23.159.44 netmask 255.255.255.255"
ifconfig_em1_alias0="inet 94.23.73.41 netmask 255.255.255.255"
ifconfig_em1_alias1="inet 94.23.73.42 netmask 255.255.255.255"
```


----------



## robbak (Oct 31, 2009)

The latter.


----------



## Ole (Oct 31, 2009)

Other way:

```
ifconfig_em0="up" //misc flags for interface like tso, rxcsum etc..
ifconfig_em1="up"  

ipv4_addrs_em0="87.98.222.131/24 94.23.73.101/32 94.23.73.41/32"
ipv4_addrs_em1="87.98.223.131/24 94.23.73.41/32 94.23.159.42/32"
```


----------



## raffo (Oct 31, 2009)

Thankyou robbak! 
Working fine now


----------

