Buildroot-ts Network

From Technologic Systems Manuals

Buildroot implements the 'ip', 'ifconfig', and 'route' commands to manipulate the settings of interfaces. The first ethernet interface is set up to come up automatically with our default configuration. The interfaces can also be manually set up:

# Bring up the CPU network interface
ifconfig eth0 up

# Set an ip address (assumes 255.255.255.0 subnet mask)
ifconfig eth0 192.168.0.50

# Set a specific subnet
ifconfig eth0 192.168.0.50 netmask 255.255.0.0

# Configure your route.  This is the server that provides your internet connection.
route add default gw 192.168.0.1

# Edit /etc/resolv.conf for your DNS server
echo "nameserver 192.168.0.1" > /etc/resolv.conf

Most commonly, networks will offer DHCP which can be set up with one command:

# To setup the default CPU ethernet port
udhcpc -i eth0
# You can configure all ethernet ports for a DHCP response with
udhcpc


To have network settings take effect on startup in Buildroot, edit /etc/network/interfaces:

# interface file auto-generated by buildroot

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
  pre-up /etc/network/nfs_check
  wait-delay 15
Note: The default network startup may timeout on some networks. This can be resolved by adding either of the following under the "iface eth0 inet dhcp" section: "udhcpc_opts -t 0" to infinitely retry, or "udhcpc_opts -t 5" to fail after five attempts.

See the man page for interfaces(5) for further information on the syntax of the file.

For more information on network configuration in general, Debian provides a great resource here that can be readily applied to Buildroot in most cases.