LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices

Reply
 
LinkBack Search this Thread
Old 08-16-2010, 09:16 PM   #16
sfxpt
Member
 
Registered: Feb 2008
Distribution: Debian Testing
Posts: 99
Blog Entries: 3

Original Poster
Rep: Reputation: 16

Quote:
Originally Posted by Chuck56 View Post
What other apps do you use that would manipulate the eth0 interface like that?
The problem is, I don't know, I have to test one by one. That's the most scary part.
 
Old 08-16-2010, 09:27 PM   #17
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado
Distribution: Slackware
Posts: 418

Rep: Reputation: 58
A bridge is a Layer 2 device, routes by MAC address before IP even comes into play. Both the tap and eth0 have to be bound to the bridge before you assign an IP address to the bridge. Post #9 in this thread gives you the commands for a fixed IP, just replace the last 2 lines with your normal DHCP command if you want a dynamic IP.
 
1 members found this post helpful.
Old 08-17-2010, 08:08 AM   #18
HasC
Member
 
Registered: Oct 2009
Location: South America - Paraguay
Distribution: Debian 5 - Slackware 13.1 - Arch - Some others linuxes/*BSDs through KVM and Xen
Posts: 329

Rep: Reputation: 55
perhaps you should consider reading this. Old, but still good info.

for now, I will give you some snippets from the HOWTO, for correctness

Quote:
On seeing this, I now realized that although eth0 doesn't have an IP any more with such setting, it is still *bind* to the bridge device, and I can still use eth0 the same way as before. From the application using eth0 prospective, nothing is changed, right?
Not true, actually. The right way to say it is "eth0 is *enslaved* to bridge". And when your ethX is enslaved, you _lose control over it_, you _cannot use it directly_ anymore. You should set up the bridge instead
Code:
 ifconfig bridge0 192.168.0.1 up
and put the _enslaved_ ethX up in promiscuous mode (that's the only thing you can do with the enslaved interfaces)
Code:
 ifconfig ethX promisc up
or
Code:
 ifconfig ethX 0.0.0.0 promisc up
Both commands give the same result.
That's the same procedure you should use with TAP interfaces.

Quote:
- leave my physical interface eth0 as is, and only bring up the KVM
bridge device if I am using KVM.

The actual reason behind why I chose the above approach is that I still want my eth0 to be eth0, instead of need to use br0 for all my network applications.
It will be easier to use the bridge instead of ethX, just like the HOWTO says.
Or you could rename the interface eth0 to peth0 and the bridge0 to eth0, as Xen does. But that's harder to achieve.

Quote:
- I can't ping outside my local network
- I tried to setup /etc/resolv.conf but dns look up still fails
- DHCP request still fails
These problems may not necessarily be related to the configuration of the bridge. If you can ping from your VM to any host on your LAN, then the bridge is working, and that's a start.

Last edited by HasC; 08-17-2010 at 08:11 AM.
 
1 members found this post helpful.
Old 08-17-2010, 04:19 PM   #19
sfxpt
Member
 
Registered: Feb 2008
Distribution: Debian Testing
Posts: 99
Blog Entries: 3

Original Poster
Rep: Reputation: 16
Thanks everyone for the reply.

I tried this first:

Quote:
Originally Posted by Chuck56 View Post
Post #9 in this thread gives you the commands for a fixed IP, just replace the last 2 lines with your normal DHCP command if you want a dynamic IP.
I made a big progress, at least everthing in the VM is working fine now. However, my host network is not working any more:

Code:
% ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:1f:16:a4:d0:8c  
          inet addr:192.168.0.108  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16888 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12404 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:24617836 (23.4 MiB)  TX bytes:921398 (899.8 KiB)
          Interrupt:16 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:100 (100.0 B)  TX bytes:100 (100.0 B)


% ip addr flush eth0

% ifconfig eth0 0.0.0.0

% 

% brctl addbr br0

% brctl addif br0 eth0

% tunctl -t tap0 -g kvm
Set 'tap0' persistent and owned by gid 103

% ifconfig tap0 0.0.0.0

% brctl addif br0 tap0

% ifconfig br0 192.168.0.108 netmask 255.255.255.0

% route add default gw 192.168.0.1 metric 1

% ifconfig 
br0       Link encap:Ethernet  HWaddr 00:1f:16:a4:d0:8c  
          inet addr:192.168.0.108  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:1f:16:a4:d0:8c  
          inet addr:192.168.0.108  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:44 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:13859 (13.5 KiB)  TX bytes:294 (294.0 B)
          Interrupt:16 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:200 (200.0 B)  TX bytes:200 (200.0 B)

tap0      Link encap:Ethernet  HWaddr 82:db:ab:b5:cb:a3  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:24:2c:84:06:09  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wmaster0  Link encap:UNSPEC  HWaddr 00-24-2C-84-06-09-00-00-00-00-00-00-00-00-00-00  
          UP RUNNING  MTU:0  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

kvm -m 1024 -smp 2 -net nic,macaddr=52:54:00:39:81:49 -net tap,ifname=tap0,script=no,downscript=no

% route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 br0
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0
default         192.168.0.1     0.0.0.0         UG    1      0        0 eth0

$ ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.0.108 icmp_seq=1 Destination Host Unreachable
From 192.168.0.108 icmp_seq=2 Destination Host Unreachable
From 192.168.0.108 icmp_seq=3 Destination Host Unreachable
From 192.168.0.108 icmp_seq=4 Destination Host Unreachable
From 192.168.0.108 icmp_seq=5 Destination Host Unreachable
From 192.168.0.108 icmp_seq=6 Destination Host Unreachable
^C
--- 192.168.0.1 ping statistics ---
8 packets transmitted, 0 received, +6 errors, 100% packet loss, time 7020ms
Anything went wrong here? (I see 2 default in route, but don't know how to fix it).

PS. is it possible to revert from this? When my host network is not working, the only solution I have is to reboot.

please help.
thanks!
 
Old 08-17-2010, 04:50 PM   #20
Chuck56
Member
 
Registered: Dec 2006
Location: Colorado
Distribution: Slackware
Posts: 418

Rep: Reputation: 58
You can't have an ip address assigned to eth0 when your using a bridge. The ifconfig shows eth0 with an ip address after the commands. Are you running something that manages eth0 an reinvokes dhcp? Something like wicd?
 
1 members found this post helpful.
Old 08-18-2010, 09:18 AM   #21
sfxpt
Member
 
Registered: Feb 2008
Distribution: Debian Testing
Posts: 99
Blog Entries: 3

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by Chuck56 View Post
You can't have an ip address assigned to eth0 when your using a bridge. . . Are you running something that manages eth0 an reinvokes dhcp?
BINGO!

I know that I can't have an ip address assigned to eth0 when using a bridge, but I didn't make the connection why it is still yet even after I zeroed it and my running pump. . .

Having killed my pump everything worked fine now. Will conclude in next post.

Thanks everyone who helped. Chuck56, you helped me from the start to the end, answered my every question! HasC, thanks for your replies and the useful bridge link!

Thanks again. Will contributing back by concluding in next post.

Last edited by sfxpt; 08-18-2010 at 10:52 AM.
 
Old 08-18-2010, 09:31 AM   #22
sfxpt
Member
 
Registered: Feb 2008
Distribution: Debian Testing
Posts: 99
Blog Entries: 3

Original Poster
Rep: Reputation: 16
[Conclusion] Using KVM public bridge manually

Setting up KVM public bridge manually is actually quite easy

: : :
EDIT: content removed to avoid duplicated modification. please check out
manually setup KVM public bridge
instead.
: : :

That's it.

The guests will run on the same subnet as host, having the same route and DNS server.

Last edited by sfxpt; 08-18-2010 at 11:03 AM.
 
  


Reply

Tags
bridge, kvm, network, public


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
kvm wireless bridge network shogun1234 Debian 5 08-13-2012 03:01 PM
kvm bridge on cent os question riegersteve Linux - Virtualization and Cloud 1 07-14-2010 01:43 PM
Kvm using wireless bridge, how michaelux Linux - Virtualization and Cloud 1 06-07-2010 08:48 AM
KVM on Centos 5.4 - bridge issue on virtual interfaces asmar Linux - Networking 1 03-01-2010 11:11 PM
Does anyone have a Xen bridge installed to connect a public IP VM to a private IP VM? abefroman Linux - Software 1 09-03-2008 02:51 AM


All times are GMT -5. The time now is 07:41 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration