0

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.

5

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.

  • Thanks it works!!! for the wlan0 i can use the same procedure? – ad3luc Oct 1 '15 at 13:37
  • @ad3luc The process is slightly different for wireless. Please see: askubuntu.com/questions/464507/… If you need further assistance, please start a new question. – chili555 Oct 1 '15 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.