How to: Enable DHCP and Networking on Ubuntu Server

How to: Enable DHCP and Networking on Ubuntu Server

By default this is not an issues as you can configure networking from the setup wizard when you initially deploy your server. I unfortunately had some issues with networking with my VM so when I finally solved them I realized the Ubuntu Server had no network connectivity. I am not a huge fan of non-gui OSes for that reason, you need to type commands you don’t know to get things working. This goes for Windows Server Core as well… I do love what you can do with PowerShell but for mundane tasks I am happy with my GUI. I digress… in the case of Ubuntu you need to identify your network card and in the networking configuration allow it to automatically obtain an address from the DHCP server (alternatively you could set up a static IP address).

To quickly identify all available Ethernet interfaces, you can use the ifconfig command as shown below.

ifconfig -a | grep eth

To configure your server to use DHCP for dynamic address assignment, add the dhcp method to the inet address family statement for the appropriate interface in the file /etc/network/interfaces. The example below assumes you are configuring your first Ethernet interface identified as eth0.

auto eth0
iface eth0 inet dhcp

By adding an interface configuration as shown above, you can manually enable the interface through the ifup command which initiates the DHCP process via dhclient.

sudo ifup eth0

To manually disable the interface, you can use the ifdown command, which in turn will initiate the DHCP release process and shut down the interface.

sudo ifdown eth0

Static IP Address Assignment

To configure your system to use a static IP address assignment, add the static method to the inet address family statement for the appropriate interface in the file /etc/network/interfaces. The example below assumes you are configuring your first Ethernet interface identified as eth0. Change the address, netmask, and gateway values to meet the requirements of your network.

auto eth0
iface eth0 inet static
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.1

By adding an interface configuration as shown above, you can manually enable the interface through the ifup command.

sudo ifup eth0

To manually disable the interface, you can use the ifdown command.

sudo ifdown eth0

I obtained this from the Ubuntu website where you can find more information on how to configure things like routing, etc: https://help.ubuntu.com/10.04/serverguide/network-configuration.html

Enhanced by Zemanta

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.