Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Nova does not assign ip addresses to your interfaces; nova configures a DHCP server with information about assigned ip addresses, and then it is up to your instance to query the DHCP server and perform the necessary system configuration to apply the received address to an interface.

If you add an interface to your instance, you will probably need to take some manual steps in order to get the system to query the dhcp server for an address for that interface. For example, using the Cirros image, I can attach an interface from my net0 network:

$ nova interface-attach cirros net0

Inside the Cirros instance, I now have an eth1 device:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether fa:16:3e:17:60:9e brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.17/24 brd 10.0.0.255 scope global eth0
    inet6 fe80::f816:3eff:fe17:609e/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether fa:16:3e:57:18:fa brd ff:ff:ff:ff:ff:ff

But as you can see, there is no IP address, even though Nova has allocated one for the interface:

$ nova list
+-----...+--------+--------+------------+-------------+--------------------------------------------+
| ID  ...| Name   | Status | Task State | Power State | Networks                                   |
+-----...+--------+--------+------------+-------------+--------------------------------------------+
| 6d89...| cirros | ACTIVE | -          | Running     | net0=10.0.0.17, 10.0.0.18, 192.168.200.211 |
+-----...+--------+--------+------------+-------------+--------------------------------------------+

If I want to configure the system to bring this interface up automatically, I would add the following to my /etc/network/interfaces file:

auto eth1
iface eth1 inet dhcp

And then run:

ifup eth1

And now I can see an address associated with the new interface:

# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether fa:16:3e:17:60:9e brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.17/24 brd 10.0.0.255 scope global eth0
    inet6 fe80::f816:3eff:fe17:609e/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether fa:16:3e:57:18:fa brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.18/24 brd 10.0.0.255 scope global eth1
    inet6 fe80::f816:3eff:fe57:18fa/64 scope link 
       valid_lft forever preferred_lft forever

Nova does not assign ip addresses to your interfaces; nova configures a DHCP server with information about assigned ip addresses, and then it is up to your instance to query the DHCP server and perform the necessary system configuration to apply the received address to an interface.

If you add an interface to your instance, you will probably need to take some manual steps in order to get the system to query the dhcp server for an address for that interface. For example, using the Cirros image, I can attach an interface from my net0 network:

$ nova interface-attach cirros net0

Inside the Cirros instance, I now have an eth1 device:

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether fa:16:3e:17:60:9e brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.17/24 brd 10.0.0.255 scope global eth0
    inet6 fe80::f816:3eff:fe17:609e/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop qlen 1000
    link/ether fa:16:3e:57:18:fa brd ff:ff:ff:ff:ff:ff

But as you can see, there is no IP address, even though Nova has allocated one for the interface:

$ nova list
+-----...+--------+--------+------------+-------------+--------------------------------------------+
+-----...+-------------+--------------------------------------------+
| ID  ...| Name   | Status | Task State | Power State | Networks                                   |
+-----...+--------+--------+------------+-------------+--------------------------------------------+
+-----...+-------------+--------------------------------------------+
| 6d89...| cirros | ACTIVE | -          | Running     | net0=10.0.0.17, 10.0.0.18, 192.168.200.211 |
+-----...+--------+--------+------------+-------------+--------------------------------------------+
+-----...+-------------+--------------------------------------------+

If I want to configure the system to bring this interface up automatically, I would add the following to my /etc/network/interfaces file:

auto eth1
iface eth1 inet dhcp

And then run:

ifup eth1

And now I can see an address associated with the new interface:

# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether fa:16:3e:17:60:9e brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.17/24 brd 10.0.0.255 scope global eth0
    inet6 fe80::f816:3eff:fe17:609e/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether fa:16:3e:57:18:fa brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.18/24 brd 10.0.0.255 scope global eth1
    inet6 fe80::f816:3eff:fe57:18fa/64 scope link 
       valid_lft forever preferred_lft forever