What to do after installing Linux Ubuntu 2 – In this part we discuss about few basic adjustments before we start using the most exciting Linux features called Virtualization. Oh yeah! Later on there will be plenty of virtual machines inside your newly installed Linux Ubuntu operating system.
Setting static ip address in Linux Ubuntu
After installing Linux Ubuntu the most important is to set static ip address. This is important because later we will installing all bunch of great stuff to make our Linux Ubuntu a perfect lab for all purposes.
One of the greatest stuff will be qemu-kvm hypervisor, and this is first step in making a perfect Linux lab for all kind’s of testing and connecting to other virtual machines.
Default ip address settings on Linux Ubuntu
Default ip address settings on Linux Ubuntu is set to automatic DHCP, this means when connecting to local network your local ip address will not be persistent and that is what we do not want. This config file is in directory /etc/netplan Let’s see how it looks on default Linux Ubuntu:
user@ubuntu:/etc/netplan$ cat 01-network-manager-all.yaml # Let NetworkManager manage all devices on this system network: version: 2 renderer: NetworkManager
Setting static ip address
If you want to setup your static ip address open your terminal by pressing keys ctrl + alt + t and type:
sudo gedit /etc/netplan/01-network-manager-all.yaml
This is how looks my configuration file:
network: version: 2 renderer: networkd ethernets: enp3s0: dhcp4: no addresses: [192.168.1.100/24] gateway4: 192.168.1.1 nameservers: addresses: [188.8.131.52,184.108.40.206]
VERY IMPORTANT! When editing this configuration file, note the position of the characters, the layout must be exactly as in this example!
Maybe the easiest thing would be to copy/paste my config file using gedit and just change your ip address to something different, anyway it’s just local ip. After you done editing just confirm by typing:
sudo netplan apply
The only parameters that could not be same as mine could be:
- name of your network adapter: enp3s0
- gateway4: ip address of your router: 192.168.1.1
How can i see my network card name and ip address?
If you don’t know name of your network adapter just type command in terminal:
cro4gen@ubuntu:~$ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 70:85:c2:0c:eb:5c brd ff:ff:ff:ff:ff:ff inet 192.168.1.100/24 brd 192.168.1.255 scope global enp3s0 valid_lft forever preferred_lft forever inet6 fe80::7285:c2ff:fe0c:eb5c/64 scope link valid_lft forever preferred_lft forever
In example above you can see the name of network adapter enp3s0 and it’s ip address 192.168.1.100 i will also show you an example of wrong config file:
Bad example of netplan config file:
pnk18@pink:/etc/netplan$ cat 01-netcfg.yaml network: version: 2 renderer: networkd ethernets: enp3s0: dhcp4: no addresses: [192.168.1.100/24] gateway4: 192.168.1.1 nameservers: addresses: [220.127.116.11,18.104.22.168]
What can i say more about “What to do after installing Linux Ubuntu 2” well, personally i think setting static ip on Linux Ubuntu was giving me a bit of headache and i really hate those yaml config files. Maybe i was too long on centos …