0% found this document useful (0 votes)
38 views3 pages

Switch To The Root User

The document discusses configuring a static IP address in Ubuntu 18.04 Server. It describes finding the network interface, editing the netplan configuration file to set the IP address, gateway and DNS, and applying the changes using the netplan command.

Uploaded by

softsen10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views3 pages

Switch To The Root User

The document discusses configuring a static IP address in Ubuntu 18.04 Server. It describes finding the network interface, editing the netplan configuration file to set the IP address, gateway and DNS, and applying the changes using the netplan command.

Uploaded by

softsen10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Switch to the root user.

su -COPY

OR

sudo su -COPY

Find the available network cards on your system


You can run any one of the below commands in the terminal to get a list of network interfaces
available on your system.

ifconfig -aCOPY

OR

ip aCOPY

Choose the desired network interface


The output of the ifconfig command:

Desktop:

enp0s3

: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500


COPY

inet 192.168.1.6 netmask 255.255.255.0 broadcast 192.168.1.255

inet6 fd50:1d9:9fe3:1400:79fa:c48f:b679:c85 prefixlen 64 scopeid 0x0


inet6 fd50:1d9:9fe3:1400:a00:27ff:fe36:34ae prefixlen 64 scopeid 0x0
inet6 fe80::a00:27ff:fe36:34ae prefixlen 64 scopeid 0x20
ether 08:00:27:36:34:ae txqueuelen 1000 (Ethernet)
RX packets 226971 bytes 327928478 (312.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 60417 bytes 4869126 (4.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536


inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 4714 bytes 6158753 (5.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4714 bytes 6158753 (5.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
COPY

At this time, the system interface (enp0s3) takes IP Address from DHCP server.

Configure static IP address in Ubuntu 18.04 Server


As we discussed in the features section, network configuration in Ubuntu
18.04 server is controlled by “netplan” utility.

To configure the static ip address, edit the file “/etc/netplan/50-cloud-


init.yaml“,

Replace the IP address details, gateway and dns server that suits your
environment.

pkumar@linuxtechi:~$ sudo vi /etc/netplan/50-cloud-init.yaml

Now apply these changes using below netplan command,


pkumar@linuxtechi:~$ sudo netplan apply

pkumar@linuxtechi:~$

If you want to run above netplan command in debug command, then execute
below command,

pkumar@linuxtechi:~$ sudo netplan apply --debug

Now you can verify the IP address details using ip command,

pkumar@linuxtechi:~$ ip add show

You might also like