[Ubuntu] Wifiを使用した無線LANの設定方法

目次

前提

  • Ubuntu OS

wireless-toolsのインストール

apt-get install wireless-tools

Wifiのスキャン

wlp1s0みたいなwifiデバイスがあるので確認

ifconfig

出力例

wlp1s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether XX:XX:XX:XX:XX:XX  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

デバイスが検知しているwifiをscan

iwlist wlp1s0 scan

出力例

          Cell 01 - Address: XX:XX:XX:XX:XX:XX
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=41/70  Signal level=-69 dBm
                    Encryption key:on
                    ESSID: "sample"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=0000024380b3e668
                    Extra: Last beacon: 4056ms ago
                    IE: Unknown: 00024B49
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 03010B
                    IE: Unknown: 07064A5020010D14
                    IE: Unknown: 2A0102
                    IE: Unknown: 32043048606C
                    IE: Unknown: 2D1AAD0903FFFF000000000000000000000100000000000000000000
                    IE: Unknown: 3D160B000100000000000000000000000000000000000000
                    IE: Unknown: 4A0E14000A002C01C800140005001900
                    IE: Unknown: 7F0801000F0200000040
                    IE: Unknown: BF0CB2598933FAFF0000FAFF0000
                    IE: Unknown: C005000000FCFF
                    IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00
                    IE: Unknown: DD0900037F01010000FF7F
                    IE: WPA Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : TKIP
                        Pairwise Ciphers (2) : CCMP TKIP
                        Authentication Suites (1) : PSK

パスワードを設定

nmcli device wifi connect [SSID] password [PASSWORD]
nmcli device wifi connect sample password password

出力例

Device 'wlp1s0' successfully activated with '2d0239d6-bdd6-4b60-9fa5-423470382134'.

接続の確認

ifconfig
wlp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.31.1.20  netmask 255.255.255.0  broadcast 172.31.1.255
        inet6 fe80::8216:8b72:ffd0:45c4  prefixlen 64  scopeid 0x20<link>
        ether XX:XX:XX:XX:XX:XX  txqueuelen 1000  (Ethernet)
        RX packets 15  bytes 2482 (2.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 18  bytes 2464 (2.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

設定ファイルの確認

ls -l /etc/NetworkManager/system-connections/sample.nmconnection

<SSID>.nmconnection があれば良い
  • システム開発、アプリ開発
  • マッチングアプリ開発
  • インフラ構築支援等、なんでもご相談ください。
よかったらシェアしてね!
  • URLをコピーしました!
目次