BBB의 고정 IP는 네트워크/인터페이스 파일로 변경되지 않습니다.

BBB의 고정 IP는 네트워크/인터페이스 파일로 변경되지 않습니다.

저는 여러 개의 BBB(Rev C)를 사용하고 있으며 USB를 통해 Mac(OSX 10.9.3)에서 BBB와 통신하고 있습니다.혼디스드라이버. BBB는 데비안을 실행하고 있으므로 모든 다른 고정 IP를 수동으로 할당하고 싶습니다. 그러나 IP가 192.168.7.2. /etc/network/interfacesIP를 갖도록 파일을 변경해도 192.168.7.10아무 작업도 수행되지 않습니다.

# 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 dhcp
# Example to keep MAC address between reboots
#hwaddress ether DE:AD:BE:EF:CA:FE

auto eth0
iface eth0 inet static
address 192.168.2.2
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1

# 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.10
    netmask 255.255.255.0
    network 192.168.7.0
    gateway 192.168.7.1

실제로 부팅 파티션에 내가 변경한 파일이 있었지만 결과는 없었습니다.

#!/bin/bash

# Update /etc/network/interfaces to add virtual Ethernet port
cat >>/etc/network/interfaces <<EOF

iface usb0 inet static
  address 192.168.7.10
  netmask 255.255.255.0
  network 192.168.7.0
  gateway 192.168.7.1
EOF

# Add terminal to virtual serial port
cat >/etc/init/gadget-serial.conf <<EOF
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty 115200 ttyGS0
EOF

# Write script to start gadget driver
cat >/usr/sbin/g-multi-load.sh <<'EOF'
#!/bin/bash
if [ "`lsmod | grep g_multi`" != "" ]; then exit 0; fi
mac_addr=/proc/device-tree/ocp/ethernet@4a100000/slave@4a100300/mac-address
eeprom=/sys/bus/i2c/devices/0-0050/eeprom

DEV_ADDR=$(perl -e 'print join(":",unpack("(H2)*",<>))' ${mac_addr})
VERSION=$(perl -e '@x=unpack("A12A4",<>); print $x[1]' ${eeprom})
SERIAL_NUMBER=$(perl -e '@x=unpack("A16A12",<>); print $x[1]' ${eeprom})
ISBLACK=$(perl -e '@x=unpack("A20A4",<>); print $x[1]' ${eeprom})

BLACK=""
if [ "${ISBLACK}" = "BBBK" ] ; then
    BLACK="Black"
fi
if [ "${ISBLACK}" = "BNLT" ] ; then
    BLACK="Black"
fi

modprobe g_multi file=/dev/mmcblk0p1 cdrom=0 stall=0 removable=1 nofua=1 iSerialNumber=${SERIAL_NUMBER} iManufacturer=Circuitco iProduct=BeagleBone${BLACK} host_addr=${DEV_ADDR}

# Enable the network interface
sleep 1
ifup usb0
EOF
chmod +x /usr/sbin/g-multi-load.sh

# Add script to rc.local
perl -i -pe 's!^exit 0!/usr/sbin/g-multi-load.sh\nexit 0!' /etc/rc.local

# Install DHCP server
sudo apt-get -y update
sudo apt-get -y install isc-dhcp-server

# Configure DHCP server
cat >/etc/ltsp/dhcp.conf <<EOF
ddns-update-style none;
subnet 192.168.7.0 netmask 255.255.255.252 {
  range 192.168.7.1 192.168.7.1;
}
EOF
perl -i -pe 's/INTERFACES=".*"/INTERFACES="usb0"/' /etc/default/isc-dhcp-server

# Start up services
/usr/sbin/g-multi-load.sh
service isc-dhcp-server start

답변1

BeagleBone Black에 대해 변경해야 할 세 번째 파일이 있습니다: /opt/scripts/boot/am335x_evm.sh

여기에서 찾았습니다. http://ewong.me/changing-usb0-ip-address-on-the-beaglebone-black

답변2

내 BBB에서 이것을 시도했지만 작동하지 않았습니다. 내 Beaglebone의 네트워크 구성은 connman에 의해 제어되고 있는 것으로 밝혀졌습니다. /etc/network/interfaces 및 기타 스크립트 파일을 편집해도 재부팅 후에는 아무런 효과가 없습니다. (GUI 인터페이스를 사용했다면 이것이 더 분명했을 것입니다. 그랬듯이 저는 무슨 일이 일어나고 있는지 알아내려고 몇 시간 동안 바퀴를 돌렸습니다...) 마침내 정적 인터페이스로 영구적으로 변경되었습니다. 다음 명령을 입력하여 IP 구성을 수행하십시오.

먼저 (내 경우에는 유선) 연결에 대한 "서비스 이름"을 찾아야 합니다. 입력하다:

연결 서비스

제 경우에는 유선 연결 이름이 "ethernet_b0d5cc8194db_cable"이었습니다. 연결 구성을 설정하려면 이 정보가 필요합니다. 다음은 eth0(유선) 연결을 고정 IP 주소 "192.168.1.219"로 설정합니다.

connmanctl config ethernet_b0d5cc8194db_cable ipv4 수동 192.168.1.219 255.255.255.0 192.168.1.1

네임서버를 추가하려면:

connmanctl config ethernet_b0d5cc8194db_cable --nameservers 8.8.8.8

또한 ipv6을 비활성화할 수도 있었습니다(제가 선호하는 것임).

connmanctl 구성 ethernet_b0d5cc8194db_cable ipv6 끄기

우리가 Linux에서 네트워크를 구성하는 다양한 방법을 생각해 내는 것은 부끄러운 일입니다!

-남자

관련 정보