Switch from Network Manager to Network Service
For most people, Network Manager works rather well and is quite nice for switching between wireless networks or wireless and wired networks. However, Network Manager is not necessarily the best solution for all usage scenarios. This guide explains step by step how to switch from Network Manager to the network service. The scope of this document will be limited to switching from Network Manager to the network service and the tools around it, but will not attempt to explain how to set up the network service for every variation of possible network configurations.
Applicable to Fedora Versions
- Fedora 10 or Higher
To make sure users understand what the end result of this document will be, I want to explain more before continuing. When you disable the Network Manager service you will lose the following capabilities:
- The ability to pick a Wired or Wireless network from an easy GUI applet on your desktop
- The ability to roam between different wireless networks and be prompted for passwords in a GUI environment
- The ability to easily set up a Mobile Broadband connection in a GUI environment.
- The ability to set up a VPN connection with a variety of connections in a GUI environment
Note that I keep repeating "GUI", Network Manager doesn't do any special magic, everything can be done manually, however NM makes a great deal of it easier to deal with. However, Network Manager is not necessarily needed for server roles, static desktops (or notebooks) which do not change their connectivity type, perhaps power users who want absolute control over their systems, etc.If your only reason for disabling Network Manager is because you primarily use a console or would prefer to control it from a console, or your particular Desktop Environment or Window Manager doesn't support applets there are console methods to control Network Manager which are listed in the Tools and Utilities section.
A few things to try before beginning
If you're currently not happy with the way Network Manager is managing your devices you can try a few things to see if it improves your experience without disabling it.
- Make sure your system is up to date with the following: su -c 'yum update' then reboot and see if your issue was resolved.
- Having problems with no network on boot until you login to X? Edit the connection in the Network Manager applet or via system-config-network and set it Active on Boot
- Inconsistent connection to your wireless network? Double check that your network is set to connect automatically in the Network Manager applet and that your SSID is unique. If yours is set to "linksys" or some other generic name chances are you might be attempting to connect to a neighbors access point which would fail assuming you are both using security and different passwords.
- Network Manager applet has disappeared in Gnome/KDE/XFCE/other DE which supports such applets? Try restarting the Network Manager service in a terminal: su -c 'service NetworkManager restart'
- Your system is up to date.. su -c 'yum update' and reboot before continuing.
- Basic use of the command line and some command line tools
- Some knowledge of your own network
- Ability to seek additional help outside of this document
Doing the Work
First we disable and stop the Network Manager service and enable the network service. In case it's not obvious, the following will take your networking offline so if you're doing additional reading you might want to do it before moving forward or do it from another PC. If you need to undo what you've done, see the Return to using Network Manager section below.
- Stop the Network Manager service:
- Disable it from starting at boot:
- Enable the network service, however we are not starting it yet. Before starting it needs configuration, please see the Tools section for some tips around configuration:
su -c 'service NetworkManager stop'
su -c 'chkconfig NetworkManager off'
su -c 'chkconfig network on'
Once you have done the above, please proceed to the next section to understand how to configure the network service and your network devices before we start the network service. Starting it right now would likely not work.
This section is to set up the network service, but also lists some utilities for Network Manager, such as how to control it via a console/terminal. Typically items below in bold (or headings) are commands with some sort of description about what they do. It is up to you to embrace this knowledge and configure your network appropriately using them.
The primary method for controlling and configuring your networking devices (Mobile Broadband, Wireless, Wired) is via the system-config-network utility. It is also in the menus as Network Device Control in the Network menu. You can set your default device, nameservers (DNS), primary route, wireless SSID's, and more. You can set WEP passwords within system-config-network as well, but for WPA or WPA2 you'll need to see WPA Supplicant below. Anything you set in system-config-network is then enabled by the network service. When configuring your devices here, you'll want to make sure you uncheck the Controlled by Network Manager checkbox for each device if it's already checked and set your network device to Active On Boot.
Mostly for wireless testing/diagnosis as anything you configure here will be temporary, but iwconfig is a good tool to do temporary work, such as if you temporarily need to switch your wireless network or see if's connected properly. Use system-config-network to set your wireless configuration permanently. iwlist and iwpriv are also closely associated with iwconfig and can be used to query/set other items, but are generally not needed but can be useful sometimes.
Similar to iwconfig for wireless, ifconfig is a more generic utility typically used to diagnose a connection to check if you have an IP, your gateway, etc. Also similar to iwconfig you can use ifconfig to temporarily set up a connection, but again, it must be set in system-config-network for the configuration to be maintained after a reboot. Other utilities around this are route, ping, traceroute, etc.
WPA Supplicant allows you to do a great variety of things, but the most common thing it allows is for you to connect to a WPA or WPA2 access point. It can also do a variety of other things, such as 802.1x (Enterprise security) with a variety of options around that, even 'promiscuous' wireless selection where it'll automatically select an unencrypted wireless access point for you. See the manpage for more information, man wpa_supplicant.conf
If you need WPA/WPA2, Enterprise security etc, once you've configured the wpa_supplicant.conf file in /etc/wpa_supplicant you can enable the supplicant at startup per the Enable the network service section below.
Other useful utilities associated with WPA Supplicant are wpa_cli to control the supplicant via the terminal/scripts and wpa_passphrase which can generate a PSK for you so it's not plaintext in the wpa_supplicant.conf file.
As mentioned in the Some notes before we begin section, Network Manager can be controlled via console/terminal, even automated in scripts using cnetworkmanager. Don't assume you can't use Network Manager because your GUI doesn't show applets or you don't use a GUI, prefer to control things in a terminal, etc.. This is not typically installed, but you can install it with yum. su -c 'yum install cnetworkmanager'
One more thing to mention might be the location of the network scripts. Generally one should configure things using system-config-network, but should you need to get your hands dirty your network configuration is generally stored in /etc/sysconfig/network-scripts/ifcfg-XXXX where XXXX is your particular device, such as eth0.
Now that you understand the tools necessary and have hopefully configured and tested your network, you can start the network service and wpa_supplicant if necessary. If either fail, refer to their documentation to understand why.
- Start the network service:
- If you need it, start the wpa_supplicant service and configure it to start at boot:
su -c 'service network start'
su -c 'chkconfig wpa_supplicant on; service wpa_suppicant start'
If all else fails, or you've decided this just isn't for you and you should continue to use Network Manager, these steps should return you back to normality.
service network stop
service wpa_supplicant stop
chkconfig network off
chkconfig wpa_suppicant off
chkconfig NetworkManager on
service NetworkManager start
How to test
- Verify an IP when using DHCP, or verify your configured IP using ifconfig. If your device doesn't show up at all, it might not be configured. If you're sure the device is there but it does not show up with ifconfig, try ifconfig -a as shown:
- Verify your wireless configuration with iwconfig. You'll see your current SSID, signal strengths, even a HEX password if you're using an encrypted connection type (WEP, WPA, WPA2, or WPA Enterprise).
- If having trouble connecting to websites, try to ping google.com. If this works, your network connectivity and nameserver resolution should be okay:
- If that fails, try to ping a google.com IP address. If this command works where the above did not, you need to review your Nameserver configuration in system-config-network.
ping -c 5 google.com
ping -c 5 184.108.40.206
Common problems and fixes
Additional reading below will provide links as they're suggested/found/etc which might help the user configure their network.
We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #fedora on irc.freenode.net