Skip to main content

Buildroot

PC Configuration

  1. Windows Security Center -> Firewall and Network Protection -> Turn off the firewall.

  2. Configure the static IP of the RNDIS network card, open Settings -> Advanced Network Settings -> Change Adapter Options.

  3. After connecting the development board, an unrecognized local network will appear on the PC side.

  4. Share the PC network with the development board network.

  5. Configure the development board network information.

Development Board Configuration

  1. Add route information

    route add default gw 172.32.0.100
  2. Add DNS servers

    Open the file

    vi /etc/resolv.conf

    Add the following content:

    nameserver 8.8.8.8
  3. Network test

    ping -I usb0 www.baidu.com
  4. Automatic configuration at startup

    Route information and DNS servers will be cleared after a restart. We create a script to automatically complete the configuration for us after startup.

    cd /etc/init.d
    vi S99usb_network

    Add the following content:

    #!/bin/sh

    case $1 in
    start)
    route add default gw 172.32.0.100
    echo "nameserver 8.8.8.8" > /etc/resolv.conf
    ;;
    stop)
    ;;
    *)
    exit 1
    ;;
    esac

    Modify script permissions

    chmod 775 S99usb_network

Network Test

  1. View route information

    # route -n
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    0.0.0.0 172.32.0.100 0.0.0.0 UG 0 0 0 usb0
    172.32.0.0 0.0.0.0 255.255.0.0 U 0 0 0 usb0
  2. View DNS servers

    # cat /etc/resolv.conf
    nameserver 8.8.8.8
  3. Network test

    # ping -I usb0 www.baidu.com
    PING www.baidu.com (183.2.172.42): 56 data bytes
    64 bytes from 183.2.172.42: seq=0 ttl=50 time=9.827 ms
    64 bytes from 183.2.172.42: seq=1 ttl=50 time=9.258 ms
    64 bytes from 183.2.172.42: seq=2 ttl=50 time=8.340 ms
    64 bytes from 183.2.172.42: seq=3 ttl=50 time=8.994 ms
    64 bytes from 183.2.172.42: seq=4 ttl=50 time=9.933 ms
    64 bytes from 183.2.172.42: seq=5 ttl=50 time=8.321 ms
    64 bytes from 183.2.172.42: seq=6 ttl=50 time=8.609 ms
    64 bytes from 183.2.172.42: seq=7 ttl=50 time=9.013 ms
    64 bytes from 183.2.172.42: seq=8 ttl=50 time=9.234 ms
    64 bytes from 183.2.172.42: seq=9 ttl=50 time=9.284 ms
    ^C
    --- www.baidu.com ping statistics ---
    10 packets transmitted, 10 packets received, 0% packet loss
    round-trip min/avg/max = 8.321/9.081/9.933 ms