Quando o cabo de rede foi hot plug, o dhcp-client altera o endereço IP estático.
Solução temporária:
mv /sbin/dhclient /sbin/dhclient.bak
Eu configurei meu BBB para o endereço IP estático, como abaixo:
root@beaglebone:/var/log# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.99
netmask 255.255.255.0
gateway 192.168.0.1
# Example to keep MAC address between reboots
#hwaddress ether DE:AD:BE:EF:CA:FE
# WiFi Example
#auto wlan0
#iface wlan0 inet dhcp
# wpa-ssid "essid"
# wpa-psk "password"
# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
# Note on some boards, usb0 is automaticly setup with an init script
# in that case, to completely disable remove file [run_boot-scripts] from the boot partition
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
E a configuração DNS da China, como abaixo:
root@beaglebone:/var/log# cat /etc/resolv.conf
nameserver 202.96.128.86
nameserver 202.96.134.33
De 2015-12-15 17:04:33 para 2015-12-22 23:03:41, meu BBB trabalhou com endereço IP estático 192.168.0.99 bem. Depois disso, meu endereço IP estático do BBB foi alterado estranhamente para 192.168.0.128:
root@beaglebone:/var/log# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether d0:5f:b8:e8:b3:86 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.128/24 brd 192.168.0.255 scope global eth0
inet6 fe80::d25f:b8ff:fee8:b386/64 scope link
valid_lft forever preferred_lft forever
3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether ba:5c:46:47:5f:c1 brd ff:ff:ff:ff:ff:ff
inet 192.168.7.2/30 brd 192.168.7.3 scope global usb0
E o /var/log/messages
como abaixo (Por quê?):
Dec 22 23:03:41 beaglebone kernel: [626417.699238] libphy: 4a101000.mdio:00 - Link is Down
Dec 22 23:03:44 beaglebone kernel: [626420.411322] net eth0: initializing cpsw version 1.12 (0)
Dec 22 23:03:44 beaglebone kernel: [626420.414330] net eth0: phy found : id is : 0x7c0f1
Dec 22 23:03:44 beaglebone kernel: [626420.430487] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Dec 22 23:03:45 beaglebone kernel: [626421.064855] net eth0: initializing cpsw version 1.12 (0)
Dec 22 23:03:45 beaglebone kernel: [626421.067713] net eth0: phy found : id is : 0x7c0f1
Dec 22 23:03:45 beaglebone kernel: [626421.083786] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Dec 22 23:03:47 beaglebone kernel: [626423.075018] libphy: 4a101000.mdio:00 - Link is Up - 100/Full
Dec 22 23:03:47 beaglebone kernel: [626423.075152] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Dec 22 23:03:51 beaglebone kernel: [626427.215227] net eth0: initializing cpsw version 1.12 (0)
Dec 22 23:03:51 beaglebone kernel: [626427.218207] net eth0: phy found : id is : 0x7c0f1
Dec 22 23:03:51 beaglebone kernel: [626427.234320] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Dec 22 23:03:51 beaglebone kernel: [626427.637475] net eth0: initializing cpsw version 1.12 (0)
Dec 22 23:03:51 beaglebone kernel: [626427.640382] net eth0: phy found : id is : 0x7c0f1
Dec 22 23:03:51 beaglebone kernel: [626427.656675] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Dec 22 23:03:53 beaglebone kernel: [626429.645608] libphy: 4a101000.mdio:00 - Link is Up - 100/Full
Dec 22 23:03:53 beaglebone kernel: [626429.645732] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Meu uname -a
como abaixo:
Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux
Ninguém acessou o BeagleBone para alterar seu ip, Por que a eth0 foi interrompida em 2015-12-22 23:03:41? Por que o endereço IP estático foi alterado após o down and up?
PS.
UPDATE1 Descobri que o cabo de rede hot-plug chamaria o caso mencionado acima, e o dmesg
aparecia o mesmo acima, mas qual foi o motivo? Talvez o meu trocador reiniciado ontem à noite por volta de 2015-12-22 23:03:41, eu não estou surpreso
UPDATE2
root@beaglebone:~# ps ax | grep dhc
1132 ? Ss 0:00 /usr/sbin/udhcpd -S /etc/udhcpd.conf
10022 ? Ss 0:00 /sbin/dhclient -v eth0
20352 pts/1 S+ 0:00 grep dhc
Quando o cabo de rede foi hot plug, o dhcp-client altera o endereço IP estático.
Solução temporária:
mv /sbin/dhclient /sbin/dhclient.bak
Primeiro faça:
apt-get purge connman dnsmasq*
Em seguida, você comente em /etc/network/interfaces
a configuração usb0
.
Em seguida, altere eth0
para static como este:
auto eth0
iface eth0 inet static
address 192.168.0.99
netmask 255.255.255.0
gateway 192.168.0.1
Não se esqueça de definir o DNS também em /etc/resolv.conf
.
nameserver 8.8.8.8
nameserver 8.8.4.4
Tags networking