Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Ubuntu 10.04 server with 2 public static addresses. There is a KVM guest (also Ubuntu) installed and running. What i want is to give the guest an IP of the host, so that both machines have public IPs.

When i create a bridge for the guest, add interfaces to the bridge then the host loses connectivity but the guest begins to be able to ping from outside.

What should i do to have connection for host and guest ?

This is network conf:

# ifconfig -a
br0       Link encap:Ethernet  Hardware Adresse ee:29:4b:xx:xx:xx  
          BROADCAST MULTICAST  MTU:1500  Metrik:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  Hardware Adresse 00:1a:4b:xx:xx:xx  
          inet Adresse:abc.def.xyz.100  Bcast:129.206.218.255  Maske:255.255.255.0
          inet6-Adresse: fe80::21a:4bff:fe46:eca4/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX packets:16101 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13577 errors:0 dropped:0 overruns:0 carrier:0
          Kollisionen:0 Sendewarteschlangenlänge:1000 
          RX bytes:6470077 (6.4 MB)  TX bytes:2058971 (2.0 MB)
          Interrupt:19 

eth0:0    Link encap:Ethernet  Hardware Adresse 00:1a:4b:46:ec:a4  
          inet Adresse:abc.def.xyz.101  Bcast:129.206.218.255  Maske:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          Interrupt:19

# route
Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
abc.def.xyz.0   *               255.255.255.0   U     0      0        0 eth0
link-local      *               255.255.0.0     U     1000   0        0 eth0
default         abc.def.xyz.1   0.0.0.0         UG    100    0        0 eth0

# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.000000000000       no              eth0
                                                        vnet0

There is no firewall enabled and DNS is configured properly.

What I want to achieve:

     |                         |            
+----+-------------------------+--------+
|    |          Host           |        |   
|    |                         |        |   
|    |            +------------+------+ |
|  eth0           |          eth0:0   | | 
|  x.x.x.100      |                   | |          
|                 |                   | |          
|                 |  br0     vnet0    | | 
|                 +------------+------+ |
|                              |        |   
|                              |        |   
|                 +------------+------+ |
|                 |            |      | |   
|                 |       eth0-+      | |
|                 |       x.x.x.101   | |
|                 |                   | |          
|                 |       Guest       | |
|                 +-------------------+ |
+---------------------------------------+
share|improve this question
    
why do you want to use an alias interface ? these are obsolete since iproute2, and have various quirks that may cause problems in this case. –  b0fh Aug 7 '10 at 23:12
    
Since i have only one interface and 2 IP addresses, i thought it is the proper way to assign multiple IP addresses. Various guides from debian and ubuntu also say so. If you know a better way, please elaborate. –  Lamnk Aug 13 '10 at 13:14

1 Answer 1

up vote 2 down vote accepted

I'm not sure if it's required, but this works for me:

  • eth0-on-the-host: no ip on host, added to bridge
  • vnet0: no ip on host, added to bridge
  • bridge: ip of the host
  • eth0-in-the-guest: ip of the guest

Note that most documentation suggests bringing the physical interface up with ip 0.0.0.0 after attaching it to the bridge.

share|improve this answer
    
Thanks, it worked. I tried your solution before but I was stuck adding gateway with this command "route add default gw xxx". It should be "route add default gw xxx dev br0". –  Lamnk Aug 13 '10 at 13:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.