Installation
NetworkManager should be installed by default on Ubuntu Desktop installs, as well as most flavours of Ubuntu.
To install NetworkManager:
sudo apt-get upgrade
sudo apt-get install network-manager
Using Systemd
Systemd became the default initialization system in Ubuntu 15.04. Here's how to start Network Manager and enable it to be restarted after a reboot:
Start network manager
sudo systemctl start NetworkManager.service
Enable restarting the network manager when the system reboots
sudo systemctl enable NetworkManager.service
Issues
If it is not managing your network connections, you'll need to comment out the references to all interfaces (except lo) in /etc/network/interfaces to let Network Manager handle them.
sudo cp /etc/network/interfaces /etc/network/interfaces.bak sudo nano /etc/network/interfaces
It should look similar to this when you are done:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # This is a list of hotpluggable network interfaces. # They will be activated automatically by the hotplug subsystem. # auto eth1 # iface eth1 inet dhcp
Then reboot and you should be good to go!
/etc/network/interfaces
file: auto lo
iface lo inet loopback
/etc/NetworkManager/NetworkManager.conf
file: [main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq
[ifupdown]
managed=true
If it is not managing your network connections, you'll need do the following:
sudo nmcli dev set enp8s0 managed yes
Try to the following (backup orig file, and create 0 bytes file instead)
sudo mv /etc/NetworkManager/conf.d/10-globally-managed-devices.conf /etc/NetworkManager/conf.d/10-globally-managed-devices.conf_orig
sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
Stopping and Disabling NetworkManager
The steps to disable NetworkManager depend on which of the initialization subsystems are running: Upstart or Systemd.
Using Systemd
Systemd became the default initialization system in Ubuntu 15.04. Here's how to stop and disable Network Manager without uninstalling it:
Stop network manager
sudo systemctl stop NetworkManager.service
Disable network manager (permanently) to avoid it restarting after a reboot
sudo systemctl disable NetworkManager.service
To list the currently available network connections, issue a command as follows:
To list the currently available network connections, issue a command as follows:
~]$ nmcli con show
NAME UUID TYPE DEVICE
Auto Ethernet 9b7f2511-5432-40ae-b091-af2457dfd988 802-3-ethernet --
ens3 fb157a65-ad32-47ed-858c-102a48e064a2 802-3-ethernet ens3
MyWiFi 91451385-4eb8-4080-8b82-720aab8328dd 802-11-wireless wlan0
Note that the NAME field in the output always denotes the connection ID (name). It is not the interface name even though it might look the same. In the second connection shown above, ens3
in the NAME field is the connection ID given by the user to the profile applied to the interface ens3. In the last connection shown, the user has assigned the connection ID MyWiFi
to the interface wlan0.
Adding an Ethernet connection means creating a configuration profile which is then assigned to a device. Before creating a new profile, review the available devices as follows:
~]$ nmcli dev status
DEVICE TYPE STATE CONNECTION
ens3 ethernet disconnected --
ens9 ethernet disconnected --
lo loopback unmanaged --
Adding a Static Ethernet Connection
To add an Ethernet connection with static IPv4
configuration, a command in the following format can be used:
nmcli connection add type ethernet con-name connection-name ifname interface-name ip4 address gw4 address
IPv6
address and gateway information can be added using the ip6
and gw6
options.
For example, a command to create a static Ethernet connection with only IPv4
address and gateway is as follows:
~]$ nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \
gw4 10.10.10.254
Optionally, at the same time specify IPv6
address and gateway for the device as follows:
~]$ nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \
gw4 10.10.10.254 ip6 abbe::cafe gw6 2001:db8::1
Connection 'test-lab' (05abfd5e-324e-4461-844e-8501ba704773) successfully added.
IPv4
configuration, a command in the following format can be used:nmcli connection add type ethernet con-name connection-name ifname interface-name ip4 address gw4 address
IPv6
address and gateway information can be added using the ip6
and gw6
options.IPv4
address and gateway is as follows:~]$Optionally, at the same time specifynmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \
gw4 10.10.10.254
IPv6
address and gateway for the device as follows:~]$nmcli con add type ethernet con-name test-lab ifname ens9 ip4 10.10.10.10/24 \
gw4 10.10.10.254 ip6 abbe::cafe gw6 2001:db8::1
Connection 'test-lab' (05abfd5e-324e-4461-844e-8501ba704773) successfully added.
Adding a Dynamic Ethernet Connection
To add an Ethernet configuration profile with dynamic
IP
configuration, allowing DHCP
to assign the network configuration, a command in the following format can be used:nmcli connection add type ethernet con-name connection-name ifname interface-name
For example, to create a dynamic connection profile named my-office, issue a command as follows:
~]$ nmcli con add type ethernet con-name my-office ifname ens3
Connection 'my-office' (fb157a65-ad32-47ed-858c-102a48e064a2) successfully added.
Comentarios
Publicar un comentario