다음과 같이 고정 IP 주소로 BBB를 설정했습니다.
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
중국의 DNS 구성은 다음과 같습니다.
root@beaglebone:/var/log# cat /etc/resolv.conf
nameserver 202.96.128.86
nameserver 202.96.134.33
2015-12-15 17:04:33부터 2015-12-22 23:03:41까지 내 BBB는 고정 IP 주소 192.168.0.99에서 제대로 작동했습니다. 그 후 내 BBB 고정 IP 주소는 이상하게도 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
아래와 비슷한 내용이 있습니다 /var/log/messages
(왜?).
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
내 uname -a
것은 다음과 같습니다 :
Linux beaglebone 3.8.13-bone47 #1 SMP Fri Apr 11 01:36:09 UTC 2014 armv7l GNU/Linux
누구도 BeagleBone에 접속하여 IP를 변경하지 않습니다.eth0이 2015-12-22 23:03:41 경에 왜 오르락 내리락합니까? 정지 및 상향 후에 고정 IP 주소가 변경되는 이유는 무엇입니까?
추신.
- BeagleBone은 재부팅되지 않습니다.
- 비슷한 Q를 찾았어요고정 IP 주소가 192.168.1.251로 이동되었습니다., 이건 도움이 안 돼요
- 명령 기록을 확인했는데 2015-12-22 23:03:41쯤에는 명령이 발견되지 않았습니다.
업데이트 1네트워크 케이블을 핫플러그하면 위와 dmesg
같은 상황이 발생하는 것으로 확인했는데, 그 이유는 무엇인가요? 어쩌면 내 스위치가 어젯밤 2015-12-22 23:03:41쯤에 재부팅되었을 수도 있습니다. 잘 모르겠습니다.
업데이트 2
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
답변1
네트워크 케이블이 핫 플러그되면 dhcp-client는 고정 IP 주소를 변경합니다.
임시 해결책:
mv /sbin/dhclient /sbin/dhclient.bak
답변2
먼저 다음을 수행하십시오.
apt-get purge connman dnsmasq*
/etc/network/interfaces
그런 다음 구성에서 이를 주석 처리합니다 usb0
. 그런 다음 eth0
다음과 같이 정적으로 변경하십시오.
auto eth0
iface eth0 inet static
address 192.168.0.99
netmask 255.255.255.0
gateway 192.168.0.1
에 참여하는 것을 잊지 마세요 /etc/resolv.conf
.
nameserver 8.8.8.8
nameserver 8.8.4.4