Is it possible to auto configure raise network for ethernet to use dhcp if its not configured to use dhcp on a "behind dhcp enabled router setup" other than manually editing /etc/network/interfaces from terminal on Ubuntu, for instance on 16.04? Because if the network is already dhcp enabled then the system automatically sets itself up to use dhcp during system installation but that is not defined in '/etc/network/interfaces' but by something else which 'networking.service' understands without any problem. I know of dhcp-clients like dhclient
or dhcpcd
which has their systemd unit predefined, one just has to run the command like sudo systemctl start/enable dhclient/dhcpcd
but in case of Ubuntu, may be the approach is a little different, so if the dhcp got messed up once, the suggested way is to edit the /etc/network/interfaces to fix that but I like to know the other ways and using CLI.
1 Answer
By default, this is the network-manager that handle the network configuration (it is use DHCP configuration). You can change the behavior of network manager directly in the settings (Settings-->Network-->Default-->IPV4 Tab).
To disable the network-manager you can use the command : sudo systemctl disable network-manager.service
.
Then to get an IP address and routes you can use the command sudo dhclient [interface]
directly in the terminal.
Hope this help.