How do I assign temporary IP address in Linux system?

To apply changes in machine using below commands make sure you have super user privileges.

Command to add temporary IP address on network interface eth0.

# ifconfig eth0 netmask

Command to add default gateway for network interface eth0.

# route add default gw

Command to verify the IP address has been assigned successfully.

# ifconfig

Command to verify the default gateway address assigned successfully.

# route

Kindly note this static IP address is assigned for temporary use Hence after reboot of machine or restart of network service can loose this static IP address which can be apply again with the above same commands.

Design by SanjuD (@ngineerbabu)