Thursday, November 26, 2009

Configuration Network on Ubuntu

The Transport Control Protocol/ Internet Protocol (TCP/IP) based combination of three protocols, consists of the Internet Protocol (IP),Transport Control Protocol (TCP), and Universal Datagram Protocol (UDP).

To edit your system’s network device information or to add or remove network devices on your system by the ifconfig command at the shell prompt or Ubuntu’s graphical network configuration tools, such as network-admin.

For configuring DHCP address needed to edit the /etc/network/interfaces and enter the following lines replace eth0 with your network interface card.

Open terminal (Application ==> Accesories ==> Terminal) and type this code :

sudo vi /etc/network/interfaces

and then press enter, input your ubuntu password.

Replace eth0 with your network interface card.

Example display :

# The primary network interface – use DHCP to find our address
auto eth0
iface eth0 inet static
address 192.168.7.90
gateway 192.168.7.1
netmask 255.255.255.0
network 192.168.7.0
broadcast 192.168.7.255

After entering all the details you need to restart networking services using the following command :

sudo /etc/init.d/networking restart

For setting up Second IP address or Virtual IP address in Ubuntu you need to assign a second ipaddress to your Ubuntu machine.For this you need to edit the /etc/network/interfaces file and you need to add the following syntax.
Below is the only example you need to change according to your ip address settings :

auto eth0:1
iface eth0:1 inet static
address 192.168.1.60
netmask 255.255.255.0
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x


For setting your ubuntu system hostname by directly query, or set the hostname with the hostname command.

sudo /bin/hostname

more about how to setup host name read here

To cause your machine to consult with a particular server for name lookups you simply add their addresses to /etc/resolv.conf

Open terminal and type this command :

sudo vi /etc/resolv.conf

enter the following example details like this :

search yourlocaldomain.com
nameserver 192.168.3.2

source : http://www.ubuntugeek.com/ubuntu-networking-configuration-using-command-line.html.