Eu preciso definir um endereço IP estático na interface eth1 após a inicialização. No entanto, durante a inicialização, o dispositivo sempre tem um endereço IP diferente daquele configurado nas interfaces / etc / network /. Este é um sistema operacional Linux no osso beagle.
Estou usando a seguinte versão linux no beaglebone
root@beaglebone:/etc/network# cat /proc/version
Linux version 4.4.54-ti-r93 (root@a4-imx6q-wandboard-2gb) (gcc version 4.9.2 (Debian 4.9.2-10) ) #1 SMP Fri Mar 17 13:08:22 UTC 2017
O arquivo /etc/network/interfaces
é como abaixo.
##connman: WiFi
#
#connmanctl
#connmanctl> tether wifi off
#connmanctl> enable wifi
#connmanctl> scan wifi
#connmanctl> services
#connmanctl> agent on
#connmanctl> connect wifi_*_managed_psk
#connmanctl> quit
auto eth1
iface eth1 inet static
address 192.168.3.10
netmask 255.255.255.0
network 192.168.3.0
gateway 192.168.3.1
dns-nameservers 8.8.8.8
# Ethernet/RNDIS gadget (g_ether)
# Used by: /opt/scripts/boot/autoconfigure_usb0.sh
iface usb0 inet static
address 192.168.7.2
netmask 255.255.0.0
network 192.168.7.0
gateway 192.168.7.1
A saída do ifconfig é a seguinte
root@beaglebone:/etc/network# ifconfig
eth0 Link encap:Ethernet HWaddr 04:a3:16:e1:5d:39
UP BROADCAST MULTICAST DYNAMIC 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:173
eth1 Link encap:Ethernet HWaddr 20:c9:d0:29:e0:88
inet addr:169.254.191.196 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::22c9:d0ff:fe29:e088/64 Scope:Link
UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
RX packets:58 errors:0 dropped:0 overruns:0 frame:0
TX packets:121 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7438 (7.2 KiB) TX bytes:42686 (41.6 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:250 errors:0 dropped:0 overruns:0 frame:0
TX packets:250 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:19556 (19.0 KiB) TX bytes:19556 (19.0 KiB)
usb0 Link encap:Ethernet HWaddr 04:a3:16:e1:5d:3b
inet addr:192.168.7.2 Bcast:192.168.255.255 Mask:255.255.0.0
inet6 addr: fe80::6a3:16ff:fee1:5d3b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:774 errors:0 dropped:0 overruns:0 frame:0
TX packets:519 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:101935 (99.5 KiB) TX bytes:93548 (91.3 KiB)
usb1 Link encap:Ethernet HWaddr 04:a3:16:e1:5d:3e
inet addr:192.168.6.2 Bcast:192.168.6.3 Mask:255.255.255.252
inet6 addr: fe80::6a3:16ff:fee1:5d3e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:166 errors:0 dropped:0 overruns:0 frame:0
TX packets:79 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:58485 (57.1 KiB) TX bytes:16017 (15.6 KiB)
Tags networking ip linux