On Sun, Feb 22, 2015 at 5:00 AM, Marco <
fantaca...@gmail.com> wrote:
> Hi frank
>
> I tried with :os.cmd and I got different results both on BeagleBone either
> via telnet.
>
> When I am writing on iex, I get this error
>
> iex (demo @ nerves) 1>:os.cmd ('/sbin/ip link set eth0 up')
> libphy: PHY 4a101000.mdio: 01 not found
> net eth0: phy 4a101000.mdio: 01 not found on slave 1
The libphy and net eth0 messages come from the Linux kernel. You're
seeing them since kernel messages get printed on the serial port by
default. Those two messages are expected on the BBB. The AM3358 chip
on the BBB supports two Ethernet interfaces, but only one is hooked
up. The "00" ethernet interface was found, but the second one "01"
isn't.
> []
>
> If I rewrite the command, the error no longer appears
This is because the ethernet interface has been initialized by the
kernel. You shouldn't see the kernel messages again unless you reboot.
>
> iex (demo @ nerves) 2>:os.cmd ('/sbin/ip link set eth0 up')
> []
> iex (demo @ nerves) 3>:os.cmd ('/sbin/ip addr add
192.168.1.40/24 dev eth0')
> []
> iex (demo @ nerves) 4>:os.cmd ('/sbin/ip route add default via
> 192.168.1.254')
> []
>
> When I write another terminal before you enter commands in shell iex
>
> marco @ ubuntu: ~ $ telnet 192.168.1.40
> Trying 192.168.1.40 ...
> telnet: Unable to connect to remote host: No route to host
>
> after the commands
>
> marco @ ubuntu: ~ $ telnet 192.168.1.40
> Trying 192.168.1.40 ...
> telnet: Unable to connect to remote host: Connection refused
This is good. When the BBB's Ethernet interface was down, you should
get "No route to host" which is what you did. The "Connection refused"
is telling you that the BBB refused the TCP connection trying to
establish a telnet session. That means the Ethernet interface is up
and working, but since there's no telnet server running on the BBB, it
won't connect. Ping should work at this point too.
In a previous email, you said something about an echo server that you
wrote. You should be able to connect to that now if it's running.
Also, I'd recommend using the nc utility (netcat) for making TCP
connections. Telnet sends control characters and can make things
confusing. (See the DO/DONT, WILL/WONT part of RFC 854.)
Frank