SDB:Knetworkmanager static ip auto eth0

Jump to: navigation, search
Tested on openSUSE Recommended articles Related articles
Icon-checked.png

Icon-manual.png Icon-help.png

Google Translator On. :-)

This HOWTO will demonstrate how to put the static IP - KNetworkManager - System Connection Auto eth0 with nm-connection-editor.

This HOWTO will demonstrate how to put the static IP - KNetworkManager - User Connection eth0-static with KNetworkManager.

Will be shown two methods (1-System Connection and 2-User Connection) to create a connection with static IP and that works automatically.


System and packages

In this tutorial will be used:

  • openSUSE 11.4-x86_64
  • KDE: 4.6.00 (4.6.0) "release 6"
  • KNetworkManager: v0.9
  • NetworkManager: 0.8.2-15.20.1
  • NetworkManager-gnome: 0.8.2-8.1 --> nm-connection-editor (package not installed by default on a KDE installation)

How to obtain information about network configuration (openSUSE 11.4):

List the configuration of all network devices:

$ /sbin/ifconfig


List information about the network card eth0:

$ /sbin/ifconfig eth0
eth0   Link encap:Ethernet  Endereço de HW 00:11:22:33:44:55
       inet end.: 172.16.131.129  Bcast:192.168.2.255  Masc:255.255.255.0
       endereço inet6: fe80::224:beff:fe95:10ac/64 Escopo:Link
       UP BROADCASTRUNNING MULTICAST  MTU:1500  Métrica:1
       RX packets:470051 errors:0 dropped:0 overruns:0 frame:0
       TX packets:228989 errors:0 dropped:0 overruns:0 carrier:0
       collisions:0 txqueuelen:1000 
       RX bytes:524119656 (499.8 Mb)  TX bytes:66645851 (63.5 Mb)
       IRQ:18 
  • IP address of network (inet end.): 172.16.131.129
  • Netmask (Masc): 255.255.255.0


List information about the DNS:

$ cat /etc/resolv.conf
### /etc/resolv.conf file autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
# Note: Manual change of this file disables netconfig too, but
# may get lost when this file contains comments or empty lines
# only, the netconfig settings are same with settings in this
# file and in case of a "netconfig update -f" call.
#
### Please remove (at least) this line when you modify the file!
search dominiolocal
nameserver 208.67.222.222
nameserver 208.67.220.220
  • Primary DNS (nameserver): 208.67.222.222
  • Secondary DNS (nameserver): 208.67.220.220

You can see the DNS of your ISP or you can see the IP number of your router. Depends on how it was set up your network and how your router is configured.

Have the Primary and Secondary DNS from your ISP (see the support from your provider) or you can use OpenDNS's DNS (208.67.222.222 and 208.67.220.220).


List information about the default route (usually the router's IP - Gateway):

$ /sbin/route -n | grep UG | awk '{print $2}'
192.168.2.1


  • NetworkManager works with "netconfig".
  • Manually edit the file /etc/resolv.conf disables the "netconfig" (manual change of this file disables netconfig too).
  • If you put some wrong information in the file /etc/resolv.conf then you may have trouble navigating the Internet by putting the names of the sites (eg www.google.com.br) and will only access the site by IP number .
  • In this tutorial will not be done manually editing the file /etc/resolv.conf.


  • File System Connection (Method 1) "Auto eth0" edited by "nm-connection-editor":

/etc/NetworkManager/system-connections/Auto\ eth0


  • File User Connection (Method 2) is edited by Knetworkmanager in:

/home/username/.kde4/share/apps/networkmanagement/connections/


  • File used by the "netconfig":

/etc/resolv.conf


  • The name “Auto\ eth0” receives a backslash because it has space between the "Auto" and "eth0". It's tip hit Tab to the system automatically put the full name of the terminal (Konsole) to avoid typing error.
  • In Method 1 (System Connection) NetworkManager reads DNS in the file /etc/NetworkManager/system-connections/Auto\ eth0 and the "netconfig" reconstructs the file “/etc/resolv.conf” and put the DNS in the /etc/resolv.conf.
  • In Method 2 (User Connection) NetworkManager reads DNS in the file /home/username/.kde4/share/apps/networkmanagement/connections/ and the "netconfig" reconstructs the file "/etc/resolv.conf " and put the DNS in /etc/resolv.conf.
  • At each system startup or restart of NetworkManager that process is done when NetworkManager and netconfig work together.


Note 1

If you put some wrong information in /etc/resolv.conf then enable "netconfig" again and force the reconstruction of this file. This procedure enabled NetworkManager to work together with the "netconfig".

$ sudo /sbin/netconfig update -f


Any change to network configuration should be restarted NetworkManager to update the files:

$ sudo /etc/init.d/network restart


Note 2 (CTRL + C terminates the Ping)

$ ping 208.67.222.222
PING 208.67.222.222 (208.67.222.222) 56(84) bytes of data.
64 bytes from 208.67.222.222: icmp_req=1 ttl=57 time=136 ms
64 bytes from 208.67.222.222: icmp_req=2 ttl=57 time=136 ms
^C
--- 208.67.222.222 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms

Connected to the Internet with your computer's IP number, Netmask and Gateway IP (usually the router's IP) configured correctly.


Note 3 (CTRL + C terminates the Ping)

$ ping www.opendns.com
PING www.opendns.com (208.69.38.160) 56(84) bytes of data.
64 bytes from 208.69.38.160: icmp_req=1 ttl=54 time=219 ms
64 bytes from 208.69.38.160: icmp_req=2 ttl=54 time=216 ms
^C
--- www.opendns.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms

Connected to the Internet with your computer's IP number, Netmask and Gateway IP (usually the router's IP) configured correctly. Configuring DNS working properly.


Note 4 (CTRL + C terminates the Ping)

$ ping 208.67.222.222
PING 208.67.222.222 (208.67.222.222) 56(84) bytes of data.
^C
--- 208.67.222.222 ping statistics ---
19 packets transmitted, 0 received, 100% packet loss, time 17999ms

Probable configuration problem as the network computer IP or Network Mask or Gateway IP (usually the router's IP). Verify that the configuration is correct.


Note 5 (CTRL + C terminates the Ping)

$ ping www.opendns.com
ping: unknown host www.opendns.com

If you did the "ping 208.67.222.222" and everything went well and the "ping www.opendns.com" appeared the error message "ping: unknown host www.opendns.com" then there is probably a configuration issue DNS. Verify that the DNS numbers are correct in your configuration.


Method 1 - System Connection (Auto eth0)

System Connection: established before the user log into the system. Available to all users.

1 - Auto eth0 - KNetworkManager: v0.9


Kdeipestatico-nmconnectioneditor-en1.jpg


2 - The connection “Auto eth0 - Connection System" created by NetworkManger with Dynamic IP is not shown in Knetworkmanger.

You can not edit it by Knetworkmanager, but the "nm-connection-editor" – package NetworkManager-gnome.

Do not try to edit the connection “Auto eth0" by the text editor (vi, nano, pico, etc.) it will not work. Other aspects are involved in this operation besides editing the "Auto eth0".

Use a text editor (vi, nano, pico, etc..) to connection "Auto eth0" if you want to block this connection (it will not be shown in nm-connection-editor.). Will be explained in Method 2 – User Connection.


Kdeipestatico-nmconnectioneditor-en2.jpg


3 - The configuration files are in NetworkManager:

/etc/NetworkManager/NetworkManager.conf

or

/etc/NetworkManager/nm-system-settings.conf (openSUSE 11.4)


File "nm-system-settings.conf" original (openSUSE 11.4):

$ sudo cat /etc/NetworkManager/nm-system-settings.conf
[main]
plugins=keyfile,ifcfg-suse
no-auto-default=00:11:22:33:44:55, 


4 - File System Connection "Auto eth0":

/etc/NetworkManager/system-connections/Auto\ eth0


Original file "Auto eth0" Dynamic IP:

$ sudo cat /etc/NetworkManager/system-connections/Auto\ eth0
[802-3-ethernet]
mac-address=00:11:22:33:44:55

[connection]
id=Auto eth0
uuid=11c1111c-b111-3fa5-1ec3-e7597a1c535
type=802-3-ethernet
timestamp=1303133166


5 – The "nm-connection-editor" has to be initiated by the "kdesu" in a terminal (Konsole - openSUSE 11.4).

$ /usr/bin/kdesu -c /usr/bin/nm-connection-editor

or

$ /usr/bin/kdesu -c nm-connection-editor

Enter the root password.

In the window "Network Connections", select the tab "Wired", select the connection “Auto eth0" and then click Edit.


Kdeipestatico-nmconnectioneditor-en3.jpg


6 - In the next window "Editing Auto eth0"

  • Connection name: Auto eth0 - is automatically placed.
  • Allow selected "Connect automatically " and "Available to all users. "
  • In the tab "Wired":
    • MAC address: MAC address of your ethernet network card.
    • MAC Address clone: usually blank.
    • MTU: usually Automatic. Check as it is marked on your router.


Kdeipestatico-nmconnectioneditor-en4.jpg


7 - In the tab "802.1x Security" generally need not be any selected item.


Kdeipestatico-nmconnectioneditor-en5.jpg


8 - In the tab "IPv4 Settings" select:

  • Method: Manual
  • Click Add and fill in the fields:
    • Address: Static IP as the IP range of your router. Example: 172.16.131.129
    • Netmask: usually the same as your router. Example: 255.255.255.0
    • Gateway: usually the IP of your router. Example: 172.16.131.2
    • DNS servers (comma separated): You can use your ISP or OpenDNS. Example: 208.67.222.222,208.67.220.220
    • Select "Require IPv4 addressing for this connection to complete.”.


Kdeipestatico-nmconnectioneditor-en6.jpg


9 - "Routes" is usually blank.


Kdeipestatico-nmconnectioneditor-en7.jpg


10 - In the tab "Settings IPv6" select:

  • Method: Ignore


Kdeipestatico-nmconnectioneditor-en8.jpg


11 - Click “Save” and then “Close” to terminate the "nm-connection-editor ".


12 - File "Auto eth0" modified:

  • The number 24 in "addresses1=172.16.131.129;24;172.16.131.2," represents a Netmask of 255.255.255.0.
$ sudo cat /etc/NetworkManager/system-connections/Auto\ eth0
[802-3-ethernet]
duplex=full
mac-address=00:11:22:33:44:55

[connection]
id=Auto eth0
uuid=83c7895f-b397-3ba7-8c75-a4587c1b9324
type=802-3-ethernet
timestamp=1303133166

[ipv6]
method=ignore

[ipv4]
method=manual
dns=208.67.222.222;208.67.220.220;
addresses1=172.16.131.129;24;172.16.131.2;


13 - Now restart NetworkManager to see if it's alright (openSUSE 11.4):

$ sudo /etc/init.d/network restart
Shutting down the NetworkManager                                                                                           done
ATTENTION: You have modified /etc/resolv.conf.  Leaving it untouched...
You can find my version in /etc/resolv.conf.netconfig ...

Shutting down network interfaces:
    eth0      device: Marvell Technology Group Ltd. Yukon Optima 88E8059 [PCIe Gigabit Ethernet Controller with AVB] (rev 11)
    eth0      serves root filesystem. Leave it up.
    eth0                                                                                                                   skipped
    
    wlan0     device: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
    wlan0     serves root filesystem. Leave it up.
    wlan0                                                                                                                  skipped
Shutting down service network  .  .  .  .  .  .  .  .  .                                                                   done
Starting the NetworkManager                                                                                                done
                                                                                                                          		  done


If everything went right so the message "Starting the NetworkManager - done – done" is displayed.

If there is any problem in configuration file "Auto eth0" then counts appear after 30 seconds the message "Starting the NetworkManager - waiting. "


14 - Static IP running on KDE 4.6 with Knetworkmanager 0.9 automatically as system connection.


Kdeipestatico-nmconnectioneditor-en9.jpg

Method 2 - User connection (eth0-static)

User Connection: established after the user log into the system.

1 - If you do not want to use the "nm-connection-editor" then use a text editor (vi, nano, pico, etc..) to block the file "Auto eth0" and create a network connection from the user by Knetworkmanager.

The configuration file "Auto eth0" going up "[IPv4] method=manual" without the IP address.

This file will be ignored by NetworkManager.

$ sudo nano /etc/NetworkManager/system-connections/Auto\ eth0
[802-3-ethernet]
mac-address=00:11:22:33:44:55

[connection]
id=Auto eth0
uuid=83c7895f-b397-3ba7-8c75-a4587c1b9324
type=802-3-ethernet
timestamp=1303133166

[ipv4]
method=manual

Click on the icon of knetworkmanager -> Manage Connections.

The option "Enable networking" must be selected.


Kdeipestatico-nmconnectioneditor-en10.jpg


2 - Network Connections -> Wired -> Add.


Kdeipestatico-nmconnectioneditor-en11.jpg


3 - In the "Add network connection - KDE Control Module":

  • Connection name: eth0-static (you can choose another name if you wish)
  • Select "Connect automatically ".
  • Tab Ethernet:
    • Restrict To Interface: Networking interface.
    • MTU: usually Automatic. Check as the configuration of your router.


Kdeipestatico-nmconnectioneditor-en12.jpg


4 - In the tab "IP Address":

  • Basic Settings
  • Method: Manual
  • IP Address: Static IP as the IP range of your router. Example: 172.16.131.129
  • Subnet Mask: usually the same as your router. Example: 255.255.255.0
  • Gateway: usually the IP of your router. Example: 172.16.131.2
  • DNS servers (comma separated): You can use your ISP or OpenDNS. Example: 208.67.222.222,208.67.220.220


Kdeipestatico-nmconnectioneditor-en13.jpg


5 - In the tab "802.1x Security":

  • Generally it is unchecked the option "Use 802.1x authentication. "


Kdeipestatico-nmconnectioneditor-en14.jpg


6 - Click OK.

  • Normally you are asked to KWallet password. Enter password and press ENTER.
  • In the window "KDE Wallet Service - The application “KnetworkManager has requested acess to open wallet kdewallet": Allow Always.
  • This option "should" load the connection "eth0-static" automatically every time the user logs into the system. Unfortunately this does not happen and has many users complaining on the Internet about this problem.
  • One solution would be to put a blank password in KWallet for the password was no longer required (AT YOUR OWN RISK – LOW LEVEL SECURITY IN KWALLET!).


Kdeipestatico-nmconnectioneditor-en14-2.jpg


Kdeipestatico-nmconnectioneditor-en14-3.jpg


7 - Click OK again to finish the network configuration of Knetworkmanager.

Now restart NetworkManager to see if it's alright (openSUSE 11.4):

$ sudo /etc/init.d/network restart


8 - Static IP running on KDE 4.6 with Knetworkmanager 0.9 automatically as the user's connection.


Kdeipestatico-nmconnectioneditor-en15.jpg


9 – Password blank KWallet (AT YOUR OWN RISK):

Chameleon (Start “Windows”) -> System -> Desktop Applet -> Kwalletmanager – Wallet Management Tool.

or

In terminal (Konsole): kwalletmanager


Kdeipestatico-nmconnectioneditor-en14-4.jpg


Change password: blank password.


Kdeipestatico-nmconnectioneditor-en14-5.jpg


10 - The configuration file "eth0-Static" will be stored in /home/user/.kde4/share/apps/networkmanagement/connections/ .


11 - Do not edit this file through a text editor (vi, nano, pico, etc.) but by Knetworkmanager.


12 - If you want to reuse the file "Auto eth0" with Dynamic IP, edit this file and remove "[IPv4] method = manual ".

$ sudo nano /etc/NetworkManager/system-connections/Auto\ eth0
[802-3-ethernet]
mac-address=00:11:22:33:44:55

[connection]
id=Auto eth0
uuid=83c7895f-b397-3ba7-8c75-a4587c1b9324
type=802-3-ethernet
timestamp=1303133166

[ipv4]
method=manual


File unlocked and ready to be used by NetworkManager:

$ sudo cat /etc/NetworkManager/system-connections/Auto\ eth0
[802-3-ethernet]
mac-address=00:11:22:33:44:55

[connection]
id=Auto eth0
uuid=83c7895f-b397-3ba7-8c75-a4587c1b9324
type=802-3-ethernet
timestamp=1303133166


Now restart NetworkManager to see if it's alright (openSUSE 11.4):

$ sudo /etc/init.d/network restart

This will enable NetworkManager to rebuild the "Auto eth0" Dynamic IP.


Tutorial made by Noisegroundbr - collaboration Raul Libório.


External links