Buildroot-ts Network: Difference between revisions
From embeddedTS Manuals
m (Kris moved page Buildroot-2018.02 Network to Buildroot-ts Network: No longer tied to 2018 release) |
(Cleanup) |
||
Line 1: | Line 1: | ||
Buildroot implements the | Buildroot implements the <source inline>ip</source>, <source inline>ifconfig</source>, <source inline>route</source>, etc., commands to manipulate the settings of interfaces. The first Rthernet interface is set up to come up automatically with our default configuration. The interfaces can also be manually set up: | ||
<source lang=bash> | <source lang=bash> | ||
# Bring up the CPU network interface | # Bring up the CPU network interface | ||
ifconfig eth0 up | ifconfig eth0 up | ||
# Set an | # Set an IP address (assumes 255.255.255.0 subnet mask) | ||
ifconfig eth0 192.168.0.50 | ifconfig eth0 192.168.0.50 | ||
Line 10: | Line 10: | ||
ifconfig eth0 192.168.0.50 netmask 255.255.0.0 | ifconfig eth0 192.168.0.50 netmask 255.255.0.0 | ||
# Configure | # Configure a default route. This is the server that provides an internet connection. | ||
route add default gw 192.168.0.1 | route add default gw 192.168.0.1 | ||
# Edit /etc/resolv.conf for | # Edit /etc/resolv.conf for the local DNS server | ||
echo "nameserver 192.168.0.1" > /etc/resolv.conf | echo "nameserver 192.168.0.1" > /etc/resolv.conf | ||
</source> | </source> | ||
Line 21: | Line 21: | ||
# To setup the default CPU ethernet port | # To setup the default CPU ethernet port | ||
udhcpc -i eth0 | udhcpc -i eth0 | ||
# | # All Ethernet ports can be made active and request DHCP addresses with: | ||
udhcpc | udhcpc | ||
</source> | </source> | ||
To have network settings take effect on startup in Buildroot, edit /etc/network/interfaces: | To have network settings take effect on startup in Buildroot, edit <source inline>/etc/network/interfaces</source>: | ||
<source lang=bash> | <source lang=bash> | ||
# interface file auto-generated by buildroot | # interface file auto-generated by buildroot | ||
Line 38: | Line 38: | ||
wait-delay 15 | wait-delay 15 | ||
</source> | </source> | ||
{{Note|The default network startup may timeout on some networks. This can be resolved by adding either of the following under the | {{Note|The default network startup may timeout on some networks. This can be resolved by adding either of the following under the <source inline>iface eth0 inet dhcp</source> section: <source inline>udhcpc_opts -t 0</source> to infinitely retry, or <source inline>udhcpc_opts -t 5</source> to fail after five attempts.}} | ||
See the man page for interfaces(5) for further information on the syntax of the file. | 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 [http://wiki.debian.org/Network here] that can be readily applied to Buildroot in most cases. | For more information on network configuration in general, Debian provides a great resource [http://wiki.debian.org/Network here] that can be readily applied to Buildroot in most cases. |
Revision as of 18:00, 3 April 2023
Buildroot implements the ip
, ifconfig
, route
, etc., commands to manipulate the settings of interfaces. The first Rthernet 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 a default route. This is the server that provides an internet connection.
route add default gw 192.168.0.1
# Edit /etc/resolv.conf for the local 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
# All Ethernet ports can be made active and request DHCP addresses 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.