My Debian System uses the network manager, so how do I set up a fixed IP address
To set up a fixed IP address on Debian using Network Manager, you can follow these steps:
-
Open the Network Manager by clicking on the network icon in the top right corner of the screen and selecting "Edit Connections."
-
Select the network connection you want to set a fixed IP address for and click "Edit."
-
In the IPv4 Settings tab, change the Method dropdown from "Automatic (DHCP)" to "Manual."
-
Click "Add" to add a new IP address, subnet mask, and default gateway.
-
Enter the IP address, subnet mask, and default gateway that you want to use for your connection.
-
Optionally, you can also add DNS servers under the DNS tab.
-
Click "Save" to save the changes.
-
Close the Network Manager and restart the network service with the following command:
sudo systemctl restart networking
After completing these steps, your Debian system should now have a fixed IP address assigned to the selected network connection.
How do I modify the above methods through nmtui
You can modify the network settings of a connection using the nmtui tool by following these steps:
-
Open the terminal on your Debian system.
-
Type
nmtui
and press Enter to open the Network Manager Text User Interface. -
Navigate to the connection you want to modify using the arrow keys.
-
Press Enter to select the connection.
-
Navigate to the "Edit a connection" option and press Enter.
-
Navigate to the "IPv4 CONFIGURATION" option and press Enter.
-
Change the "Method" from "Automatic" to "Manual" using the arrow keys.
-
Navigate to the "Addresses" option and press Enter.
-
Use the arrow keys to select "Add" and press Enter to add a new IP address.
-
Enter the IP address, subnet mask, and default gateway that you want to use for your connection.
-
Optionally, you can also add DNS servers under the "DNS servers" option.
-
Press Tab to move to the "OK" button and press Enter to save the changes.
-
Press Tab to move to the "Back" button and press Enter to exit the editing screen.
-
Press Tab to move to the "Quit" button and press Enter to exit the nmtui tool.
After completing these steps, your Debian system should now have a fixed IP address assigned to the selected network connection.
How to set a fixed IP address using the nmcli command
To set a fixed IP address using the nmcli command in Debian, you can follow these steps:
-
Open the terminal on your Debian system.
-
Use the following command to display a list of available network connections:
nmcli con show
-
Find the name of the connection you want to set a fixed IP address for and make note of it.
-
Use the following command to set a fixed IP address for the selected connection:
sudo nmcli con mod <connection_name> ipv4.method manual ipv4.addresses <ip_address>/<subnet_mask> ipv4.gateway <default_gateway> ipv4.dns <dns_server_address>
Make sure to replace <connection_name>
, <ip_address>
, <subnet_mask>
, <default_gateway>
, and <dns_server_address>
with the actual values for your network configuration.
For example, if you want to set a fixed IP address of "192.168.1.100" with a subnet mask of "255.255.255.0" and a default gateway of "192.168.1.1" and a DNS server of "8.8.8.8" for a connection named "eth0", the command would be:
sudo nmcli con mod eth0 ipv4.method manual ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.dns 8.8.8.8
-
After entering the command, press Enter to execute it.
-
Use the following command to verify that the changes have been applied:
sudo nmcli con show <connection_name> | grep -w "IP4.ADDRESS\|IP4.GATEWAY\|IP4.DNS"
Make sure to replace <connection_name>
with the name of the connection you just modified.
For example, if you modified a connection named "eth0", the command would be:
sudo nmcli con show eth0 | grep -w "IP4.ADDRESS\|IP4.GATEWAY\|IP4.DNS"
- After verifying the changes, you can exit the terminal.
After completing these steps, your Debian system should now have a fixed IP address assigned to the selected network connection.
Will this method still take effect after restarting
Yes, the changes made using the nmcli
command will persist after restarting your Debian system. The modified connection will have the fixed IP address configuration even after a reboot or network service restart.