Buildroot-ts Network

From embeddedTS Manuals
Revision as of 11:14, 24 April 2018 by Kris (talk | contribs) (Initial creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

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.