Re: Using 2 interfaces with network manager



On Thu, 2010-09-23 at 02:07 +0300, Uwe Geuder wrote:
> Hi!
> 
> I've never understood how network manager works if more than
> 1 network interface is in use. Is it designed for such usage at all?

Yes, it is.

> What I want to do:
> 
> - use wlan0 to connect to the internet using network manager. Access
>   points might change from time to time, e.g. when travelling.
> 
> - use eth0 for internet connection sharing (ICS). (using a cross connected
>   Ethernet cable to provide an Internet connection to another device)
>   I don't think network manager can do it, but I'm comfortable to do
>   it manually (interface definition, IP forwarding and NAT)
> 
> So I configure eth0 in /etc/network/interfaces as
> 
> auto eth0
> iface eth0 inet static
>   address 192.168.77.1
>   netmask ...
>   ...

It doesn't appear that the ifupdown plugin supports 'shared'
connections, which is what you're trying to do here with eth0.  When you
create a "shared" connection in NM, NM itself will run dnsmasq in
forwarding DNS mode, and will also start a DHCP server on that interface
to provide addressing services to other computers on that interface.
You don't need to set up anything manually for ICS with NM.

> The other parts are not relevant for the discussion here.
> 
> Ideally I want to leave this definition there, whether I use the ICS
> at the moment or not. (I don't think I have the need or even
> possibility to connect to a wired network)

So in this case, you could have *two* connections.  Your normal static
one, and a second ICS one that NM manages.  Becuase the ifupdown plugin
does not appear to support NM ICS/"shared" connections yet, you'll need
to use the 'keyfile' plugin for the shared connection.

> 
> This works without problems in Kubuntu Lucid (nm 0.8.0) with 
> knetworkmanager.

This likely works because the 'shared' connection is probably a
user-session connection, which supports all connection types including
'shared' ones.

> However, in Ubuntu Lucid and Xubuntu Lucid (same nm version), which
> both use nm-applet instead of knetworkmanager there is a nasty
> problem. It works as long a previously defined WLAN is in
> range. But whenever no previously defined WLAN is in range,
> nm-applet is completely invisible. The "not connected" icon is just
> not there. And without having nm-applet visible I cannot really use
> any network.

Yeah, this is interesting.  At least in GNOME (and expected for
nm-applet generally) is that it is shown whenever its running.  I've
added code to nm-applet 0.8.2 that logs when the applet is shown by GTK
and when it's not to debug this very issue.  It's pretty hard to debug
otherwise because the interaction of the notification area applets is
hard to debug with nm-applet.  I think we've done just about everything
we can do in nm-applet itself to protect against this, and the logging
in NM 0.8.2 will finally allow us to figure out where to point the
blame.

> Well, I could scan for WLANs from the commandline, start
> nm-connection-editor from the command line and define the network. But
> then I have still to log out (or even reboot?) What i currently do is
> to edit /etc/network/interfaces each time I want to connect to a new
> WLAN.  I remove eth0 from there and reboot (at least I have not found
> any way without rebooting. Just shutting eth0 down does not help.)
> After having defined the new WLAN using nm-applet I can revert the
> changes in /etc/network/interfaces.
> 
> Needless to say, that's not really pain free networking.
> 
> Is there any better solution? Is it a bug or feature that nm-applet
> gets completely invisible?

No, it shouldn't be.  It should be shown whenever it is running and
whenever NetworkManager itself is running.

How it should work: whenever the cable is plugged in, NetworkManager
will bring up the "shared" connection and wait for a main internet
connection.  The main internet connection may shift around depending on
where you're at, but that shouldn't matter.  The integrated NAT support
that NM provides should allow seamless switches between wifi networks
while ICS clients are connected.

Dan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]