-   Linux - Networking (
-   -   /etc/network/interfaces configuration for virtual interfaces (

nonshatter 10-25-2010 05:39 AM

/etc/network/interfaces configuration for virtual interfaces

I've just been trying to create a virtual address on the same interface.

I need one static address for the internet, and another (virtual) static IP for mysql server running on

Here is my /etc/network/interfaces configuration:

auto lo
iface lo inet loopback
auto eth0 eth0:0

iface eth0 inet static
iface eth0:0 inet static

eth0 seems fine, but eth0:0 doesn't come up when the networking is restarted. I get "SIOCSIFFLAGS: Cannot assign requested address" and "Failed to bring up eth0:0"

Any ideas what's wrong here?

Many thanks

prayag_pjs 10-25-2010 06:53 AM

Try this command and see if it works:


sudo ifconfig eth0:0  up

nonshatter 10-25-2010 07:02 AM

Hi thanks for the reply, Here's the response I get


# sudo ifconfig eth0:0 up
SIOCSIFADDR: File exists
SIOCSIFFLAGS: Cannot assign requested address
SIOCSIFFLAGS: Cannot assign requested address

I can't see a problem with my interfaces configuration, and can't seem to narrow down where the issue resides. Are there any other config files that I could check?

I've also tried this:

# ip addr sh eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 100
    link/ether 00:25:90:0a:96:7c brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet brd scope global eth0
    inet6 fe80::225:90ff:fe0a:967c/64 scope link
      valid_lft forever preferred_lft forever

and the mysql address is there, but it still won't let me connect :s

prayag_pjs 10-25-2010 07:15 AM

and what about


sudo ifconfig eth0:0 up


sudo ifconfig eth0:1 up

nonshatter 10-25-2010 07:22 AM

Okay, I've solved the problem. The configuration was all okay. Why it wouldn't let me assign the address under /interfaces was because the address already existed under the kernels routing table.

MySQL was refusing the connection because /etc/mysql/my.cnf was only listening to connections from localhost.


bind-address =
was changed to listen to the virtual interface. I restarted mysql and hey presto, it works!

All times are GMT -5. The time now is 07:42 PM.