Re: newbie question about NAT and bridging.



On Mon, 2008-09-08 at 16:26 -0700, David Moffatt wrote:
> Is there a good FAQ?  I need to find out about how to make bridging
> and/or NAT work with NM.

I'd like to add support for bridging in the near future to NM, if just
to help make virutalization a more pleasant experience.  That probably
means support for adding devices to a specified bridge or something like
that, since the bridge device itself doesn't have attributes that anyone
cares about.

> Specifically I want to find out
> 
> 1) Is there an easy way to figure out what the current interface is?

The D-Bus interface exports a list of ActiveConnection objects, a
property of which is "Devices", which is a list of the network devices
currently associated with the active connection.  Each ActiveConnection
also has a 'default' property, and the one that has 'default=True' is
the one you'll care about.  This is the preferred method, since in the
future more than one device might be associated with an active
connection.

Alternatively, you can ask for the list of devices and check whether
each device's state is NM_DEVICE_STATE_ACTIVATED, but that doesn't tell
you if it's the default device or not.

> 2) Are there any scripts run when an interface is brought up or down
> that I could use to change my NAT routing?

NM will run scripts in the /etc/NetworkManager/dispatcher.d directory
with two arguments (interface name, and "up"/"down").  The script's
environment will also contain various details about the IP4 and DHCP
configuration the device is using.

> 3) Does anyone know why the interface goes to lala land when it is
> controlled by NM and you attach and remove a software bridge from it?

That's interesting; I haven't heard that before but then I haven't tried
this specific configuration.

> 4) Are there any other hidden gotcha with NAT and NM?

There shouldn't be besides what would normally be encountered with a
configured device and bridging.  NM takes over the default route and
will of course bring the device up and take it down when the user tells
NM to, or when the cable is unplugged, but besides that you should be
able to use dispatcher scripts to get what you want done.

Dan



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