Configure a command line IP address in Linux


We are working on the linux ifconfig command

1. Set your IP address

the ip address is the logical address to identify your machine on the local network

root @ easytuto: ~ # ifconfig eth0 netmask up

2. Set your default gateway:

the default gateway is the address of the nearest network machine (example router)

root @ easytuto: ~ # route add default gw

3. Define your DNS server

with DNS server you can connect to the internet

the address for the dns server is the address of your gateway or ip address of google

root @ easytuto: ~ # echo “nameserver”> /etc/resolv.conf

Test by pinging

root @ easytuto: ~ # ping


I am an avid Linux lover and open source enthusiast. I use Ubuntu and believe in sharing knowledge. Apart from Linux, I love classic detective mysteries.

One thought on “Configure a command line IP address in Linux

Leave a Reply