Here is the command to assign IP address to an interface for Linux server.
ip addr add ADDRESS dev IFNAME
Where IFNAME is the interface name and ADDRESS is the IP address you want to assign to the interface.
To add address 192.168.121.45 with netmask 24 to device eth0, you would type:
sudo ip address add 192.168.121.45/24 dev eth0
NIC belongs to the physical layer, IP belongs to the IP layer, they are independent. I would like to ask further questions to figure out the relation between NIC and IP address.
- Is the NIC prerequisite of IP address?
- Must IP address be attached to a NIC?
- Can ip address live alone on IP layer without NIC?