Setting up a network in Ubuntu is not a tricky business, but for beginners it can be difficult, today I'll show you how to configure the network on a freshly installed Ubuntu.
I prefer the network manager - networking, it is more flexible in setting up, and it works more fast and more posh. To enable it, you must first remove the graphic network-manager, for this we type in the terminal:
sudo stop network-manager sudo apt-get remove network-manager
Then you need to enable networking:
sudo /etc/init.d/networking start
If you suddenly swear at something, you can try to reboot the whole system:
sudo reboot now
After networking starts, you need to edit the config:
sudo nano /etc/network/interfaces
You need to add it to it if you plan to use the DHCP address:
auto eno1 iface eno1 inet dhcp
eno1 needs to be replaced with the name of your network interface, you can see all your interfaces, not even configured and disabled, with the command:
ifconfig -a
If you plan to register a static IP, you need to add the following lines to the interfaces file:
auto eno1 iface eno1 inet static #ip address address 192.168.1.4 #network mask netmask 255.255.255.0 #gateway gateway 192.168.1.1 #dns dns-nameservers 8.8.8.8
You can register DNS not in here but in /etc/resolvconf/resolv.conf.d/head, or simply in /etc/resolv.conf. But the option with interfaces is preferable.
After you edit the config, you need to restart the network:
sudo /etc/init.d/networking restart
The network should work.
If you need to restart or disable the network interface, you can use the following commands:
sudo ifdown eno1 #отключение sudo ifup eno1 #включение
Share the article with your friends in social networks, maybe it will be useful to them.
If the article helped you, you can >>thank the author<<