Home > Linux HOWTOs > Ubuntu Server 10.04 LTS: Setup Networking

Ubuntu Server 10.04 LTS: Setup Networking

How to set up the networking in ubuntu server 10.04 LTS, may work on other debian based distributions too:
We’re going to use vi or vim to edit the /etc/network/interfaces

  • First make sure which of your interfaces is used for internet and which for local networking. Check what type and what is your ip (DHCP or STATIC).

Let’s say /dev/eth1 is the interface used for WAN and /dev/eth0 is the LAN interface of your machine.

  • Now if you have static IP edit your /etc/network/interfaces

sudo vi /etc/network/intrerfaces

# 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

# The primary network interface
auto eth1
iface eth1 inet static
address 17.252.169.74
netmask 255.255.255.0
network 17.252.169.0
broadcast 17.252.169.255
gateway 17.252.169.1
dns-nameservers 80.80.128.161 80.80.128.193

# The local network interface
auto eth0
iface eth0 inet static
address 192.168.12.1
netmask 255.255.255.0
network 192.168.12.0
broadcast 192.168.12.255

Now iface eth1 inet static can be changed to dhcp if you have a dynamic ip address and delete the other lines with options.
address is your ip address
netmask is your network mask (usualy 255.255.255.0 or 255.255.0.0)
network is your network address (just like your ip, but the last part is 0)
broadcast is your network’s broadcast address (just like your ip, but usualy ending on 255)
dns-nameservers are the DNS servers you’re using, you can enter up to 3 separated by space
gateway is the address of your internet gateway

  • Next add the following line in the /etc/resolv.conf file
    (change the numbers to your DNS addresses)

name server 80.80.128.161 80.80.128.193

  • Restart the networking (or the system if needed):

sudo /etc/networking restart

  • Next Step Is Optional:
    • Test your connectivity by pinging some working ip address

ping 4.2.2.2

or

ping 8.8.8.8

or

ping google.com

If you have replies your network is working.

Categories: Linux HOWTOs
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.