Assigning IP address via Command line

Sometimes, assigning IP address using command line is much more easier than
using Network manager applet, here are the SYNTAX with examples:

Assigning IP address:

SYNTAX:
ifconfig <INTERFACE> <IP-ADDRESS> netmask <NETMASK>

example:
ifconfig eth0 192.168.1.11 netmask 255.255.255.0
Adding gateway:

SYNTAX:
route add default gw <GATEWAY-IP> <INTERFACE>

example:
route add default gw 192.168.1.1 eth0

 

Adding DNS:

Add following line(s) in your /etc/resolv.conf file

SYNTAX:
nameserver <DNS-IP>

example:
nameserver 10.101.1.12
nameserver 10.101.1.13