i am using ubuntu. my ip changed from 192.168.0.191 to 192.168.0.85 after i change my…
- User
i am using ubuntu. my ip changed from 192.168.0.191 to 192.168.0.85 after i change my motherboard. how can i set my ip back to 192.168.0.191
- Assistant
When your IP address changes in a home or office network, it's usually because the network's DHCP (Dynamic Host Configuration Protocol) has assigned a different address to your device. This is common when you change hardware such as your motherboard, as the MAC address of the network interface has changed. You can set a static IP address to ensure it stays the same even after reboots or hardware changes.
Here’s how to set a static IP address on Ubuntu:
Method 1: Using the GUI
-
Open Network Settings:
- Click on the network icon in the system tray.
- Select "Settings" or "Network Settings."
-
Edit the Connection:
- Select the network connection you are using (e.g., Wi-Fi or Wired).
- Click the gear icon or "Edit" button.
-
Set the IP Manually:
- Navigate to the "IPv4" or "IPv6" tab based on your network.
- Change "Automatic (DHCP)" to "Manual."
- Enter your desired IP address (
192.168.0.191), Netmask (255.255.255.0), and Gateway (e.g.,192.168.0.1). - Add DNS servers if necessary.
-
Save the Settings:
- Click "Save" or "Apply."
- Restart your network connection.
Method 2: Using the Terminal
If you prefer using the terminal, you can configure the static IP address by editing the Netplan configuration files. Follow these steps:
-
Open Terminal:
sudo nano /etc/netplan/01-netcfg.yamlThe filename might be different, so you might need to verify the exact name in the
/etc/netplan/directory. It could be something like00-installer-config.yaml. -
Edit the Configuration File: You may see a configuration like this:
network: version: 2 ethernets: enp3s0: # replace this with your interface name dhcp4: no addresses: - 192.168.0.191/24 gateway4: 192.168.0.1 nameservers: addresses: [8.8.8.8, 8.8.4.4]Make sure to replace
enp3s0with the actual network interface name. You can check your interface name using:ip a -
Apply the Configuration:
sudo netplan apply
Method 3: Set Static DHCP Lease (Recommended)
Many routers allow you to reserve a static IP address based on the MAC address of your network card. This way, the DHCP server always assigns the same IP address to your machine.
-
Access Your Router's Admin Interface:
- Open a web browser and enter the IP address of your router (commonly
192.168.0.1). - Log in using your router's credentials.
- Open a web browser and enter the IP address of your router (commonly
-
Find the DHCP Reservation Section:
- This is usually under "LAN Setup," "DHCP Settings," or similar.
-
Add a Reservation:
- Enter the MAC address of your network card (you can find it using
ip a). - Assign the IP address
192.168.0.191.
- Enter the MAC address of your network card (you can find it using
-
Save the Configuration:
- Save and apply the changes.
- Restart your Ubuntu machine or network service.
Setting a static IP address ensures that your machine always has the same IP, which can be especially useful for network services, port forwarding, and remote access.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.