Assign a Static IP Address in a Local Area Network

You can change the assigned IP address of your computer by editing the file /etc/network/interfaces. Search there for your primary Ethernet controller (usually eth0). Change the value from dhcp to static. Then you can specify address (IP address) and gateway (usually your router). Then restart the network or computer. Tested under Ubuntu and Rasbperry Pi OS.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo br0
iface lo inet loopback

# The primary network interface
allow-hotplug eth0

# This is the important part. Above part may vary.
iface eth0 inet static
  address # Add desired static ip address here
  gateway # Add local gateway here

There are no comments yet.