How to enable WiFi on Ubuntu server 18.04 without existing connection

17,749

You need to edit /etc/netplan/*.yaml to enable your wireless card. Here's a basic .yaml for you. Note the corrected spelling of "ethernets" and "gateway4".

You'll need to install wireless-tools and wpasupplicant, so you need to either, connect your (corrected) wired ethernet connection, or download them on another machine, and put them on a flash/external drive, and install them that way. There are a number of dependencies, so you may have to obtain them also to install these. See https://packages.ubuntu.com/.

You may have to adjust the .yaml, depending if you want dhcp or static addresses. Adjust the static addresses and wi-fi SSID/password as required. See https://netplan.io/examples for additional help.

Note that netplan is very fussy about indentation, spacing, and no tabs.

For wireless dhcp addressing:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp2s0f1:
      addresses: [10.0.0.131/24]
      gateway4: 10.0.0.1
      nameservers
        addresses: [10.0.0.1, 8.8.4.4, 8.8.8.8]
      optional: true
  wifis:
    wlp3s0:
      dhcp4: yes
      access-points:
        "network_ssid_name":
          password: "**********"

For wireless static IP:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp2s0f1:
      addresses: [10.0.0.131/24]
      gateway4: 10.0.0.1
      nameservers
        addresses: [10.0.0.1, 8.8.4.4, 8.8.8.8]
      optional: true
  wifis:
    wlp3s0:
      addresses: [10.0.0.132/24]
      gateway4: 10.0.0.1
      nameservers:
        addresses: [10.0.0.1, 8.8.4.4, 8.8.8.8]
      access-points:
        "network_ssid_name":
          password: "**********"

sudo netplan --debug generate # make config files

sudo netplan apply # apply new configuration

reboot # reboot and verify proper operation

Share:
17,749

Related videos on Youtube

MIZWOZ cpu
Author by

MIZWOZ cpu

Updated on September 18, 2022

Comments

  • MIZWOZ cpu
    MIZWOZ cpu over 1 year

    I recently installed Ubuntu 18.04 on my device and went through setup without an internet connection. I have no access to any spare ethernet cables so it's down to WiFi. I have no pre-existing connection, so I can't install packages. At this point, I have no idea what to do. My wireless card is detected but doesn't show up in ifconfig - but ethernet and loopback do (which seems normal). I can't run iwconfig because wireless-tools was not installed, as well as wpasupplicant. Here are some commands that give more info:

    Pastebin link to output

    • MIZWOZ cpu
      MIZWOZ cpu almost 5 years
      I'm thinking I need to enable it somehow... But I don't know how.
    • Boris Hamanov
      Boris Hamanov almost 5 years
      Is this a desktop or server installation? Edit your question and show me cat /etc/network/interfaces and cat /etc/netplan/*.yaml.
    • MIZWOZ cpu
      MIZWOZ cpu almost 5 years
      It is a server installation. I have edited the question to show the requested information.
    • chili555
      chili555 almost 5 years
      Is your device perhaps a laptop? Please edit your question to show the result of the terminal command: rfkill list all
    • MIZWOZ cpu
      MIZWOZ cpu almost 5 years
      rfkill is not installed, and cannot be downloaded because of no existing connection.
    • chili555
      chili555 almost 5 years
      @heynnema A very good answer it is! I suggest that you add that netplan is very specific about spacing and indentation and to proofread carefully twice.
    • Boris Hamanov
      Boris Hamanov almost 5 years
      @chili555 good suggestion. Done!
    • Boris Hamanov
      Boris Hamanov almost 5 years
      @MIZWOZcpu your current .yaml is wrong... you still show w1p3s0, and it should be wlp3s0 (lower case L).
  • Thomas Ward
    Thomas Ward almost 5 years
    Comments are not for extended discussion; this conversation has been moved to chat.
  • luchaninov
    luchaninov over 4 years
    Your wifi network card may be not wlp3s0. Use iwconfig to see your devices.
  • Boris Hamanov
    Boris Hamanov over 4 years
    @luchaninov why might you think that wlp3s0 isn't correct? Check their pastebin output.
  • luchaninov
    luchaninov over 4 years
    @heynnema, it depends on computer configuration. For example, mine is wlp1s0
  • Boris Hamanov
    Boris Hamanov over 4 years
    @luchaninov I obtained wlp3s0 directly from the OP's data file.
  • M-Pixel
    M-Pixel almost 4 years
    @heynnema Stack Exchange is all about posting questions and answers in a format that is as general as possible. The OP's interface is known, but mine might be different. @luchaninov's comment is addressed to all readers. Their suggestion to check iwconfig is a useful addition to your answer.