I recently installed a fresh copy of Ubuntu Server 22.04 on a HP Pavillion Desktop 510-p051a. The network that I'm on currently has WIFI access ONLY. I am trying to configure the WIFI interface to use a static IP address. The HP Pavillion has 2 network interfaces: enp2s0 & wlp3s0, plus the loopback (lo), (please see below).
$ 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: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether c8:d3:ff:35:f1:5f brd ff:ff:ff:ff:ff:ff
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 58:00:e3:62:b0:97 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.25/24 metric 600 brd 192.168.1.255 scope global dynamic wlp3s0
valid_lft 3439sec preferred_lft 3439sec
inet6 2406:2d40:400a:410::c7c/128 scope global dynamic noprefixroute
valid_lft 1011sec preferred_lft 411sec
inet6 fd2e:9b4:7dc7:10::c7c/128 scope global noprefixroute
valid_lft forever preferred_lft forever
inet6 fd2e:9b4:7dc7:10:5a00:e3ff:fe62:b097/64 scope global mngtmpaddr noprefixroute
valid_lft forever preferred_lft forever
inet6 2406:2d40:400a:410:5a00:e3ff:fe62:b097/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 1011sec preferred_lft 411sec
inet6 fe80::5a00:e3ff:fe62:b097/64 scope link
valid_lft forever preferred_lft forever
The Ubuntu Server 22.04 installation created two yaml files (00-installer-config.yaml and 00-installer-config-wifi.yaml) in /etc/netplan directory (please see below):
$ sudo cat 00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
ethernets:
enp2s0:
dhcp4: true
version: 2
$ sudo cat 00-installer-config-wifi.yaml
# This is the network config written by 'subiquity'
network:
version: 2
wifis:
wlp3s0:
access-points:
MY-WIFI:
password: MyPassword
dhcp4: true
The config file for the WIFI interface currently grabs an IP address from DHCP, as indicated above (Example: 192.168.1.25).
I have create numerous version of the config files in order to facilitate setting a static IP address for the WIFI interface (wlp3s0) ONLY and not use the Ethernet interface (enp2s0) but I haven't had any luck (please see below examples):
00-installer-config-wifi.yaml (WIFI only)
network:
version: 2
renderer: networkd
wifis:
wlp3s0:
addresses:
- 192.168.1.25/24
gateway4: 192.168.1.1
nameservers:
addresses: [1.1.1.1, 1.0.0.1]
00-installer-config.yaml (both combined)
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 192.168.1.25/24
wifis:
wlp3s0:
dhcp4: no
dhcp6: no
addresses:
- 192.168.1.25/24
nameservers:
addresses: [1.1.1.1, 1.0.0.1]
routes:
- to: default
via: 192.168.1.1
00-installer-config-wifi.yaml (I didn't think this would work but I tried it anyway):
network:
version: 2
renderer: networkd
ethernets:
wlp3s0:
addresses:
- 192.168.1.25/24
gateway4: 192.168.1.1
nameservers:
addresses: [1.1.1.1, 1.0.0.1]
The list goes on...
Note: gateway4 gives a warning message when running "sudo netplan try" and "sudo netplan apply".
After much testing with different versions of the yaml files, I've had to resort to having both default files (created by the Ubuntu Server 22.04 installation) in the /etc/netplan directory in order to grab an IP address (DHCP, not static), otherwise, no IP address.
If anyone knows how to set the code in these yaml files correctly, I'd greatly appreciate your help.
Thanks in advance.
Sorry guys. I figured it out.
The following config file finally worked after a reboot of the server:
00-network-config.yaml
Hope that helps someone out there with the same issue.