# Wired Connection A wired ethernet connection is the simplest to set up. All that is required is to give the interface an ip address and routing. This can be done statically or via dhcp. After getting the connection working, we'll create an s6-rc service definition so that on every boot the network will be properly configured at boot time. # Bringing the interface Up The first step in setting up any network interface is making sure that the interface is up. This is an example of the output of `ip link show` for an interface which is down. ```Sh 2: eno1: mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000 ``` To power on this device we need to bring it up with the following command, replacing `eno1` with the name of your actual device. ```Sh ip link set eno1 up ``` We then verify that the device is in fact up by running `ip link show` again and checking that the device is UP. ```Sh % ip link show eno1 2: eno1: mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000 ``` Notice that instead of `` it now says ``. ## Getting a dynamic ip using dhcpcd HitchHiker comes with the [dhcpcd](https://roy.marples.name/projects/dhcpcd/) client for dynamic network configuration. This is the quickest way to configure a network interface. ```Sh # Get a dynamic ip address for the eth0 interface dhcpcd eth0 ``` ## Setting a static ip A Static ip address can be configured by once again using the `ip` command, this time with it's `address` subcommand. We're going to use [CIDR Notation](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) here to also set a correct network prefix and broadcast. Most users will have a subnet mask of 255.255.255.0, with 24 leading 1-bits. Don't worry if some of this is beyond your understanding, the commands should work even if you don't understand every aspect. ```Sh # Set the ip address to 192.168.1.5 ip address add 192.168.1.5/24 broadcast + dev eth0 ``` After setting the ip address, we next need to set up a route for this device to reach the rest of the network. This is done once again with the `ip` command, this time using the `route` subcommand. ```Sh # Route goes through our router which has the internal ip 192.168.1.1 ip route add default via 192.168.1.1 eth0 ``` There is one more step to configuring a network interface manually. If we configure a dynamic address via dhcpcd, the client also configures domain name resolution for us. When you configure an interface manually this is something that you must do yourself. Edit the file `/etc/resolv.conf` to set a primary and a secondary dns resolver. You can use the Google dns resolvers at 8.8.8.8 and 8.8.4.4 or, if you prefer, there is a list of public DNS servers at [public-dns.info](https://public-dns.info/). ```Sh # /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 ```