1

An embedded device running Linux version 2.6.26.5, ARM Linux Kernel. Busybox v1.10.2 shell (ash), I'm in Busybox shell. I want to set up connection between embedded device and computer. Is it possible manually set up network connection from Busybox shell? I mounted a main virtual file systems (proc, sysfs, tmpfs, /dev/pts), then entered commands to setup network, but without success. I guess, possibly, some modules or drivers were not loaded in this shell mode, but I'm not sure.

BusyBox v1.10.2 (2017-08-02 14:07:25 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
# mount -t proc proc /proc
# mount -t sysfs sysfs /sys
# mount -t tmpfs tmpfs /tmp
# mount -t tmpfs tmpfs /dev
# mkdir /dev/pts
# mount -t devpts devpts /dev/pts
# mdev -s
# ifconfig lo 127.0.0.1
# ifconfig eth0 hw ether 88:75:56:05:6D:28
# ifconfig eth0 192.168.15.1 netmask 255.255.255.0 broadcast 192.168.15.255
# ifconfig eth0 up
# route add -net 192.168.15.0/24 eth0
# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 88:75:56:05:6D:28  
          inet addr:192.168.15.1  Bcast:192.168.15.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:22 

# ping 192.168.15.100
PING 192.168.15.100 (192.168.15.100): 56 data bytes
From 192.168.15.100 icmp_seq=0 timed out

Edit: ifconfig eth0 output on Ubuntu computer:

$ ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 20:47:47:49:bc:75  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
minto
  • 111
  • 1
  • 1
  • 4
  • 1
    What is the network layout? What is 192.168.15.100 device? – Tero Kilkanen Apr 21 '19 at 22:17
  • Ohh.. Seems this can be error, I specified 192.168.15.100 as IP address of Ubuntu computer to which embedded device is connected via ethernet port. But actually, since network connection is missing, the Ubuntu computer have **no** this IP. This 192.168.15.100 is IP address of Ubuntu computer when an embedded device is connected in regular way: i.e. device powered on, the entire kernel is automatically loaded into memory (without entering into Busybox shell). 192.168.15.1 is default IP address of the board. Should I configure static IP on Ubuntu computer? – minto Apr 22 '19 at 00:19
  • 1
    Your Ubuntu box needs an IP address in order to communicate. If it normally receives the address via DHCP, then you need to configure a static address if DHCP is not running. – Tero Kilkanen Apr 22 '19 at 09:18
  • Yes, will try with static IP. _Note:_ do I need specify broadcast address `broadcast 192.168.15.255` when I configure an embedded device? – minto Apr 22 '19 at 09:30
  • You don't need to specify `broadcast` when you are specifying netmask. It doesn't depend on the device type at all, IP networking is same everywhere. – Tero Kilkanen Apr 22 '19 at 09:31
  • I configured static IP on Ubuntu PC and network connection works now. – minto Apr 27 '19 at 21:39

1 Answers1

0

Busybox includes the ip command as part of the package. This allows you to add an ip address to an interface like this. (replace <examples> with your values)

ip addr add <10.128.55.2> dev <eth0>

It also includes route and link configuration options. Here's the docs: https://linux.die.net/man/8/ip

Robert Rapplean
  • 302
  • 1
  • 2
  • 12