Search this site

Wednesday, February 22, 2012

Ubuntu Linux: Network configuration from command Line! Setting IP address, default gateways, and DNS servers for accessing Internet/network on a LAN.

Here is an easy sample for configuring Network Settings in Ubuntu Linux:

Assumptions: You want to set IP address of your system as 10.1.1.8 at eth0 interface (ethernet or LAN, RJ-45 Cable port), with default gateway as 10.1.1.1 and DNS servers as 208.67.220.220 and 208.67.222.222.
  • To check existing network settings
$ ifconfig -a

  • Setting IP address and netmask:
    To activate network interface eth0 with IP address ( 10.1.1.8 ) and netmask (255.255.255.0):
$ sudo ifconfig eth0 10.1.1.8 netmask 255.255.255.0 


         Shutting down eth0:

sudo ifconfig eth0 down


       Bring up eth0:

sudo ifconfig eth0 up

  • To see the existing routing table
$ route –n
  • Setting default gateway(10.1.1.1)
$ sudo route add default gw 10.1.1.1
  • Setting DNS servers
Open the file: /etc/resolv.conf

$ sudo vi /etc/resolv.conf

Write DNS Servers:
nameserver 208.67.220.220
nameserver 208.67.222.222



Test:

ping technologydwell.com


No comments:

Post a Comment