Je viens d'installer Ubuntu pour la première fois et je souhaite configurer une adresse IP fixe pour mon ordinateur comme première étape vers la connexion de l'extérieur via ssh. Je ne trouve aucun menu dans mon routeur pour associer une adresse IP à une adresse MAC. Je suis donc allé plutôt à / etc/netplan où je vois un fichier nommé 1-network-manager -all.yaml qui contient:
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
Je l'ajoute pour contenir:
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
wifis:
wlp5s0:
addresses: [192.168.0.100/24]
dhcp4: no
gateway4: 192.168.0.1
access-points:
sparrow:
password: my password
Ensuite, je cours:
ian@sparrow:~$ Sudo netplan --debug apply
** (generate:2459): DEBUG: 08:03:58.881: Processing input file //etc/netplan/01-network-manager-all.yaml..
** (generate:2459): DEBUG: 08:03:58.881: starting new processing pass
** (generate:2459): DEBUG: 08:03:58.881: wlp5s0: adding wifi AP 'sparrow'
** (generate:2459): DEBUG: 08:03:58.881: wlp5s0: setting default backend to 2
** (generate:2459): DEBUG: 08:03:58.882: Generating output files..
** (generate:2459): DEBUG: 08:03:58.882: networkd: definition wlp5s0 is not for us (backend 2)
DEBUG:no netplan generated networkd configuration exists
DEBUG:netplan generated NM configuration exists, restarting NM
DEBUG:replug enp4s0: unbinding 0000:04:00.0 from /sys/bus/pci/drivers/r8169
DEBUG:replug enp4s0: rebinding 0000:04:00.0 to /sys/bus/pci/drivers/r8169
DEBUG:replug wlp5s0: unbinding 0000:05:00.0 from /sys/bus/pci/drivers/iwlwifi
DEBUG:replug wlp5s0: rebinding 0000:05:00.0 to /sys/bus/pci/drivers/iwlwifi
DEBUG:device lo operstate is unknown, not replugging
DEBUG:netplan triggering .link rules for lo
ian@sparrow:~$
Je ne sais pas quoi faire de cette sortie.
Pour voir ce qui se passe, je redémarre et lance:
ian@sparrow:/etc/netplan$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope Host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope Host
valid_lft forever preferred_lft forever
2: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether b0:6e:bf:0a:9a:5d brd ff:ff:ff:ff:ff:ff
3: wlp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:e1:8c:7f:10:48 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.102/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp5s0
valid_lft 86003sec preferred_lft 86003sec
inet6 fe80::1d31:c36:616f:422c/64 scope link noprefixroute
valid_lft forever preferred_lft forever
ian@sparrow:/etc/netplan$
Ce qui indique que ma tentative de demander à Ubuntu de demander 192.168.0.100/24 a échoué.
Comment puis-je réparer l'IP LAN de mon ordinateur?
Après avoir généré 01-networkd.yaml comme décrit ci-dessous, je lance ip a et je reçois:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope Host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope Host
valid_lft forever preferred_lft forever
2: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether b0:6e:bf:0a:9a:5d brd ff:ff:ff:ff:ff:ff
3: wlp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:e1:8c:7f:10:48 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.102/24 brd 192.168.0.255 scope global dynamic noprefixroute wlp5s0
valid_lft 86003sec preferred_lft 86003sec
inet6 fe80::1d31:c36:616f:422c/64 scope link noprefixroute
valid_lft forever preferred_lft forever
ian@sparrow:/etc/netplan$
Correction: sortie de Sudo netplan --debug generate est:
Processing input file //etc/netplan/01-networkd.yaml..
starting new processing pass
wlp5s0: adding wifi AP 'sparrow
enp4s0: setting default backend to 1
wlp5s0: setting default backend to 1
Generating output files..
NetworkManager: definition enp4s0 is not for us (backend 1)
wlp5s0: Creating wpa_supplicant configuration file run/netplan/wpa-wlp5s0.conf
Creating wpa_supplicant service enablement link /run/systemd/system/multi-user.target.wants/[email protected]
NetworkManager: definition wlp5s0 is not for us (backend 1)
Si vous devez utiliser Netplan
...
supprimer /etc/netplan/01-network-manager-all.yaml
créer /etc/netplan/01-networkd.yaml
...
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
dhcp4: true
optional: true
wifis:
wlp5s0:
dhcp4: no
dhcp6: no
addresses: [192.168.0.100/24]
gateway4: 192.168.0.1
nameservers:
addresses: [192.168.0.1, 8.8.8.8]
access-points:
"sparrow":
password: "**********"
Sudo netplan --debug generate
Sudo netplan apply
reboot
Si vous décidez de vous en tenir à NetworkManager ...
supprimez tous les fichiers .yaml inutiles dans /etc/netplan
créer /etc/netplan/01-network-manager-all.yaml
...
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
Sudo netplan --debug generate
Sudo netplan apply
reboot
Connectez-vous au réseau sans fil souhaité.
Déconnectez-vous du réseau sans fil.
Modifiez ces paramètres dans le profil sans fil ( 18.04.1 ) ...
Mise à jour # 1: