• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomeLinuxSet Static IP address in Ubuntu
Previous Next

Set Static IP address in Ubuntu

Posted by: Alvin Jin , March 27, 2014

1. Configure static ip address

$sudo vi /etc/network/interfaces

There are  only the following two lines in the original content:

auto lo

iface lo inet loopback

Append the following content to the end:

auto eth0

iface eth0 inet static

address 192.168.x.xxx

gateway 192.168.x.xxx

netmask 255.255.255.0

network 192.168.x.xxx

broadcast 192.168.0.255

Then save and exit;

address :Set IP address
gateway:gateway
netmask:subnet mask
broadcast:broadcast address

2. Manually configure dns

$sudo vi /etc/resolv.conf

Append the following content to the end:

nameserver 192.168.x.xxx

Then save and exit.

3 Restart the network for the changes to take effect

$sudo /etc/init.d/networking restart

when you restart ubuntu, could not access the network,this problem caused by  /etc/resolv.conf. when it starts,dns configuration file has been modified automatically to the default values. So they need a permanent modification DNS.  The method as follows:

cd /etc/resolvconf/resolv.conf.d/

# cat base

nameserver 8.8.8.8

Tags: Linux

Share!
Tweet

Alvin Jin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors