Hints and Tips Topic
   >  Changing the Hostname
   >  Finding your IP & Mac Address
   >  Creating Users and Groups
   >  Running Scripts at Startup
   >  Network Interface Configuration
   >  Changing the Grub Default Option

 

Setting up Networking from the Command Line

Setting up Networking from the Command Line

In order to configure or change the networking interfaces attached to your Linux PC, you will need to edit the /etc/network/interfaces file.

.. if you installed Ubuntu server - and you selected auto-LAN configuration at install time - the LAN should have been configured up for you

On a server, if you installed Ubuntu server - and you selected auto-LAN configuration at install time - the LAN should have been configured up for you. If not, you'll need to configure your network from the command line as follows.

Following a vanilla server install, the /etc/network/interfaces file will probably look as follows:

$ more /etc/network/interfaces
# 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

If your network allocates dynamic IPs, add the following block to the end of the /etc/network/interfaces file:

# Added DHCP ethernet interface (Fred Bloggs, 1st January 2011)
auto eth0
iface eth0 inet dhcp

If your network uses static IPs, append the following block instead to the /etc/network/interfaces file:

# Added static ethernet interface (Fred Bloggs, 1st January 2011)
auto eth0
iface eth0 inet static
address  <Static IP Address for the server>
gateway  <IP Address of your router>
netmask  <Hex mask> (e.g. 255.255.255.0)
network  <IP Address> (e.g. 190.162.1.0)
broadcast  <IP Address> (e.g. 190.162.1.255)

Save the changes to the file, then run the following command to restart the networking service and apply the changes:

$ /etc/init.d/networking restart

HomeSite IndexDesktop GuideServer GuideHints and TipsHardware CornerVideo SectionContact Us

 sitelock verified Firefox Download Button