How to start network in Linux

      How to start network in Linux

      One of the settings that is available in the F&S environment in U-Boot is the option to activate the network in Linux by running one of the variables .network_on and .network.dhcp. This will work as expected, but please note that this means the kernel will wait until the network is actually up. This is very useful (and even necessary) if the root filesystem is accessed via network (e.g. when using run .rootfs_nfs), but may be undesired in most other situations. For example if the network cable is not plugged in, such a configuration will block the boot process.

      In most situations, having an optional network active in Linux is done in a different way, namely by modifying the file /etc/network/interfaces. The networking infrastructure available in Buildroot will check this file and will start up the ethernet port without blocking the boot process. For example starting eth0 via DHCP is done by adding the following two lines to this file:

      Source Code

      1. auto eth0
      2. iface eth0 inet dhcp


      If you want to give fix networking parameters, you add these lines instead:

      Source Code

      1. auto eth0
      2. iface eth0 inet static
      3. address 10.0.0.251
      4. network 10.0.0.0
      5. netmask 255.255.255.0
      6. broadcast 10.0.0.255
      7. gateway 10.0.0.5


      Because of the first line, the port will be started automatically in both cases. These are only examples, the file can support even more complicated settings. Please have a look at some decent Linux documentation if you need this.

      Remark

      The first case can also be configured in Buildroot directly. In menuconfig, go to "System configuration" -> "Network interface to configure through DHCP" and enter "eth0" in the parameter field. Then Buildroot will automatically fill in these two lines in /etc/network/interfaces.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.