I am trying to set up a network connection on my Linux machine, but I am having trouble with the networking commands. I want to assign the IP address 192.168.1.100 to my network interface eth0, but the command I am using is not working.
Here is the code I am using:
The error message I get is: "SIOCSIFADDR: No such device". I realize that the ifconfig command is deprecated and I need to use the ip command instead. The correct code should be:
This will assign the IP address 192.168.1.100 to the eth0 network interface. I also need to make sure that the network interface is up and running before assigning the IP address. From this article, I understand that once a server is operational, it can be used to assign an IP address to an interface and enable or disable the interface as needed but I need more information. I can do this with the following command:
Here is the code I am using:
Code:
ifconfig eth0 192.168.1.100
Code:
ip addr add 192.168.1.100/24 dev eth0
Bash:
ip link set dev eth0 up