# NetworkManager.service

This service is integrated with the [nmcli](https://jarrettgxz-sec.gitbook.io/networking-concepts/networking-tools/configuration-and-information/nmcli) tool.

Configuration file: `/etc/NetworkManager/NetworkManager.conf`.

The following `/etc/NetworkManager/NetworkManager.conf` file is retrieved from a Kali Linux machine:

```bash
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

```

### `ifupdown` section

> This section contains ifupdown-specific options and thus only has effect when using the `ifupdown` plugin.

| `managed` | <p>If set to <code>true</code>, then interfaces listed in <code>/etc/network/interfaces</code> are managed by NetworkManager. If set to <code>false</code>, then any interface listed in <code>/etc/network/interfaces</code> will be ignored by NetworkManager. Remember that NetworkManager controls the default route, so because the interface is ignored, NetworkManager may assign the default route to some other interface.</p><p>The default value is <code>false</code>.</p> |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

{% embed url="https://networkmanager.pages.freedesktop.org/NetworkManager/NetworkManager/NetworkManager.conf.html" %}

### Example configuration for a Debian-based machine

Given that we have a Linux machine with an `eth0` interface, and the following values in the respective configuration files:

**`/etc/network/interfaces`**

```bash
source /etc/network/interfaces.d/*

#The loopback network interface
auto lo
iface lo inet loopback
```

**`/etc/NetworkManager/NetworkManager.conf`**&#x20;

```bash
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false
```

Since the `managed` field is set to _false_, **NetworkManager** will ignore the interfaces listed in /etc/network/interfaces. In this case, the `lo` interface will be ignored. &#x20;

> NOTE: If we were to include the `eth0` interface in `/etc/network/interfaces`, NetworkManager will ignore it, and our machine will not be able to configure that interface:

```bash
# wrong configuration
iface eth0 inet dhcp
```

**We can use the** [**nmcli**](https://jarrettgxz-sec.gitbook.io/networking-concepts/networking-tools/configuration-and-information/nmcli) **tool to view the status:**

```bash
$ nmcli device status
DEVICE          TYPE       STATE                   CONNECTION         
eth0            ethernet   connected               Wired connection 1   
lo              loopback   connected (externally)  lo      
```

As a result, NetworkManager will automatically configure DHCP and DNS for our machine. To view DHCP and DNS configurations respectively:

**DHCP**:

```bash
$ ifconfig
# notice the inet field 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.22.6  netmask 255.255.255.0  broadcast 10.0.22.255
        ...

```

**DNS**:

```bash
$ cat /etc/resolv.conf
# Generated by NetworkManager
nameserver [configured_nameserver_addr] # will usually be the router gateway or VPN DNS server

```
