How To Assign Ip Address In Linux Command Line?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Log in to the server as the root user.
2. To view the current IP configuration, run the command “ifconfig”.
3. To configure a static IP address, open the network configuration file by running the command “nano /etc/network/interfaces”.
4. Enter the following information within the file:
auto eth0 iface eth0
inet static address
192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1 5.
To save the file and apply the new changes, press Ctrl+X, then Y and hit enter.
6. Run the command “ifup eth0” to assign the IP address to the interface.
7. Finally, run the command “ifconfig” to check if the new IP address has been successfully assigned.