Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
debian:base-debian:networking-debian [2019/05/03 16:10] – michael | debian:base-debian:networking-debian [2021/05/28 15:43] (current) – [Netzkonfiguration ab Ubuntu 18.04 / Debian X] michael | ||
---|---|---|---|
Line 3: | Line 3: | ||
{{ : | {{ : | ||
- | ===== Statische IP - Beispiel Netzkonfiguration | + | |
+ | ===== Netzkonfiguration ab Ubuntu 18.04 / Debian X ===== | ||
+ | |||
+ | **Ubuntu 17.10 and later** uses **Netplan** as the default network management tool. The previous Ubuntu versions were using ifconfig and its configuration file ''/ | ||
+ | Netplan configuration files are written in YAML syntax with a '' | ||
+ | Netplan supports two renderers, NetworkManager and Systemd-networkd. NetworkManager is mostly used on Desktop machines, while the Systemd-networkd is used on servers without a GUI. | ||
+ | |||
+ | <WRAP center box 100%> | ||
+ | ==== Configuring Static IP address | ||
+ | |||
+ | On Ubuntu 20.04, the system identifies network interfaces using ‘predictable network interface names’. | ||
+ | |||
+ | The first step toward setting up a static IP address is identifying the name of the ethernet interface you want to configure. To do so, use the ip link command, as shown below: | ||
+ | |||
+ | < | ||
+ | # ip link | ||
+ | </ | ||
+ | |||
+ | The command prints a list of all the available network interfaces. In this example, the name of the interface is '' | ||
+ | |||
+ | <sxh plain; gutter: false;> | ||
+ | 1: lo: < | ||
+ | link/ | ||
+ | 2: ens3: < | ||
+ | link/ether 08: | ||
+ | </ | ||
+ | |||
+ | Netplan configuration files are stored in the ''/ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | If your Ubuntu cloud instance is provisioned with cloud-init, you’ll need to disable it. To do so create the following file: | ||
+ | |||
+ | < | ||
+ | # vim / | ||
+ | </ | ||
+ | |||
+ | <sxh bash; first-line: 1> | ||
+ | network: {config: disabled} | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | To assign a static IP address on the network interface, open the YAML configuration file with your text editor : | ||
+ | |||
+ | < | ||
+ | # vim / | ||
+ | </ | ||
+ | |||
+ | <sxh bash; first-line: 1> | ||
+ | network: | ||
+ | version: 2 | ||
+ | renderer: networkd | ||
+ | ethernets: | ||
+ | ens3: | ||
+ | dhcp4: yes | ||
+ | </ | ||
+ | |||
+ | Before changing the configuration, | ||
+ | |||
+ | Each Netplan Yaml file starts with the network key that has at least two required elements. The first required element is the version of the network configuration format, and the second one is the device type. The device type can be ethernets, bonds, bridges, or vlans. | ||
+ | |||
+ | The configuration above also has a line that shows the renderer type. Out of the box, if you installed Ubuntu in server mode, the renderer is configured to use networkd as the back end. | ||
+ | Under the device’s type ('' | ||
+ | |||
+ | To assign a static IP address to '' | ||
+ | |||
+ | * Set DHCP to '' | ||
+ | * Specify the static IP address. Under '' | ||
+ | * Specify the gateway. | ||
+ | * Under '' | ||
+ | |||
+ | <sxh bash; first-line: 1> | ||
+ | network: | ||
+ | version: 2 | ||
+ | renderer: networkd | ||
+ | ethernets: | ||
+ | ens3: | ||
+ | dhcp4: no | ||
+ | addresses: | ||
+ | - 192.168.121.221/ | ||
+ | gateway4: 192.168.121.1 | ||
+ | nameservers: | ||
+ | addresses: [8.8.8.8, 1.1.1.1] | ||
+ | </ | ||
+ | |||
+ | When editing Yaml files, make sure you follow the YAML code indent standards. If the syntax is not correct, the changes will not be applied. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | Once done, save the file and apply the changes by running the following command: | ||
+ | |||
+ | < | ||
+ | # netplan apply | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | Verify the changes by typing: | ||
+ | |||
+ | < | ||
+ | # ip addr show dev ens3 | ||
+ | </ | ||
+ | |||
+ | <sxh plain; gutter: false;> | ||
+ | 2: ens3: < | ||
+ | link/ether 08: | ||
+ | inet 192.168.121.221/ | ||
+ | | ||
+ | inet6 fe80:: | ||
+ | | ||
+ | </ | ||
+ | |||
+ | <wrap em> | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Statische IP - Beispiel Netzkonfiguration | ||
Dies ist eine Beispielkonfiguration, | Dies ist eine Beispielkonfiguration, |