16 June 2010

Configuring the IP address for ethernet in Ubuntu 8

Network Configuration Using DHCP
Edit the file / etc / network / interfaces:
sudo vi / etc / network / interfaces
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp

Static IP Configuration
sudo vi / etc / network / interfaces
# The primary network interfaceauto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
 

broadcast 192.168.3.255
 

Restart the network by using the command:
sudo / etc / init.d / networking restart


Virtual IP Configuration
If we want to set the second IP on the same ethernet, edit the interfaces file back:
sudo vi / etc / network / interfaces
auto eth0: 1
iface eth0: 1 inet static
address 192.168.1.60
 

netmask 255.255.255.0 
network x.x.x.x
Broadcasts x.x.x.x
gateway x.x.x.x

No comments: