動かざることバグの如し

猫ゆえに。。。

Tinker BoardでIP固定に設定する方法

そういえばTinker Boardを買ったきりで全然起動すらしていなかった()

thr3a.hatenablog.com

流石にもったいないのでセットアップしたメモ

環境

  • Tinker BoardのDebianのOS
  • 20180622-tinker-board-linaro-stretch-alip-v2.0.7.img

方法

そもそもネットワークの設定はNetworkManagerで行われている(良くも悪くも

root@tinkerboard:~# systemctl status NetworkManager 
● NetworkManager.service - Network Manager
   Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2018-07-22 01:18:51 UTC; 6min ago
     Docs: man:NetworkManager(8)
 Main PID: 476 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─476 /usr/sbin/NetworkManager --no-daemon

Jul 22 01:21:54 tinkerboard NetworkManager[476]: <warn>  [1532222514.3748] arping[0x80c674f0,3]: arping could not be found; no ARPs will be sent
Jul 22 01:21:54 tinkerboard NetworkManager[476]: <info>  [1532222514.3748] device (eth0): state change: ip-config -> ip-check (reason 'none') [70 80 0]
Jul 22 01:21:54 tinkerboard NetworkManager[476]: <info>  [1532222514.3776] device (eth0): state change: ip-check -> secondaries (reason 'none') [80 90 0]
Jul 22 01:21:54 tinkerboard NetworkManager[476]: <info>  [1532222514.3784] device (eth0): state change: secondaries -> activated (reason 'none') [90 100 0]
Jul 22 01:21:54 tinkerboard NetworkManager[476]: <info>  [1532222514.3788] manager: NetworkManager state is now CONNECTED_LOCAL
Jul 22 01:21:54 tinkerboard NetworkManager[476]: <info>  [1532222514.4147] manager: NetworkManager state is now CONNECTED_GLOBAL
Jul 22 01:21:54 tinkerboard NetworkManager[476]: <info>  [1532222514.4149] policy: set 'Wired connection 1' (eth0) as default for IPv4 routing and DNS
Jul 22 01:21:54 tinkerboard NetworkManager[476]: <info>  [1532222514.4152] dns-mgr: Writing DNS information to /sbin/resolvconf
Jul 22 01:21:54 tinkerboard NetworkManager[476]: <info>  [1532222514.4784] device (eth0): Activation: successful, device activated.
Jul 22 01:21:56 tinkerboard NetworkManager[476]: <warn>  [1532222516.6041] arping[0x80c674f0,3]: arping could not be found; no ARPs will be sent

今回は副作用が怖いのでNetworkManagerを無効化せずにIPを固定にする

設定にはnmcliコマンドを使う。Ubuntuでは聞かなかったが、どうもCentOS7ではこれで設定するのが一般的らしい。

叩くと以下のように現在の設定が表示される。

root@tinkerboard:~# nmcli
eth0: connected to Wired connection 1
    ethernet (rk_gmac-dwmac), 2C:4D:54:42:FF:2C, hw, mtu 1500
    ip4 default
    inet4 192.168.1.11/24
    inet6 fe80::688e:b5b0:a2af:e2db/64
    route6 ff00::/8

wlan0: disconnected
    wifi (rtl8723bs), F0:03:8C:63:4F:47, hw

sit0: unmanaged
    iptunnel (sit), sw, mtu 1480

lo: unmanaged
    loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536

DNS configuration:
    servers: 192.168.1.1
    interface: eth0

Use "nmcli device show" to get complete information about known devices and
"nmcli connection show" to get an overview on active connection profiles.

Consult nmcli(1) and nmcli-examples(5) manual pages for complete usage details.

で設定 ここでは192.168.1.12にしている。

nmcli con mod "Wired connection 1" \
  ipv4.method manual \
  ipv4.addresses 192.168.1.12/24 \
  ipv4.gateway 192.168.1.1 \
  ipv4.dns 192.168.1.1

設定対象のNICWired connection 1にしているが、人によって異なるかもしれない。nmcli deviceのCONNECTIONを値を指定すればおk(ちなみにeth0で指定は不可

root@tinkerboard:~# nmcli device
DEVICE  TYPE      STATE         CONNECTION         
eth0    ethernet  connected     Wired connection 1 
wlan0   wifi      disconnected  --                 
sit0    iptunnel  unmanaged     --                 
lo      loopback  unmanaged     --                 

反映 "Wired connection 1"の文字列は適宜

nmcli con down "Wired connection 1"; nmcli con up "Wired connection 1"

あとは別タブで変更先の固定IPからsshできれば成功

nmtuiって対話モードもあるらしい。

ちなみに設定できる項目は以下

root@tinkerboard:~# nmcli c s "Wired connection 1"
connection.id:                          Wired connection 1
connection.uuid:                        f07c77e7-ebf4-3eec-ab7d-563d8e566e1a
connection.stable-id:                   --
connection.interface-name:              --
connection.type:                        802-3-ethernet
connection.autoconnect:                 yes
connection.autoconnect-priority:        -999
connection.autoconnect-retries:         -1 (default)
connection.timestamp:                   1532223301
connection.read-only:                   no
connection.permissions:                 
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 
connection.gateway-ping-timeout:        0
connection.metered:                     unknown
connection.lldp:                        -1 (default)
802-3-ethernet.port:                    --
802-3-ethernet.speed:                   0
802-3-ethernet.duplex:                  --
802-3-ethernet.auto-negotiate:          no
802-3-ethernet.mac-address:             2C:4D:54:42:FF:2C
802-3-ethernet.cloned-mac-address:      --
802-3-ethernet.generate-mac-address-mask:--
802-3-ethernet.mac-address-blacklist:   
802-3-ethernet.mtu:                     auto
802-3-ethernet.s390-subchannels:        
802-3-ethernet.s390-nettype:            --
802-3-ethernet.s390-options:            
802-3-ethernet.wake-on-lan:             1 (default)
802-3-ethernet.wake-on-lan-password:    --
ipv4.method:                            manual
ipv4.dns:                               192.168.1.1
ipv4.dns-search:                        
ipv4.dns-options:                       (default)
ipv4.dns-priority:                      0
ipv4.addresses:                         192.168.1.11/24
ipv4.gateway:                           192.168.1.1
ipv4.routes:                            
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)
ipv6.method:                            auto
ipv6.dns:                               
ipv6.dns-search:                        
ipv6.dns-options:                       (default)
ipv6.dns-priority:                      0
ipv6.addresses:                         
ipv6.gateway:                           --
ipv6.routes:                            
ipv6.route-metric:                      -1
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       -1 (unknown)
ipv6.addr-gen-mode:                     stable-privacy
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     --
ipv6.token:                             --
proxy.method:                           none
proxy.browser-only:                     no
proxy.pac-url:                          --
proxy.pac-script:                       --
GENERAL.NAME:                           Wired connection 1
GENERAL.UUID:                           f07c77e7-ebf4-3eec-ab7d-563d8e566e1a
GENERAL.DEVICES:                        eth0
GENERAL.STATE:                          activated
GENERAL.DEFAULT:                        yes
GENERAL.DEFAULT6:                       no
GENERAL.VPN:                            no
GENERAL.ZONE:                           --
GENERAL.DBUS-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/Settings/1
GENERAL.SPEC-OBJECT:                    --
GENERAL.MASTER-PATH:                    --
IP4.ADDRESS[1]:                         192.168.1.11/24
IP4.GATEWAY:                            192.168.1.1
IP4.DNS[1]:                             192.168.1.1
IP6.ADDRESS[1]:                         fe80::688e:b5b0:a2af:e2db/64
IP6.GATEWAY:                            --
IP6.ROUTE[1]:                           dst = ff00::/8, nh = ::, mt = 256

参考リンク