# Static IP with NetworkManager?

## The_Great_Sephiroth

How the heck do you set a static IP for a system using NetworkManager? I am stumped here and have wasted an hour trying. I need NM for VPN and such, so the service has to start, but how do I tell it to assign a static address to my system on boot? I should have had this system up before 0900 and I am starting to pull out what little hair I have left!

----------

## nlsa8z6zoz7lyih3ap

Instead of using networkamanager, can you achieve your goal by assigning the desired address in your router to your PC's MAC address?

This is the approach that I use.

----------

## Fitzcarraldo

Here is how I do it in KDE 4 using the plasma-nm GUI, but the process will be similar if you are using nm-applet (or, if you prefer, nmtui in a Terminal or Konsole window or in a VT):

1. Click on the plasma-nm icon on the Panel.

2. Click on the spanner icon to open the Connection Editor.

3. Click on 'Add' and create a new connection.

4. On the IPv4 tab:

4.1 For 'Method', select 'Manual'.

4.2 For 'DNS Servers', enter the nameserver's IP address (separated by commas if more than one nameserver).

4.3 Click on 'Add' and do the following:

4.3.1 Under 'Address' enter the static IP address of your machine.

4.3.2 Under 'Netmask' enter the netmask (e.g. I have 255.255.255.0).

4.3.3 Under 'Gateway' enter the gateway IP address.

The steps under 4 above will add some entries to the applicable NetworkManager connection file /etc/NetworkManager/system-connections/<connection> as shown below. If you want, you can create or edit the connection file directly without needing to use a NetworkManager front-end.

```
[connection]

id=<connection>

uuid=<uuid>

type=ethernet

autoconnect=false

permissions=user:<username>:;

secondaries=

[ethernet]

mac-address=<MAC address>

mac-address-blacklist=

[ipv4]

address1=<machine's static IP address>/24,<gateway IP address>

dns=<DNS Server 1 IP address>;<DNS Server 2 IP address>;<DNS Server 3 IP address>;

dns-search=

may-fail=false

method=manual

[ipv6]

dns-search=

method=ignore
```

Actually, the NetworkManager Text User Interface (nmtui) is quite a nice way of doing it in a Konsole or Terminal window, or even in a VT.

----------

## The_Great_Sephiroth

It was me. I forgot to do "rc-update add net.enp0s25 default" so it would start. Sorry about that!

----------

## Fitzcarraldo

 *The_Great_Sephiroth wrote:*   

> It was me. I forgot to do "rc-update add net.enp0s25 default" so it would start. Sorry about that!

 

If you're using NetworkManager, you should not be using netifrc as well:

```
clevow230ss fitzcarraldo # rc-update show -v | grep 'net\.'

         net.enp4s0f1 |                              

               net.lo |

clevow230ss fitzcarraldo # rc-update show -v | grep NetworkManager

       NetworkManager |      default
```

 *Gentoo Wiki - NetworkManager wrote:*   

> OpenRC
> 
> Remove any existing network management services (if installed):
> 
> ```
> ...

 

----------

