I have installed Ubuntu server edition on a computer. During the installation I skipped the network configuration, and now I don't know how to connect to the internet via LAN / Ethernet.
Asked
Active
Viewed 2.4k times
1 Answers
7
First, verify that you have a valid ethernet interface; ideally eth0:
ifconfig
See if you can connect temporarily:
sudo dhclient eth0
If you connect, edit /etc/network/interfaces to set a static IP address appropriate for a server:
sudo vim /etc/network/interfaces
I suggest the following, adjusted, of course to suit your network:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 192.168.1.1
Save the file and quit vim. Be sure to use an IP address outside the range of the DHCP pool in the router so as to avoid collisions. Get the system to read and use the changes:
sudo ifdown eth0 && sudo ifup -v eth0
Check:
ping -c3 www.google.com
If you get ping returns, you are all set.

chili555
- 60,188
-
Thanks it works!!! for the wlan0 i can use the same procedure? – ad3luc Oct 01 '15 at 13:37
-
@ad3luc The process is slightly different for wireless. Please see: http://askubuntu.com/questions/464507/ubuntu-14-04-server-wifi-wpa2-personal/464552#464552 If you need further assistance, please start a new question. – chili555 Oct 01 '15 at 13:41