黑芝麻A1000 设置固定ip地址(十三)
参考:Linux 下 nmcli 常用命令Linux中使用nmcli配置网络nmcli命令使用详细说明和nmcli不能tab补全解决方法正文:黑芝麻A1000 FAD板上采用 NetworkManager 来管理网络,对应的服务NetworkManager.service.没有采用network 方式,没有对应的network.service,network.service是旧的管理方式,Netw
参考:
正文:
黑芝麻A1000 FAD 板上采用 NetworkManager 来管理网络,对应的服务NetworkManager.service.
没有采用network 方式,没有对应的network.service,network.service 是旧的管理方式,NetworkManager.service 是新的方式,很多linux 发行版有的还保留了network.service 方式, 在我们板子上没有保留。 ------- 黑芝麻俊哥给的资料
- 通过串口连接主机和板子,使用串口才可以修改网络
先用两根数据线连接主机和板子的 USB2.0 FOR SOC A 和 USB2.0 DEBUG FOR SOA A + SOC B + TC397 口,经过试验,板子的A口好改网络
$ ls /dev/ttyUSB*
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2 /dev/ttyUSB3
启动putty,putty 设置参考 黑芝麻A1000 ubuntu18.04 PC用putty连接BST板子(四),A口选择 /dev/ttyUSB0
波特率 115200
$ sudo putty
- 同时启动 adb shell ,在这个里面修改脚本
ifconfig 查看 网卡信息
sh-4.4# ifconfig -a
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:24
can1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:25
eth0 Link encap:Ethernet HWaddr 66:66:66:CC:8E:A8
BROADCAST SLAVE MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:48
eth1 Link encap:Ethernet HWaddr 66:66:66:96:BD:71
BROADCAST SLAVE MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:60
...
ethtool 查看网卡是否在使用
Link detected: yes 网卡连接正常
Speed: 1000Mb/s 网卡速率
# ethtool eth0
Settings for eth0:
Link detected: yes
Supported ports: [ TP MII FIBRE ]
Supported link modes: 1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 1000baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 1000baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: No
Link partner advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: d
Wake-on: d
Current message level: 0x0000003f (63)
drv probe link timer ifdown ifup
systemctl status NetworkManager 查看运行状态:
Active: active (running) since Wed 2021-08-25 02:33:58 UTC; 1h 0min ago
# systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/NetworkManager.service.d
└─NetworkManager-ovs.conf
Active: active (running) since Wed 2021-08-25 02:33:58 UTC; 1h 0min ago
Docs: man:NetworkManager(8)
Main PID: 538 (NetworkManager)
Tasks: 3 (limit: 2236)
Memory: 14.4M
CGroup: /system.slice/NetworkManager.service
└─538 /usr/sbin/NetworkManager --no-daemon
Aug 25 03:34:00 a1000 NetworkManager[538]: <info> [1629862440.0033] device…ed')
Aug 25 03:34:00 a1000 NetworkManager[538]: <warn> [1629862440.0048] device…n 1'
Aug 25 03:34:00 a1000 NetworkManager[538]: <info> [1629862440.0054] device…ed')
Aug 25 03:34:00 a1000 NetworkManager[538]: <info> [1629862440.0068] policy…24f)
Aug 25 03:34:00 a1000 NetworkManager[538]: <info> [1629862440.0080] device…24f)
Aug 25 03:34:00 a1000 NetworkManager[538]: <info> [1629862440.0084] device…ed')
Aug 25 03:34:00 a1000 NetworkManager[538]: <info> [1629862440.0096] device…ed')
Aug 25 03:34:00 a1000 NetworkManager[538]: <info> [1629862440.0103] device…ed')
Aug 25 03:34:00 a1000 NetworkManager[538]: <warn> [1629862440.0118] device…n 1'
Aug 25 03:34:00 a1000 NetworkManager[538]: <info> [1629862440.0124] device…ed')
Hint: Some lines were ellipsized, use -l to show in full.
nmcli -p device 查看网卡状态
# nmcli -p device
=====================
Status of devices
=====================
DEVICE TYPE STATE CONNECTION
------------------------------------------------------------------
eth1 ethernet disconnected --
can0 can unmanaged --
can1 can unmanaged --
ip6tnl0 iptunnel unmanaged --
sit0 iptunnel unmanaged --
tunl0 iptunnel unmanaged --
lo loopback unmanaged --
- nmcli配置静态ip地址
在adb shell 里面新建 com.sh 脚本文件,方便在putty 里面执行
sh-4.4# cd /home/root/
sh-4.4# vi com.sh
com.sh 内容:
#!/bin/bash
nmcli connection add type ethernet con-name eth0 ifname eth0 ipv4.addresses 192.168.1.102/24 ipv4.gateway 192.168.1.1
nmcli c load /etc/NetworkManager/system-connections/eth0.nmconnection
nmcli c m eth0 ipv4.method manual
- 通过串口在putty 里面执行
# cd /home/root
# chmod 775 com.sh
# ./com.sh
- 查看eth0 ip 状况
# nmcli -p device
=====================
Status of devices
=====================
DEVICE TYPE STATE CONNECTION
------------------------------------------------------------------
eth0 ethernet connected eth0
eth1 ethernet disconnected --
can0 can unmanaged --
can1 can unmanaged --
ip6tnl0 iptunnel unmanaged --
sit0 iptunnel unmanaged --
tunl0 iptunnel unmanaged --
lo loopback unmanaged --
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 66:66:66:CC:8E:A8
inet addr:192.168.1.102 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ffd3:1cd5:53f1:9968/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5751907 errors:0 dropped:0 overruns:0 frame:0
TX packets:8931 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7175470322 (6.6 GiB) TX bytes:1335494 (1.2 MiB)
Interrupt:48
# ping 192.168.1.210
PING 192.168.1.210 (192.168.1.210): 56 data bytes
64 bytes from 192.168.1.210: seq=0 ttl=128 time=0.210 ms
64 bytes from 192.168.1.210: seq=1 ttl=128 time=0.560 ms
64 bytes from 192.168.1.210: seq=2 ttl=128 time=0.158 ms
^C
--- 192.168.1.210 ping statistics ---
4 packets transmitted, 3 packets received, 25% packet loss
round-trip min/avg/max = 0.158/0.309/0.560 ms
磨了两天终于成了…
更多推荐
所有评论(0)