Setup Internet DHCP

From Manjaro Linux
Jump to: navigation, search

Why get into this stuff?

The possibilities that I see are these:

  • You can connect to the internet in a wired fashion, hardware wise.
  • You install a GNU/Linux system & can't get internet access.
  • Your GUI NetworkManager or the like network software is broken.
  • You for whichever of the number of reasons don't want to use NetworkManager or any other similar GUI intermediary between you & your system's configuration.

Be Prepared

Note: This page is motivated by the knowledge 
of how much it sucks to not be able to connect
to the net to get the info or packages that you
need to get out of trouble.

If you fall into the following category take this information & print it out & store it, or save it somewhere safe so you can always get at it (even if your HDD has just turned itself into a lathe!):

  • If you can have a wired connection to the net, this info in most cases will make it work for you. You can sort out static IP addresses & such once you are online & have access to the web for reference (if need be).

The following is a section lifted from the Archwiki & modified/simplified.

Gather important information

Persistent Device Naming

First off, due to Persistent Device Naming having been recently (as of this writing) born, some of us are using it & others (on older installs or they've turned it off) aren't using it (see link at bottom of page). So we need to run the following command to see what our ethernet port(s) are currently called:

$ ls /sys/class/net

The result will be in the style of the old way - eth0:

Or the new - enp0s25:

Do not use the @ that the above command places at the end of the address.

It may be a good idea to run the ls /sys/class/net command now to see what your system is using & if you are keeping a copy of what matters to you from this post or directly from the Archwiki, it may be a good idea to edit your copy of the page to suit you for possible future reference.

Dynamic IP address

Manually run DHCP Client Daemon (if it happens to be running already, this will cause no problems).

Enter following code:

# dhcpcd eth0

This is the kind of output to expect:

dhcpcd: version 5.1.1 starting
dhcpcd: eth0: broadcasting for a lease
dhcpcd: eth0: leased for 86400 seconds

And now this command:

$ ip addr show dev eth0

should show your inet address, which is not needed to get your system connected to the web using DHCP & a dynamically allocated IP internet address for your machine.

To run DHCP at boot - SystemD

To enable DHCP for eth0, simply use:

# systemctl start dhcpcd@eth0

You can enable the service to automatically start at boot with:

# systemctl enable dhcpcd@eth0

To run DHCP at boot - OpenRC

Even easier (if that's possible) to do with OpenRC, to enable dhcpcd to run at system startup. It will run in the background & look for DHCP servers on any of your network interfaces:

# rc-update add dhcpcd default

To make this go into effect without a reboot enter the following command:

# rc

That's it.


Much of the above info came from here [1], it has info on persistent device naming & a link to a page on the topic if you want to know more:

If you have more complex needs to be able to get your system connected to the life line of the internet, then you should copy it from that wiki page & print it &/or store it somewhere safe (I know I keep saying that), that is not on your HDD.


Following is a link to this page's forum counterpart where you can post any related feedback: [2]