Added some network setup info
This commit is contained in:
parent
56ca148aa0
commit
1d12c63953
@ -23,8 +23,14 @@
|
||||
- [Preparing to Build](installation/source/preparing.md)
|
||||
- [Building HitchHiker](installation/source/building-hitchhiker.md)
|
||||
- [Post Install Configuration](configuration/README.md)
|
||||
- [Setting the root password](configuration/password.md)
|
||||
- [Setting the timezone](configuration/timezone.md)
|
||||
- [Setting the hostname](configuration/hostname.md)
|
||||
- [Adding a User Account](configuration/users.md)
|
||||
- [Setting up Networking](configuration/networking.md)
|
||||
- [Setting up Networking](configuration/networking/README.md)
|
||||
- [Wired Connection](configuration/networking/wired.md)
|
||||
- [Wireless Connection](configuration/networking/wireless.md)
|
||||
- [Creating the service definition](configuration/networking/service-definition.md)
|
||||
- [Managing Processes](s6/README.md)
|
||||
- [Installing Third Party Software](pkgsrc/README.md)
|
||||
- [Getting Pkgsrc](pkgsrc/getting-pkgsrc.md)
|
||||
|
@ -1 +1,3 @@
|
||||
# Post Install Configuration
|
||||
This section describes the steps which should be taken to configure a
|
||||
freshly installed system on first boot.
|
||||
|
14
src/configuration/hostname.md
Normal file
14
src/configuration/hostname.md
Normal file
@ -0,0 +1,14 @@
|
||||
# Setting the hostname
|
||||
The hostname is set during the boot process to the contents of the file
|
||||
`/etc/hostname`. Edit this file with either `vi` or `ee`. The hostname
|
||||
takes the form of `hostname.domain`, where the domain is entirely
|
||||
optional.
|
||||
|
||||
Editing this file will cause the hostname to be set correctly on the
|
||||
next boot (and subsequently thereafter). However, it will not take
|
||||
effect until after reboot. In order to set the hostname now, use the
|
||||
`hostname` command with your desired hostname as it's argument.
|
||||
```Sh
|
||||
# Example - set the hostname to zaphod.heartofgold.net
|
||||
hostname.heartofgold.net
|
||||
```
|
@ -1 +0,0 @@
|
||||
# Setting up Networking
|
20
src/configuration/networking/README.md
Normal file
20
src/configuration/networking/README.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Setting up Networking
|
||||
The first step in setting up our network is to determine the name of
|
||||
the network device that we are going to connect with. We're goind to
|
||||
start by running the `ip` command to list our interfaces, and then once
|
||||
that is done we can move on to setting up our connection in one of the
|
||||
following subsections for *wired* or *wireless* as appropriate.
|
||||
```Sh
|
||||
ip link show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
|
||||
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
|
||||
link/ether dc:a6:32:2a:97:94 brd ff:ff:ff:ff:ff:ff
|
||||
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DORMANT group default qlen 1000
|
||||
link/ether ca:d0:a4:6c:cf:5d brd ff:ff:ff:ff:ff:ff permaddr dc:a6:32:2a:97:95
|
||||
```
|
||||
The results for `1: lo ...` represent the *loopback* interface. We also
|
||||
see an ethernet device `eth0` and a wireless device `wlan0`. To configure
|
||||
the ethernet interface `eth0` go ahead to the section
|
||||
[wired](wired.md). If instead you intend to use the wireless interface
|
||||
`wlan0` proceeed to section [wireless](wireless.md).
|
1
src/configuration/networking/service-definition.md
Normal file
1
src/configuration/networking/service-definition.md
Normal file
@ -0,0 +1 @@
|
||||
# Creating the service definition
|
68
src/configuration/networking/wired.md
Normal file
68
src/configuration/networking/wired.md
Normal file
@ -0,0 +1,68 @@
|
||||
# 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: <BROADCAST,MULTICAST> 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: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
|
||||
```
|
||||
Notice that instead of `<BROADCAST,MULTICAST>` it now says
|
||||
`<NO-CARRIER,BROADCAST,MULTICAST,UP>`.
|
||||
|
||||
## 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
|
||||
```
|
22
src/configuration/networking/wireless.md
Normal file
22
src/configuration/networking/wireless.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Wireless Connection
|
||||
There are a few extra steps which must be performed in order to set up
|
||||
a wireless network connection. While there are a number of gui tools
|
||||
designed to manage the connection with a point and click interface, the
|
||||
[wpa_supplicant](https://w1.fi/wpa_supplicant/) tool is often what is
|
||||
invoked as the backend for such tools. It is both simple to set up
|
||||
manually and more reliable than most other tools. Most importantly, it
|
||||
comes as part of the HitchHiker Linux base install.
|
||||
|
||||
> **Note:** It is perfectly possible to set up a wireless association
|
||||
> using the `iwconfig` program rather than `wpa_supplicant`, and this
|
||||
> will have the advantage of not requiring another daemon to run. Since
|
||||
> wireless connections are often used in the context of a roaming setup,
|
||||
> ie a laptop which will be carried from place to place and connected
|
||||
> to various networks, wpa_supplicant is *usually* preferred. However if
|
||||
> you have a device which will never roam yet cannot connect via a wired
|
||||
> interface, the manual page for `iwconfig` gives instructions for
|
||||
> associating a wireless network this way.
|
||||
|
||||
The first step in connecting is exactly as for a wired connection, setting
|
||||
the interface state to UP. For instructions refer back to the
|
||||
[wired](wired.md) subchapter.
|
1
src/configuration/password.md
Normal file
1
src/configuration/password.md
Normal file
@ -0,0 +1 @@
|
||||
# Setting the root password
|
55
src/configuration/timezone.md
Normal file
55
src/configuration/timezone.md
Normal file
@ -0,0 +1,55 @@
|
||||
# Setting the timezone
|
||||
HitchHiker will default to Eastern Standard Time in the United States.
|
||||
If this is incorrect for where you reside, create the file `/etc/tz`
|
||||
and edit it's contents to set the variable `TZ` to point to the correct
|
||||
timezone. You can determine what the correct timezone should be by
|
||||
running the command `tzselect`.
|
||||
|
||||
Let's give as an example someone living in Stockholm, Sweden.
|
||||
```Sh
|
||||
Please identify a location so that time zone rules can be set correctly.
|
||||
Please select a continent, ocean, "coord", or "TZ".
|
||||
1) Africa 7) Australia
|
||||
2) Americas 8) Europe
|
||||
3) Antarctica 9) Indian Ocean
|
||||
4) Arctic Ocean 10) Pacific Ocean
|
||||
5) Asia 11) coord - I want to use geographical coordinates.
|
||||
6) Atlantic Ocean 12) TZ - I want to specify the timezone using the Posix TZ format.
|
||||
#? 8
|
||||
Please select a country whose clocks agree with yours.
|
||||
1) Åland Islands 9) Bulgaria 17) Germany 25) Jersey 33) Montenegro 41) San Marino 49) Ukraine
|
||||
2) Albania 10) Croatia 18) Gibraltar 26) Latvia 34) Netherlands 42) Serbia 50) Vatican City
|
||||
3) Andorra 11) Cyprus 19) Greece 27) Liechtenstein 35) North Macedonia 43) Slovakia
|
||||
4) Austria 12) Czech Republic 20) Guernsey 28) Lithuania 36) Norway 44) Slovenia
|
||||
5) Belarus 13) Denmark 21) Hungary 29) Luxembourg 37) Poland 45) Spain
|
||||
6) Belgium 14) Estonia 22) Ireland 30) Malta 38) Portugal 46) Sweden
|
||||
7) Bosnia & Herzegovina 15) Finland 23) Isle of Man 31) Moldova 39) Romania 47) Switzerland
|
||||
8) Britain (UK) 16) France 24) Italy 32) Monaco 40) Russia 48) Turkey
|
||||
#? 46
|
||||
|
||||
The following information has been given:
|
||||
|
||||
Sweden
|
||||
Germany (most areas), Scandinavia
|
||||
|
||||
Therefore TZ='Europe/Berlin' will be used.
|
||||
Selected time is now: Tue Sep 6 17:46:11 CEST 2022.
|
||||
Universal Time is now: Tue Sep 6 15:46:11 UTC 2022.
|
||||
Is the above information OK?
|
||||
1) Yes
|
||||
2) No
|
||||
#? 1
|
||||
|
||||
You can make this change permanent for yourself by appending the line
|
||||
TZ='Europe/Berlin'; export TZ
|
||||
to the file '.profile' in your home directory; then log out and log in again.
|
||||
|
||||
Here is that TZ value again, this time on standard output so that you
|
||||
can use the /usr/bin/tzselect command in shell scripts:
|
||||
Europe/Berlin
|
||||
```
|
||||
This user would then create the file `/etc/tz` with the following
|
||||
contents.
|
||||
```Sh
|
||||
TZ="Europe/Berlin"
|
||||
```
|
@ -1 +1,24 @@
|
||||
# Adding a User Account
|
||||
It is bad practice to log in as the root user on any Unix-like system
|
||||
for anything other than performing system administration tasks. You will
|
||||
want to create a user account for yourself as soon as possible. This is
|
||||
done using the `useradd` command. We're goind to give an example here.
|
||||
However, it is good to familiarize yourself with the various flags and
|
||||
arguments by looking up and reading the man page using the command
|
||||
`man useradd`.
|
||||
|
||||
It is quite likely that you will not get everything exactly correct the
|
||||
first time. It is also likely that at some future time you may wish to
|
||||
edit some characteristic of the created user, such as supplementary
|
||||
groups to which this user belongs.
|
||||
|
||||
While we're on the subject of supplmentary groups, it is a good idea to
|
||||
make your own user account a member of the `wheel` group, allowing you
|
||||
to `su` to the root user account.
|
||||
|
||||
## Our example
|
||||
Our example user is Ford Prefect.
|
||||
```Sh
|
||||
useradd -G wheel -m -s /bin/zsh -c "Ford Prefect" ford
|
||||
passwd ford
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user