How to Change IP Address on Linux (Terminal Commands)
Tutorial shows you, how to change IP address on Linux using terminal commands (set a static IP in Linux), Set IP address, Default Gateway and DNS server manually and get an IP address from DHCP server
Find IP address Linux:
The “ifconfig” command is used for displaying current network configuration information.
Find default gateway Linux:
The “route” command is used for displaying default Gateway.
Find DNS server IP Linux:
The “cat /etc/resolv.conf” command is used for displaying DNS Server IP Address.
Setting your IP manually
To assign an IP address on a Linux, you need to use following commands, example:
Command to change IP address:
“sudo ifconfig eth0 192.168.1.112/24”
Command to add default gateway:
“sudo route add default gw 192.168.1.1”
Command to add DNS server IP:
“echo nameserver 192.168.1.1 “Type BRACKET” /etc/resolv.conf”
Note for DNS command: If you are not login as a root you may get Error :
(bash: /etc/reslov.conf: Permission denied),
So, first type “sudo su” command and then type DNS command.
In order to get an IP from a DHCP server, example:
First type “sudo dhclient -r eth0” to release your IP address.
Then type “sudo dhclient eth0” to renew it.
Subscribe To My Channel and Get More Great Tips:
https://www.youtube.com/subscription_center?add_user=krestsss
Share this Video:
Other videos:
How to Change IP Address on Android Tablet – step by step tutorial
How to change ip address on windows 8 computer
How to change ip address on windows 7 computer
How to Change IP Address Easily Using Batch File Script
ip address