Migration de networkd à ifup
This commit is contained in:
parent
2e27b78edc
commit
e55e686dbd
|
@ -203,6 +203,97 @@ De façon définitive :
|
|||
# ifconfig eth0 hw ether 01:23:45:67:89:0a
|
||||
~~~
|
||||
|
||||
## Migrer de networkd à ifup
|
||||
|
||||
À partir de Stretch, certaines machines sont installés d'office avec networkd (qui fait partie de systemd), on peut vouloir migrer à ifup (/etc/network/interfaces) pour plusieurs raisons (compatibilité, …).
|
||||
Voici les opérations à faire :
|
||||
|
||||
- On récupère les informations avec `networkctl status nomInterface` ;
|
||||
- On construit le fichier `/etc/network/interfaces` avec les informations récupérés (se baser sur un existant par exemple) ;
|
||||
- On désactive systemd-networkd et on restart networking :
|
||||
|
||||
~~~
|
||||
# systemctl stop systemd-networkd.service; systemctl disable systemd-networkd.service; systemctl restart networking
|
||||
~~~
|
||||
|
||||
Un exemple de conversion :
|
||||
|
||||
~~~
|
||||
# networkctl status eno1
|
||||
● 2: eno1
|
||||
Link File: /etc/systemd/network/50-public-interface.link
|
||||
Network File: /etc/systemd/network/50-default.network
|
||||
Type: ether
|
||||
State: routable (failed)
|
||||
Path: pci-0000:03:00.0
|
||||
Driver: igb
|
||||
Vendor: Intel Corporation
|
||||
Model: I210 Gigabit Network Connection
|
||||
HW Address: 00:01:02:03:04:05 (Intel Corporate)
|
||||
Address: 192.0.2.100
|
||||
2001:db8::100
|
||||
Gateway: 192.0.2.254 (Cisco Systems, Inc)
|
||||
fe80::12bd:18ff:ffff:ffff (Cisco Systems, Inc)
|
||||
DNS: 127.0.0.1
|
||||
192.0.2.254
|
||||
NTP: ntp.ovh.net
|
||||
|
||||
cat /etc/systemd/network/50-default.network
|
||||
# This file sets the IP configuration of the primary (public) network device.
|
||||
# You can also see this as "OSI Layer 3" config.
|
||||
# It was created by the OVH installer, please be careful with modifications.
|
||||
# Documentation: man systemd.network or https://www.freedesktop.org/software/systemd/man/systemd.network.html
|
||||
|
||||
[Match]
|
||||
MACAddress=00:01:02:03:04:05
|
||||
|
||||
[Network]
|
||||
Description=network interface on public network, with default route
|
||||
DHCP=no
|
||||
Address=192.0.2.100/24
|
||||
Gateway=192.0.2.254
|
||||
#IPv6AcceptRA=false
|
||||
NTP=ntp.ovh.net
|
||||
DNS=127.0.0.1
|
||||
DNS=192.0.2.254
|
||||
Gateway=2001:41d0:0002:f5ff:ff:ff:ff:ff
|
||||
|
||||
[Address]
|
||||
Address=2001:41d0:0002:f55c::/64
|
||||
|
||||
[Route]
|
||||
Destination=2001:41d0:0002:f5ff:ff:ff:ff:ff
|
||||
Scope=link
|
||||
~~~
|
||||
|
||||
On reporte dans `/etc/network/interfaces` :
|
||||
|
||||
~~~
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
# The loopback network interface
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
auto eno1
|
||||
iface eno1 inet static
|
||||
address 192.0.2.100/24
|
||||
gateway 192.0.2.254
|
||||
|
||||
iface eno1 inet6 static
|
||||
address 2001:db8::100/64
|
||||
gateway 2001:41d0:0002:f5ff:ff:ff:ff:ff
|
||||
post-up /sbin/ip -6 route add 2001:41d0:0002:f5ff:ff:ff:ff:ff dev eno1
|
||||
post-up /sbin/ip -6 route add default via 2001:41d0:0002:f5ff:ff:ff:ff:ff
|
||||
~~~
|
||||
|
||||
On désactive/stop networkd et on relance le service networking :
|
||||
|
||||
~~~
|
||||
# systemctl stop systemd-networkd.service; systemctl disable systemd-networkd.service; systemctl restart networking
|
||||
~~~
|
||||
|
||||
## FAQ
|
||||
|
||||
### Bascule réseau à chaud
|
||||
|
|
Loading…
Reference in a new issue