[ovs-discuss] problem when using DHCP on "internal interface" of openvswitch
Ben Pfaff
blp at nicira.com
Tue Nov 13 06:02:09 UTC 2012
I'd start by looking for the DHCP request and replies at eth0, using
tcpdump or wireshark.
On Tue, Nov 13, 2012 at 01:27:27PM +0800, liuxy wrote:
> Sorry to touble you, I have the same opinions, but In my experiment, the
> other internal interface can not get IP, Maybe there is something wrong,
> the whole infomations are like this:
>
> -----------------------------------------------------------------------------------------------------------------------------------
> root at liuxy506:~# ovs-vsctl show
> 2ca3442f-2f1e-48d6-9f6c-3bc6a3fcfa63
> Bridge "br0"
> Port "eth0"
> Interface "eth0"
> Port "vif0"
> Interface "vif0"
> type: internal
> Port "br0"
> Interface "br0"
> type: internal
> root at liuxy506:~#
> root at liuxy506:~# dhclient br0 -v
> Internet Systems Consortium DHCP Client 4.1-ESV-R4
> Copyright 2004-2011 Internet Systems Consortium.
> All rights reserved.
> For info, please visit https://www.isc.org/software/dhcp/
>
> Corrupt lease file - possible data loss!
> Listening on LPF/br0/08:00:27:b1:22:fb
> Sending on LPF/br0/08:00:27:b1:22:fb
> Sending on Socket/fallback
> DHCPREQUEST of 192.168.4.222 on br0 to 255.255.255.255 port 67
> DHCPREQUEST of 192.168.4.222 on br0 to 255.255.255.255 port 67
> DHCPACK of 192.168.4.222 from 192.168.4.221
> Rather than invoking init scripts through /etc/init.d, use the service(8)
> utility, e.g. service smbd reload
>
> Since the script you are attempting to invoke has been converted to an
> Upstart job, you may also use the reload(8) utility, e.g. reload smbd
> bound to 192.168.4.222 -- renewal in 271 seconds.
> root at liuxy506:~#
> root at liuxy506:~# dhclient vif0 -v
> Internet Systems Consortium DHCP Client 4.1-ESV-R4
> Copyright 2004-2011 Internet Systems Consortium.
> All rights reserved.
> For info, please visit https://www.isc.org/software/dhcp/
>
> Listening on LPF/vif0/de:b8:cb:5c:3b:20
> Sending on LPF/vif0/de:b8:cb:5c:3b:20
> Sending on Socket/fallback
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 3
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 4
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 7
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 11
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 10
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 19
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 17
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 14
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 7
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 11
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 19
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 11
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 11
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 7
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 14
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 16
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 13
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 15
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 7
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 9
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 9
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 12
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 8
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 13
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 20
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 12
> DHCPDISCOVER on vif0 to 255.255.255.255 port 67 interval 2
> No DHCPOFFERS received.
> No working leases in persistent database - sleeping.
> root at liuxy506:~#
> -----------------------------------------------------------------------------------------------------------------------------------
>
> could you help me to know where is wrong? thanks
>
>
>
> 2012/11/13 Ben Pfaff <blp at nicira.com>
>
> > There's nothing special about DHCP from Open vSwitch's point of view.
> > You should be able to use it in essentially the same situations where
> > assigning a static address works.
> >
> > On Tue, Nov 13, 2012 at 12:46:20PM +0800, liuxy wrote:
> > > thanks, I do it flowing the answer, and the br0 can get IP from DHCP,
> > but
> > > when there are more than one "internal" interfaces in the bridge br0,
> > can
> > > other interfaces get IP from DHCP? For example:
> > >
> > > ovs-vsctl add-br br0
> > > ovs-vsctl add-port br0 eth0
> > > ifconfig eth0 0.0.0.0
> > >
> > > after execute the command above , the interface "br0" can use DHCP to
> > get
> > > IP
> > >
> > > and then I add another "internal" interface to br0
> > >
> > > ovs-ovsctl add-port br0 vif0
> > >
> > > and now there are three interfaces in br0 : br0, eth0 and vif0, can
> > vif0
> > > use DHCP to get IP ????
> > >
> > > thanks a lot for help !!
> > >
> > > 2012/11/12 Ben Pfaff <blp at nicira.com>
> > >
> > > > On Mon, Nov 12, 2012 at 04:16:58PM +0800, liuxy wrote:
> > > > > I want to use DHCP on the "internal" network interface of ovs, but
> > it
> > > > > can't works. I can exactly set the static ip using "ifconfig", but
> > when
> > > > I
> > > > > use the "dhclient " to set DHCP on the interface, it fails, I am sure
> > > > > that the DHCP server works well ! the steps like this:
> > > >
> > > > This is a FAQ.
> > > >
> > > > Q: I created a bridge and added my Ethernet port to it, using commands
> > > > like these:
> > > >
> > > > ovs-vsctl add-br br0
> > > > ovs-vsctl add-port br0 eth0
> > > >
> > > > and as soon as I ran the "add-port" command I lost all connectivity
> > > > through eth0. Help!
> > > >
> > > > A: A physical Ethernet device that is part of an Open vSwitch bridge
> > > > should not have an IP address. If one does, then that IP address
> > > > will not be fully functional.
> > > >
> > > > You can restore functionality by moving the IP address to an Open
> > > > vSwitch "internal" device, such as the network device named after
> > > > the bridge itself. For example, assuming that eth0's IP address is
> > > > 192.168.128.5, you could run the commands below to fix up the
> > > > situation:
> > > >
> > > > ifconfig eth0 0.0.0.0
> > > > ifconfig br0 192.168.128.5
> > > >
> > > > (If your only connection to the machine running OVS is through the
> > > > IP address in question, then you would want to run all of these
> > > > commands on a single command line, or put them into a script.) If
> > > > there were any additional routes assigned to eth0, then you would
> > > > also want to use commands to adjust these routes to go through br0.
> > > >
> > > > If you use DHCP to obtain an IP address, then you should kill the
> > > > DHCP client that was listening on the physical Ethernet interface
> > > > (e.g. eth0) and start one listening on the internal interface
> > > > (e.g. br0). You might still need to manually clear the IP address
> > > > from the physical interface (e.g. with "ifconfig eth0 0.0.0.0").
> > > >
> > > > There is no compelling reason why Open vSwitch must work this way.
> > > > However, this is the way that the Linux kernel bridge module has
> > > > always worked, so it's a model that those accustomed to Linux
> > > > bridging are already used to. Also, the model that most people
> > > > expect is not implementable without kernel changes on all the
> > > > versions of Linux that Open vSwitch supports.
> > > >
> > > > By the way, this issue is not specific to physical Ethernet
> > > > devices. It applies to all network devices except Open vswitch
> > > > "internal" devices.
> > > >
> >
More information about the discuss
mailing list