How to Set a Static IP Address On Ubuntu 22.04 – Holhol24

10

The first process any individual would do after putting in Ubuntu is atmosphere an IP deal with to a machine to hook up with the community/web. If the Wi-Fi router, ISP, or community doesn’t supply DHCP services and products, you will have to manually assign IP addresses.

Here, we will be able to see how one can set a static IP Address on Ubuntu 22.04, the use of,

You can use any technique to set a static IP deal with on Ubuntu 22.04.

Find Network Interfaces on Ubuntu 22.04

You can run any of the beneath instructions in a terminal to get a listing of community interfaces to be had at the machine.

sudo ifconfig -a

OR

sudo ip a

The output of the ifconfig command on a desktop:

enp0s3: flags=4163 mtu 1500
ether 08:00:27:36:34:ae txqueuelen 1000 (Ethernet)
RX packets 226971 bytes 327928478 (312.7 MiB)
RX mistakes 0 dropped 0 overruns 0 body 0
TX packets 60417 bytes 4869126 (4.6 MiB)
TX mistakes 0 dropped 0 overruns 0 provider 0 collisions 0

lo: flags=73 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 mistakes 0 dropped 0 overruns 0 body 0
TX packets 4714 bytes 6158753 (5.8 MiB)
TX mistakes 0 dropped 0 overruns 0 provider 0 collisions 0

The output of the ifconfig command on a computer:

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 188 bytes 13462 (13.4 KB)
RX mistakes 0 dropped 0 overruns 0 body 0
TX packets 188 bytes 13462 (13.4 KB)
TX mistakes 0 dropped 0 overruns 0 provider 0 collisions 0

wlo1: flags=4163 mtu 1500
ether 7c:8b:ca:0d:69:b6 txqueuelen 1000 (Ethernet)
RX packets 972 bytes 346365 (346.3 KB)
RX mistakes 0 dropped 465 overruns 0 body 0
TX packets 426 bytes 66875 (66.8 KB)
TX mistakes 0 dropped 0 overruns 0 provider 0 collisions 0

Here, we will be able to see how one can configure a static IP for enp0s3 (Wired) / wl01 (Wi-Fi).

IP Address: 192.168.0.10Netmask: 255.255.255.0Gateway: 192.168.0.1DNS Server 1: 192.168.0.1DNS Server 2: 8.8.8.8Domain Name: holhol24.native

Set Static IP Address on Ubuntu 22.04 Desktop
1. Using GNOME Network Manager

Using the GNOME community management middle to set a static IP deal with on In Ubuntu 22.04 desktop is simple.

Set IP for Wired Interface the use of GNOME

Open the Gnome management middle the use of the gnome-control-center community command or pass to Activities >> Settings >> Network.

Click at the equipment icon at the Wired interface web page after which IPv4 tab >> Manual >> Enter IP deal with, Netmask, Gateway, DNS (Toggle to disable Automatic DNS configuration) >> Apply.

Set IP for Wired Interface

Finally, use the toggle within the Network web page to disable and permit the community interface to use the IP deal with.

Set IP Address for Wi-Fi the use of GNOME

Open the Gnome management middle the use of the gnome-control-center wifi command or pass to Activities >> Settings >> Wi-Fi.

Click for your Wifi router title after which input the router’s password to attach. Your computer will robotically obtain an IP deal with from a Wi-Fi router with a integrated DHCP provider on a a success connection.

Wi-Fi Access Points

To assign a static IP deal with or Wi-Fi interface, click on at the equipment icon at the Wi-Fi interface web page after which IPv4 tab >> Manual >> Enter IP deal with, Netmask, Gateway, DNS (Toggle to disable Automatic DNS configuration) >> Apply.

Set IP for Wired Wi-Fi

Finally, disable and permit the Wi-Fi interface to use the IP deal with.

2. Using Netplan

Netplan is a software for simply configuring networking on a Ubuntu machine. It reads the configuration information .yaml provide within the /and so on/netplan listing.

This software helps each networkd and Network Manager as backends. However, the use of Network Manager as a backend renderer: NetworkManager is advisable for the Ubuntu desktop. The final configurations are the similar as that of the networkd.

3. Using NetworkManager CLI
Set IP for Wired Interface the use of nmcli

First, allow us to record the to be had community connections.

nmcli connection display

Output:

NAME UUID TYPE DEVICE
Wired connection 1 db3b0cfc-d875-3a71-86c4-626adfc5834a ethernet enp0s3

Then, configure static IP deal with to stressed out interface.

sudo nmcli con mod “Wired connection 1” ipv4.addresses 192.168.0.10/24

sudo nmcli con mod “Wired connection 1” ipv4.gateway 192.168.0.1

sudo nmcli con mod “Wired connection 1” ipv4.dns “192.168.0.1”,”8.8.8.8″

sudo nmcli con mod “Wired connection 1” ipv4.means guide

sudo nmcli con mod “Wired connection 1” ipv6.means disabled

Finally, run the beneath instructions to use the IP deal with.

sudo nmcli con down “Wired connection 1” && sudo nmcli con up “Wired connection 1”
Set IP Address for Wi-Fi the use of nmcli

First, record the to be had Wi-Fi entry facets the use of the beneath command.

nmcli instrument wifi

Output:

IN-USE BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
BA:DD:71:A3:D9:A4 Raj Infra 6 270 Mbit/s 100 ▂▄▆█ WPA2

Next, connect with the Wi-Fi entry level.

nmcli instrument wifi attach Raj password MyCross ifname wlo1 title My-Wifi

And then, configure static IP deal with to Wi-Fi interface.

sudo nmcli con mod “My-Wifi” ipv4.addresses 192.168.0.10/24

sudo nmcli con mod “My-Wifi” ipv4.gateway 192.168.0.1

sudo nmcli con mod “My-Wifi” ipv4.dns 192.168.0.1

sudo nmcli con mod “My-Wifi” ipv4.means guide

sudo nmcli con mod “My-Wifi” ipv6.means disabled

Finally, run the beneath instructions to use the IP deal with

sudo nmcli con down “My-Wifi” && sudo nmcli con up “My-Wifi”
Set Static IP Address Using NetPlan on Ubuntu 22.04 Server

Netplan is a community configuration software that reads YAML information and generates all community configurations for the renderer instrument (NetworkManager or networkd) to configure the community on a machine.

Netplan configuration information are discovered within the /and so on/netplan/ listing.

Remove any configuration information .yaml provide within the /and so on/netplan listing.

sudo rm -rf /and so on/netplan/*
Set IP for Wired Interface the use of Netplan

Now, create a brand new netplan configuration for the stressed out community interface.

sudo nano /and so on/netplan/01-wired-interface-1.yaml

Then, make adjustments to the beneath data and use it on your requirement.

community:
model: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
dhcp6: no
addresses:
– 192.168.0.10/24
routes:
– to: default
by way of: 192.168.0.1
nameservers:
addresses:
– 192.168.0.1
– 8.8.8.8
seek:
– holhol24.native

And then generate the specified configuration for the renderers.

sudo netplan generate

Finally, observe all community configurations and restart renderers.

sudo netplan observe
Set IP Address for Wi-Fi the use of Netplan

Wi-Fi Interface Name: wl01Wireless Access Point Name: RajWireless Access Point Password: MyCross

First, create a brand new netplan configuration for the stressed out community interface.

sudo nano /and so on/netplan/01-wireless-interface-1.yaml

Then, make adjustments to the beneath data and use it on your requirement.

community:
model: 2
renderer: networkd
wifis:
wlo1:
dhcp4: no
dhcp6: no
addresses:
– 192.168.0.10/24
routes:
– to: default
by way of: 192.168.0.1
nameservers:
addresses:
– 192.168.0.10
– 8.8.8.8
seek:
– holhol24.native
access-points:
Raj:
password: MyCross

And then generate the specified configuration for the renderers.

sudo netplan generate

Finally, observe all community configurations and restart renderers.

sudo netplan observe
Verify Static IP Address on Ubuntu 22.04

Verify the static IP deal with the use of the beneath instructions.

sudo ifconfig -a

OR

sudo ip a

Output:

enp0s3: flags=4163 mtu 1500
inet 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255
ether 08:00:27:81:43:e1 txqueuelen 1000 (Ethernet)
RX packets 1684 bytes 1211790 (1.2 MB)
RX mistakes 0 dropped 0 overruns 0 body 0
TX packets 1004 bytes 140357 (140.3 KB)
TX mistakes 0 dropped 0 overruns 0 provider 0 collisions 0

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 549 bytes 44488 (44.4 KB)
RX mistakes 0 dropped 0 overruns 0 body 0
TX packets 549 bytes 44488 (44.4 KB)
TX mistakes 0 dropped 0 overruns 0 provider 0 collisions 0

Also, check the DNS server’s entries.

sudo resolvectl standing

Output:

Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub

Link 2 (enp0s3)
Current Scopes: DNS
Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 192.168.0.1
DNS Servers: 192.168.0.1 8.8.8.8
DNS Domain: holhol24.native

Conclusion

That’s All.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More