# Trouble adding ip alias to interface

## hanj

So this is a weird problem. I've done this before on other boxes without any issues, but today I can't seem to make it work on this particular server. Might be lack of coffee.. not sure.

I'm trying to add an additional IP to my interface. I edit /etc/conf.d/net with the following:

```
config_eth0=(

        "xxx.xxx.xxx.38 netmask 255.255.255.0 brd xxx.xxx.xxx.255"

        "xxx.xxx.xxx.39 netmask 255.255.255.0 brd xxx.xxx.xxx.255"

)

routes_eth0=( "default gw xxx.xxx.xxx.1" )
```

.39 address is the new IP. When I restart /etc/init.d/net.eth0 all net related services are stopped, but when it gets to net.eth0 it hangs. rc-status shows [stopping] and nothing in the logs. I've tried a few different config styles (ie: "xxx.xxx.xxx.39/24", etc) all with the same result.

When I manually add the IP via ifconfig.. it sticks without a problem.

```
ifconfig eth0:1 xxx.xxx.xxx.39 broadcast xxx.xxx.xxx.255 netmask 255.255.255.0
```

```
eth0      Link encap:Ethernet  HWaddr 00:1f:d0:d7:93:6a

          inet addr:xxx.xxx.xxx.38  Bcast:xxx.xxx.xxx.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:41184185 errors:0 dropped:0 overruns:0 frame:0

          TX packets:28235094 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:1129451100 (1.0 GiB)  TX bytes:3336804084 (3.1 GiB)

          Interrupt:40 Base address:0x6000

eth0:1    Link encap:Ethernet  HWaddr 00:1f:d0:d7:93:6a

          inet addr:xxx.xxx.xxx.39  Bcast:xxx.xxx.xxx.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          Interrupt:40 Base address:0x6000
```

Any ideas why net.eth0 is hangling?

This is the device:

```
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)
```

This is my kernel/system:

```
 2.6.36-hardened-r9 #2 SMP Wed Mar 9 14:42:40 CST 2011 i686 Dual-Core AMD Opteron(tm) Processor 1210 AuthenticAMD GNU/Linux
```

UPDATE: I restored the net config file back to original (single IP) and it won't restart net.eth0 without hanging?

Thanks!

hanji

----------

## wswartzendruber

Are you on baselayout-2?  The network configuration syntax changed.  I can't promise it's the solution to your problem, though:

```
# Gigabit interface

config_eth0="10.0.0.11/24

             2001:470:1f05:1698::a"

routes_eth0="default via 10.0.0.1

             2001:470:1f05:1698::1"
```

----------

## hanj

 *wswartzendruber wrote:*   

> Are you on baselayout-2?  

 

Nope, using baselayout-1

```
[ebuild   R   ] sys-apps/baselayout-1.12.14-r1  USE="-bootstrap -build -static -unicode" 265 kB
```

Thanks!

hanji

----------

