People often forget the process for assigning a static IP address from the Linux command line. Most actually feel too intimidated by the process to commit it to memory, but it’s actually very simple.
Here’s how to get networking all the way up in a matter of seconds using just three commands.
Change the IP and netmask to match your own, obviously.
1. Set Your IP Address
ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
2. Set Your Default Gateway
route add default gw 192.168.1.1
3. Set Your DNS Server
Yes, 184.108.40.206 is a real DNS resolver by CloudFlare.
echo "nameserver 220.127.116.11" > /etc/resolv.conf
Assuming you have valid addresses for yourself and your gateway (and you have a clear path the the Interweb) you’re all set. Test by pinging someone.
Hopefully now you’re up and running!
And finally, here’s how to make the change permanent in various environments.