Handbuch:IA64/Installation/Netzwerk

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Handbook:IA64/Installation/Networking and the translation is 100% complete.
IA64 Handbuch
Installation
Über die Installation
Auswahl des Mediums
Konfiguration des Netzwerks
Vorbereiten der Festplatte(n)
Installation des Stage Archivs
Installation des Basissystems
Konfiguration des Kernels
Konfiguration des Systems
Installation der Tools
Konfiguration des Bootloaders
Abschluss
Arbeiten mit Gentoo
Portage-Einführung
USE-Flags
Portage-Features
Initskript-System
Umgebungsvariablen
Arbeiten mit Portage
Dateien und Verzeichnisse
Variablen
Mischen von Softwarezweigen
Zusätzliche Tools
Eigener Portage-Tree
Erweiterte Portage-Features
Netzwerk-Konfiguration
Zu Beginn
Fortgeschrittene Konfiguration
Modulare Vernetzung
Drahtlose Netzwerke
Funktionalität hinzufügen
Dynamisches Management


Vielleicht funktioniert es einfach?

Wenn sich Ihr System in einem Ethernet-Netzwerk mit einem DHCP-Server befindet, ist es sehr wahrscheinlich, dass Ihr Netz bereits konfiguriert ist. Sie können nun die zahlreichen Netzwerktools auf dem Installationsmedium wie beispielsweise ssh, scp, ping, irssi, wget und links nutzen.

Verwendung von DHCP

DHCP (Dynamic Host Configuration Protocol) ermöglicht es die gesamte Netzwerkkonfiguration (IP-Adresse, Netzwerkmaske, Broadcast-Adresse, Gateway, DNS-Server etc.) dynamisch von einem Server zu beziehen. Das funktioniert logischerweise nur, wenn Sie einen DHCP-Server in Ihrem LAN haben oder Ihr Provider einen solchen Dienst anbietet. Benutzen Sie dhcpcd:

DHCP requires that a server be running on the same Layer 2 (Ethernet) segment as the client requesting a lease. DHCP is often used on RFC1918 (private) networks, but is also used to acquire public IP information from ISPs.

Tipp
Official Gentoo boot media runs dhcpcd automatically at startup. This behavior can be disabled by adding the nodhcp argument to the boot media kernel commandline.

If it is not already running, dhcpcd can be started on enp1s0 with:

root #dhcpcd eth0

Einige Netzwerkadministratoren erfordern es, dass der Host- und Domainname, die vom DHCP-Server angeboten werdden, vom System genutzt werden. In diesem Fall verwenden Sie:

root #dhcpcd -HD eth0

To stop dhcpcd, -x can be used:

root #dhcpcd -x
sending signal Term to pid 10831
waiting for pid 10831 to exit
Siehe auch
Dhcpcd usage

Das Netzwerk testen

A properly configured default route is a critical component of Internet connectivity, route configuration can be checked with:

root #ip route
default via 192.168.0.1 dev enp1s0

If no default route is defined, Internet connectivity is unavailable, and additional configuration is required.

Basic internet connectivity can be confirmed with a ping:

root #ping -c 3 1.1.1.1
Tipp
It's helpful to start by pinging a known IP address instead of a hostname. This can isolate DNS issues from basic Internet connectivity issues.

Outbound HTTPS access and DNS resolution can be confirmed with:

root #curl --location gentoo.org --output /dev/null

Wenn Sie nun in der Lage sind, Ihr Netzwerk zu verwenden, dann können Sie den Rest dieses Kapitels überspringen und mit dem Vorbereiten der Festplatte(n) fortfahren.

If curl reports an error, but Internet-bound pings work, DNS may need configuration.

If Internet connectivity has not been established, first interface information should be verified, then:

Ermitteln der Interface-Namen

If networking doesn't work out of the box, additional steps must be taken to enable Internet connectivity. Generally, the first step is to enumerate host network interfaces.

Als Alternative zu ifconfig kann zur Anzeige von Interface-Namen das Kommando ip verwendet werden. Das folgende Beispiel zeigt die Ausgabe von ip addr. Die ausgegebenen Daten unterscheiden sich vom letzten Beispiel, weil das ip-Kommando auf einem anderen System eingegeben wurde:

The link argument can be used to display network interface links:

root #ip link
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
4: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether e8:40:f2:ac:25:7a brd ff:ff:ff:ff:ff:ff

The address argument can be used to query device address information:

root #ip addr
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether e8:40:f2:ac:25:7a brd ff:ff:ff:ff:ff:ff
    inet 10.0.20.77/22 brd 10.0.23.255 scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::ea40:f2ff:feac:257a/64 scope link 
       valid_lft forever preferred_lft forever

The output of this command contains information for each network interface on the system. Entries begin with the device index, followed by the device name: enp1s0.

Tipp
Wenn die Ausgabe von ifconfig keine Interfaces anzeigt, starten Sie das Kommando noch einmal mit der Option -a. Mit dieser Option zeigt ifconfig alle vom System erkannten Interfaces, unabhängig davon, ob sie im Zustand "up" oder "down" sind. Wenn ifconfig -a keine Interfaces anzeigt, ist entweder die Hardware defekt oder der erforderliche Kernel-Treiber ist nicht geladen. Beide Fälle können nicht in diesem Handbuch besprochen werden. Bitte kontaktieren Sie #gentoo (webchat) für Hilfe.

In dem Rest dieses Dokuments geht das Handbuch davon aus, dass das genutzte Netzwerk-Interface den Namen eth0 hat.

Als Folge des Wechsels zu predictable network interface names, kann sich der Interface-Name deutlich von der alten "eth0"-Namens-Konvention unterscheiden. Aktuelle Installations-Medien zeigen möglicherweise Namen an wie: eno0, ens1, oder enp5s0. Suchen Sie nach dem Interface in der Ausgabe von ifconfig, das eine IP-Adresse aus Ihrem lokalen Netwerk hat.

Optional: Application specific configuration

The following methods are not generally required, but may be helpful in situations where additional configuration is required for Internet connectivity.

=== Optional: Konfiguration eines Web-Proxies ===

Wenn Sie auf das Internet nur über einen Proxy-Server zugreifen können, müssen Sie während der Installation das System für die Verwendung des Proxy-Servers vorbereiten. Das ist aber recht einfach. Sie müssen dazu lediglich eine Variable mit den Informationen über den Proxy-Server setzen.

Certain text-mode web browsers such as links can also make use of environment variables that define web proxy settings; in particular for the HTTPS access it also will require the https_proxy environment variable to be defined. While Portage will be influenced without passing extra run time parameters during invocation, links will require proxy settings to be set.

In den meisten Fällen können Sie den Hostnamen des Proxy-Servers in die Variable schreiben. Nehmen wir an, der Server ist proxy.gentoo.org und der Port ist 8080.

Hinweis
The # symbol in the following commands is a comment. It has een added for clarity only and does not need to be typed when entering the commands.

Zur Einrichtung eines HTTP-Proxies (für HTTP- und HTTPS-Traffic):

root #export http_proxy="http://proxy.gentoo.org:8080"

Wenn der Proxy-Server einen Benutzernamen und Passwort erfordert, sollten Sie die folgende Syntax in der Variable verwenden:

CODE Adding username/password to the proxy variable
http://username:password@proxy.gentoo.org:8080

Start links using the following parameters for proxy support:

user $links -http-proxy ${http_proxy} -https-proxy ${https_proxy}

Zur Einrichtung eines FTP-Proxies:

root #export ftp_proxy="ftp://proxy.gentoo.org:8080"

Start links using the following parameter for a FTP proxy:

user $links -ftp-proxy ${ftp_proxy}

Zur Einrichtung eines RSYNC-Proxies:

root #export RSYNC_PROXY="proxy.gentoo.org:8080"

Alternativ: Verwendung von PPP

If PPPoE is required for Internet access, the Gentoo boot media includes the pppoe-setup script to simplify ppp configuration.

During setup, pppoe-setup will ask for:

  • The name of the Ethernet interface connected to the ADSL modem.
  • The PPPoE username and password.
  • DNS server IPs.
  • Whether or not a firewall is needed.
root #pppoe-setup
root #pppoe-start

In the event of failure, credentials in /etc/ppp/pap-secrets or /etc/ppp/chap-secrets should be verified. If credentials are correct, PPPoE Ethernet interface selection should be checked.

Alternativ: Verwendung von PPTP

Wenn Sie PPTP-Unterstüzung benötigen, können Sie das Programm pptpclient, das Ihnen von der Installations-CD bereitgestellt wird, verwenden. Allerdings müssen Sie vorher sichergehen, dass Ihre Konfiguration korrekt ist. Dazu editieren Sie die Datei /etc/ppp/pap-secrets oder /etc/ppp/chap-secrets, so dass diese die korrekte Benutzername/Kennwort-Kombination beinhalten.

Edit /etc/ppp/pap-secrets or /etc/ppp/chap-secrets so it contains the correct username/password combination:

root #nano -w /etc/ppp/chap-secrets

Wenn nötig, sollten Sie nun noch /etc/ppp/options.pptp anpassen:

root #nano -w /etc/ppp/options.pptp

Nun geben Sie den Befehl pptp (mit den Optionen, die Sie in options.pptp setzen könnten) ein, um sich mit dem Server zu verbinden.

root #pptp <server ipv4 address>

Vorbereitung für drahtlosen Zugriff

Warnung
Do not use WEP unless it is the only option. WEP provides essentially no security over an open network.
Hinweis
Die Unterstützung für das Kommando iw kann architekturspezifisch sein. Wenn das Kommando nicht verfügbar ist, schauen Sie ob das Paket net-wireless/iw für die gewählte Architektur verfügbar ist. Das Kommando iw wird erst dann zur Verfügung stehen, wenn das Paket net-wireless/iw installiert ist.

Wenn Sie eine WLan-Karte (802.11) benutzen, müssen Sie Einstellungen zur Nutzung der Karte einrichten, bevor es weiter gehen kann. Um sich die aktuellen Einstellungen der Karte anzuschauen, benutzen Sie iw. iw zeigt Ihnen möglicherweise etwas wie dies:

root #iw dev wlp9s0 info
Interface wlp9s0
	ifindex 3
	wdev 0x1
	addr 00:00:00:00:00:00
	type managed
	wiphy 0
	channel 11 (2462 MHz), width: 20 MHz (no HT), center1: 2462 MHz
	txpower 30.00 dBm

Um zu überprüfen, ob eine Verbindung besteht:

root #iw dev wlp9s0 link
Not connected.

oder

root #iw dev wlp9s0 link
Connected to 00:00:00:00:00:00 (on wlp9s0)
	SSID: GentooNode
	freq: 2462
	RX: 3279 bytes (25 packets)
	TX: 1049 bytes (7 packets)
	signal: -23 dBm
	tx bitrate: 1.0 MBit/s
Hinweis
Einige drahtlose Netzwerkkarten benutzen einen Gerätenamen wie wlan0 oder ra0 anstelle von wlp9s0. Führen Sie ip link aus, um den korrekten Gerätenamen zu ermitteln.

Für die meisten Benutzer sind zum Herstellen einer Verbindung nur zwei Einstellungen notwendig: die ESSID (der Name des drahtlosen Netzes) und optional der WEP Key.

  • Stellen Sie als erstes sicher, dass das Interface im Zustand "up" ist:
root #ip link set dev wlp9s0 up
  • Um eine Verbindung mit einem offenen Netzwerk mit Namen GentooNode herzustellen:
root #iw dev wlp9s0 connect -w GentooNode
  • Wenn das Netzwerk nicht offen, sondern mit WEP verschlüsselt ist, und Sie einen WEP-Schlüssel im hexadezimalen Format haben: schreiben Sie das Prefix d: vor den Schlüssel:
root #iw dev wlp9s0 connect -w GentooNode key 0:d:1234123412341234abcd
  • Wenn Sie einen WEP-Schlüssel im ASCII-Format haben:
root #iw dev wlp9s0 connect -w GentooNode key 0:some-password
Hinweis
Falls Ihr drahtloses Netzwerk WPA oder WPA2 benutzt, werden Sie wpa_supplicant verwenden müssen. Für weitere Informationen zur Konfiguration drahtloser Netzwerke unter Gentoo Linux, lesen Sie bitte das Kapitel Drahtlose Netzwerkfunktionalität des Gentoo Handbuchs.

Sie können Ihre Einstellungen nun nochmal mit iw dev wlp9s0 link überprüfen. Wenn Sie Ihr WLAN nun eingerichtet haben, können Sie mit der Konfiguration der IP-Optionen wie im nächsten Abschnitt Verstehen der Netzwerk-Terminologie fortfahren oder net-setup benutzen, wie vorhin beschrieben.

Automatische Netzwerk-Konfiguration

In cases where automatic network configuration is unsuccessful, the Gentoo boot media provides scripts to aid in network configuration. net-setup can be used to configure wireless network information and static IPs.

root #net-setup eth0

net-setup wird Ihnen einige Fragen bezüglich Ihrer Netzwerkumgebung stellen. Haben Sie alle Fragen beantwortet, sollten Sie eine funktionsfähige Netzwerkverbindung haben. Testen Sie Ihr Netzwerk wieder, wie oben beschrieben. Sollten die Tests funktionieren, so haben Sie es geschafft; Sie können nun mit der Installation von Gentoo fortfahren. Überspringen Sie den Rest dieses Kapitels und fahren Sie mit der Vorbereitung der Festplatte(n) fort.

Wichtig
Network status should be tested after any configuration steps are taken. In the event that configuration scripts do not work, manual network configuration is required.

Verstehen der Netzwerk-Terminologie

If all of the above fails, the network must be configured manually. This is not particularly difficult, but should be done with consideration. This section serves to clarify terminology and introduce users to basic networking concepts pertaining to manually configuring an Internet connection.

Tipp
Some CPE (Carrier Provided Equipment) combines the functions of a router, access point, modem, DHCP server, and DNS server into one unit. It's important to differentiate the functions of a device from the physical appliance.

Interfaces and addresses

Network interfaces are logical representations of network devices. An interface needs an address to communicate with other devices on the network. While only a single address is required, multiple addresses can be assigned to a single interface. This is especially useful for dual stack (IPv4 + IPv6) configurations.

For consistency, this primer will assume the interface enp1s0 will be using the address 192.168.0.2.

Wichtig
IP addresses can be set arbitrarily. As a result, it's possible for multiple devices to use the same IP address, resulting in an address conflict. Address conflicts should be avoided by using DHCP or SLAAC.
Tipp
IPv6 typically uses StateLess Address AutoConfiguration (SLAAC) for address configuration. In most cases, manually setting IPv6 addresses is a bad practice. If a specific address suffix is preferred, interface identification tokens can be used.

Networks and CIDR

Once an address is chosen, how does a device know how to talk to other devices?

IP addresses are associated with networks. IP networks are contiguous logical ranges of addresses.

Classless Inter-Domain Routing or CIDR notation is used to distinguish network sizes.

  • The CIDR value, often notated starting with a /, represents the size of the network.
    • The formula 2 ^ (32 - CIDR) can be used to calculate network size.
    • Once network size is calculated, usable node count must be reduced by 2.
      • The first IP in a network is the Network address, and the last is typically the Broadcast address. These addresses are special and cannot be used by normal hosts.
Tipp
The most common CIDR values are /24, and /32, representing 254 nodes and a single node respectively.

A CIDR of /24 is the de-facto default network size. This corresponds to a subnet mask of 255.255.255.0, where the last 8 bits are reserved for IP addresses for nodes on a network.

The notation: 192.168.0.2/24 can be interpreted as:

  • The address 192.168.0.2
  • On the network 192.168.0.0
  • With a size of 254 (2 ^ (32 - 24) - 2)
    • Usable IPs are in the range 192.168.0.1 - 192.168.0.254
  • With a broadcast address of 192.168.0.255
    • In most cases, the last address on a network is used as the broadcast address, but this can be changed.

Using this configuration, a device should be able to communicate with any host on the same network (192.168.0.0).

The Internet

Once a device is on a network, how does it know how to talk to devices on the Internet?

To communicate with devices outside of local networks, routing must be used. A router is simply a network device that forwards traffic for other devices. The term default route or gateway typically refers to whatever device on the current network is used for external network access.

Tipp
It's a standard practice to make the gateway the first or last IP on a network.

If an Internet-connected router is available at 192.168.0.1, it can be used as the default route, granting Internet access.

To summarize:

  • Interfaces must be configured with an address and network information, such as the CIDR value.
  • Local network access is used to access a router on the same network.
  • The default route is configured, so traffic destined for external networks is forwarded to the gateway, providing Internet access.

The Domain Name System

Remembering IPs is hard. The Domain Name System was created to allow mapping between Domain Names and IP addresses.

Linux systems use /etc/resolv.conf to define nameservers to be used for DNS resolution.

Tipp
Many routers can also function as a DNS server, and using a local DNS server can augment privacy and speed up queries through caching.

Many ISPs run a DNS server that is generally advertised to the gateway over DHCP. Using a local DNS server tends to improve query latency, but most public DNS servers will return the same results, so server usage is largely based on preference.

Manuelle Netzwerk-Konfiguration

Interface address configuration

Wichtig
When manually configuring IP addresses, the local network topology must be considered. IP addresses can be set arbitrarily; conflicts may cause network disruption.

To configure enp1s0 with the address 192.168.0.2 and CIDR /24:

root #ip address add 192.168.0.2/24 dev enp1s0
Tipp
The start of this command can be shortened to ip a.

Default route configuration

Configuring address and network information for an interface will configure link routes, allowing communication with that network segment:

root #ip route
192.168.0.0/24 dev enp1s0 proto kernel scope link src 192.168.0.2
Tipp
This command can be shortened to ip r.

The default route can be set to 192.168.0.1 with:

root #ip route add default via 192.168.0.1

DNS configuration

Nameserver info is typically acquired using DHCP, but can be set manually by adding nameserver entries to /etc/resolv.conf.

Warnung
If dhcpcd is running, changes to /etc/resolv.conf will not persist. Status can be checked with ps x | grep dhcpcd.

nano is included in Gentoo boot media and can be used to edit /etc/resolv.conf with:

root #nano -w /etc/resolv.conf

Lines containing the keyword nameserver followed by a DNS server IP address are queried in order of definition:

DATEI /etc/resolv.confUse Quad9 DNS.
nameserver 9.9.9.9
nameserver 149.112.112.112
DATEI /etc/resolv.confUse Cloudflare DNS.
nameserver 1.1.1.1
nameserver 1.0.0.1

DNS status can be checked by pinging a domain name:

root #ping -c 3 gentoo.org

Once connectivity has been verified, continue with Preparing the disks.