I am using Ubuntu 10.04 with KDE on it.

I am facing a problem in connecting to a wired LAN internet connection.

I want to connect to wired internet connection with static IP and authentication.

How can I manage this via terminal?

4 Answers 4


How to configure the network interface using the terminal

You can configure a network interface from the command line using the networking utilities. You configure your network client hosts with the command line by using commands to change your current settings or by editing a number of system files. To configure your network interface card to automatically connect when wired cable is connected you can follow this "simple" steps:

  1. Configuring DHCP address for your network card

To configure DHCP address, edit the /etc/network/interfaces and enter the following lines replacing eth0 in the example with your network interface card:

`sudo nano /etc/network/interfaces`

You should see something similar to this:

    auto eth0  
    iface eth0 inet dhcp

in my computer it looks like this:

    auto lo  
    iface lo inet loopback

So if your network card appears as eth2 for example then you would leave the file like this:

    auto eth2  
    iface eth2 inet dhcp
  1. Just in case you want to configure a static IP address for your network card

Same procedure as above but you would need to include more information.

Like above, replace eth0 with your networks card name:

sudo nano /etc/network/interfaces

Example File:

    auto eth0  
    iface eth0 inet static  

After entering all the details which are needed for your static IP you would need to restart networking services using the following command:

sudo /etc/init.d/networking restart

  1. Setting up DNS

You can add hostname and/or IP addresses to the file /etc/hosts for static lookups.

To cause your machine to consult with a particular server for name lookups you simply add their addresses to /etc/resolv.conf.

For example a machine which should perform lookups from the DNS server at IP address would have a resolv.conf file looking like this:

sudo nano /etc/resolv.conf

    search test.com  

in my case it looks like this:

    search cantv.net 
  • 1
    That's the fourth time I've visited this answer to solve this same problem. I'm putting sudo /etc/init.d/networking restart into a shell script and giving you an upvote. May 26, 2019 at 21:13

most answers on this issue are most likely to confuse readers when demostrating what to put in the /etc/resolv.conf because they use local addresses for the nameserver.

"For example a machine which should perform lookups from the DNS server."

Here DNS server and nameserver mean the same thing. So instead of placing a LAN address in there, put an actual DNS server address. (ie. Google DNS server)


this link explains the used of the resolv.conf file in more depth. https://theos.in/desktop-linux/resolve-conf-linux-example/


In my case, what worked is:

echo "nameserver" >/run/resolvconf/resolv.conf
ping -c 5 www.google.com 

If it does not work, run:

ip link set enpxxx down
ip link set enpxxx up
dhclient enpxxx

ping should work now.

ping -c 5 www.google.com 

I found this solution on this page of the ubuntu (french) wiki


With nmcli is dead easy

nmcli connection show

Then use the device name to connect

nmcli connection up uuid <device UUID>
  • I can see available connections, but can connect to selected one. Error: Connection activation failed:No suitable device found for this connection
    – arilwan
    May 17, 2023 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .