Tuesday, August 25, 2009

how to set a static ip in ubuntu linux

taken from here

make sure to run everything as root if you dont want to sudo on every command

# nano /etc/network/interfaces

and you will have something like this

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
mapping hotplug
script grep
map eth0

# The primary network interface
iface eth0 inet dhcp

assuming that your network is on eth0.
change the line 'iface eth0 inet dhcp' to 'iface eth0 inet static'
and add
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
below so the lines would be like
# The primary network interface
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
and just restart your network by typing
# /etc/init.d/networking restart

0 comments: