Ubuntu 20.04 raspberry pi2 에 wifi 설치하기

라즈베리파이 구버전이 있어서 간단한 용도로 사용하려고 우분투를 설치하고 준비가 마무리될 무렵 사용환경이 랜이 없어서 wifi 를 사용해야 한다. 그런데 마침 집에 역시나 예전에 구입했던 IPTIME N100mini 가 있어서 이걸 사용하기로 하고 USB 에 꽂아 보았다.

역시 우분투도 버전이 올라가니 기본으로 랜카드를 인식해 준다. 하지만 wifi는 잡히지 않는다.

아래와 같이 사용설정을 해주어야 한다. 구글링해보면 드라이버를 설치하라거나 복잡한 과정들이 나열되지만 그것들은 다 예전 버전의 우분투에서 필요했던 것 같다.

ifconfig -a 로 확인해보면 무선랜은 인식이 되고 있다. 아래는 다양한 방법으로 무선랜을 확인한 내용이다.

/etc/network/interfaces 를 수정하는 방법도 동작이 되지 않는다.

ubuntu@ubuntu:~$ ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.45  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::ba27:ebff:feb8:f4fe  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:b8:f4:fe  txqueuelen 1000  (Ethernet)
        RX packets 2112  bytes 2744366 (2.7 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1127  bytes 105436 (105.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 110  bytes 8688 (8.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 110  bytes 8688 (8.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 90:9f:33:e9:eb:71  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ubuntu@ubuntu:~$ lsusb
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ubuntu@ubuntu:~$ sudo lshw -C network
  *-usb:0
       description: Ethernet interface
       product: SMSC9512/9514 Fast Ethernet Adapter
       vendor: Microchip Technology, Inc. (formerly SMSC)
       physical id: 1
       bus info: usb@1:1.1
       logical name: eth0
       version: 2.00
       serial: b8:27:eb:b8:f4:fe
       size: 100Mbit/s
       capacity: 100Mbit/s
       capabilities: usb-2.00 ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=smsc95xx driverversion=22-Aug-2005 duplex=full firmware=smsc95xx USB 2.0 Ethernet ip=192.168.3.45 link=yes maxpower=2mA multicast=yes port=MII speed=100Mbit/s
  *-network DISABLED
       description: Wireless interface
       physical id: 2
       bus info: usb@1:1.5
       logical name: wlan0
       serial: 90:9f:33:e9:eb:71
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=rtl8192cu driverversion=5.4.0-1042-raspi firmware=N/A link=no multicast=yes wireless=IEEE 802.11

최종적으로 성공한 방법은 NetPlan을 사용한 방법이다. 단순히 설정 파일을 수정하고 다시 적용하면 된다. 한번 rebooting 이 필요하다.

먼전 아래와 같이 환경 파일을 수정한다.

ubuntu@ubuntu:~$ vi /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            dhcp4: true
            optional: true
    version: 2
    wifis:
        wlan0:
            optional: true
            access-points:
                "SSID를 기록":
                  password: "비번을 기록"
            dhcp4: true

여기서 중요한 것은 들여 쓰기이다. 들여쓰기가 잘못되면 apply 를 할 때 에러가 표시된다. 특히 password는 SSID 보다 더 들여 쓰기를 해야 한다.

이제 수정한 내용을 적용한다.

sudo netplan apply

이제 재기동 한번 하면 자동으로 wifi 가 연결된다.

ubuntu@ubuntu:~$ ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.45  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::ba27:ebff:feb8:f4fe  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:b8:f4:fe  txqueuelen 1000  (Ethernet)
        RX packets 97  bytes 10966 (10.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 71  bytes 12322 (12.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 88  bytes 6664 (6.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 88  bytes 6664 (6.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.46  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::929f:33ff:fee9:eb71  prefixlen 64  scopeid 0x20<link>
        ether 90:9f:33:e9:eb:71  txqueuelen 1000  (Ethernet)
        RX packets 50  bytes 15038 (15.0 KB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 17  bytes 2478 (2.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
This entry was posted in 리눅스 and tagged , , , , , . Bookmark the permalink.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다