having 2 ip's on a debian 7 box

Posted by David on Server Fault See other posts from Server Fault or by David
Published on 2012-12-02T15:05:19Z Indexed on 2012/12/02 17:06 UTC
Read the original article Hit count: 221

Filed under:
|
|

I just installed Debian Wheezy on my homeserver. I want to assign 2 ip's to it on the same network interface, 1 static ip (eth0) and 1 dynamic ip (eth0:1). I know it doesn't make much sense but I need it to test something.

I edited my /etc/network/interfaces to be like this:

auto lo eth0 eth0:1
iface lo inet loopback

iface eth0 inet static
     address 192.168.178.240
     network 192.168.178.0
     netmask 255.255.255.0
     broadcast 192.168.178.255
     gateway 192.168.178.1


iface eth0:1 inet dhcp

when I bring up eth0:1 (ifup eth0:1) I get the following error (eth0 works fine)

Bind socket to interface: No such device

Failed to bring up eth0:1.

is it even possible to have a dynamic and static ip on the same network adapter?

© Server Fault or respective owner

Related posts about linux

Related posts about networking