In this tutorial we will learn about how to configure ethernet to get IP address from DHCP Server in Ubuntu and Debian. Configuring the ethernet for getting ip address from DHCP server hardly takes 3-4 Steps.
The tutorial is applicable if you add new ethernet also. Here in this tutorial we have added one more Ethernet or Network Card in the system.
Follow the steps to configure the Ethernet in Ubuntu and Debian
Step 1: After login into the system.First check which Ethernet has not been assigned ip address either manually or via DHCP server.
As per the given below screenshot eth1 does not have any ip address,here we are configuring the eth1 to get IP Address from DHCP server
Step 2: Now edit the /etc/network/interfaces file and add the below given lines for ethernet you want to configure.Below given is a syntax.And next is reference for eth1
Note: Replace ethernet-name with available ethernet in your system. For eg. eth0 ,eth1 etc
iface ethernet-name inet dhcp
sudo vi /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet dhcp
Step 3: Now up the ethernet which was already down or you can restart the networking service also
ifdown ethernet-name (To down the ethernet)
ifup ethernet-name (To up the ethernet)
sudo ifdown eth1 sudo ifup eth1
Alternatively, you can restart the networking service also
sudo service networking restart OR sudo /etc/init.d/networking restart
Step 4: Now check the ip address with
sudo /sbin/ifconfig or ifconfig