world leader in high performance signal processing
Trace: » network

Networking and coLinux

There are many networking options available to you in coLinux. This is both a good and bad thing. Good because you have a lot of flexibility, bad because you have too much flexibility :).

This document is not meant to replace the exhaustive coLinux Network document. It's a selective reference that should cover the majority of people's needs as it comes to working with coLinux and Blackfin systems.

By default, two networking devices are set up for you by the Blackfin packaged coLinux installer. Both are private to the Windows↔coLinux environment and will not affect anything external to your Windows system. While you could set coLinux to get its own dedicated MAC/IP address, such things are not covered here.

Iface IP Method Purpose
eth0 10.0.2.x Slirp Stable link to the external world
eth1 10.12.12.x TAP Private high speed link to Windows

Configuration settings live in two places. You tell coLinux what interfaces to make available (and how) via the configuration file, and then you setup the networking while inside of coLinux. This part is distribution specific, but the file for Debian is /etc/network/interfaces.

You may need to disable the Windows firewall (or add appropriate exceptions for any ports you want forwarded to coLinux). If you're having networking troubles, the very first thing you should do is shut off the firewall. Once you've established that this is indeed the source of your troubles, please review the appropriate documentation or talk to your IT support for assistance.

For example, often times you can just do:

  • Control Panel → Windows Firewall → Turn it off
  • Control Panel → Administrative Tools → Services → Sygate Security Agent → Right Click for Properties → Disable
  • Restart your PC

eth0/Slirp

Slirp is a slower speed method for connecting coLinux to the wider network. It allows you to share the same public network information without needing dedicated settings. Also, while it may be a slower method, it is not to say it is slow. You can easily achieve 10+mbit speeds with it. This method also tends to be the most simple and stable, so it is the default.

If you wish to access services running under coLinux (such as ssh or tftp), then you can set up port forwarding. This way all requests that get sent to your public IP on the specified port will automatically get forwarded to coLinux. By default, a few ports are enabled for you.

coLinux Config

The relevant snippet from the coLinux configuration file looks like:

# Syntax: iface=method,mac[,port forwarding]
# port forwarding syntax: protocol:windows-port:colinux-port
eth0=slirp,,tcp:22:22/tcp:333:22/tcp:10000:10000/udp:69:69

Port Forwarding

This says to create eth0 by using slirp, and since we're sharing the connection with Windows, we do not specify our own MAC address. Then we tell coLinux to forward some ports for us:

Protocol coLinux Port Windows Port Purpose
TCP 22 22 SSH logins
TCP 22 333 SSH logins on alternative port (connect to Windows on port 333)
TCP 10000 10000 webmin
UDP 69 69 TFTP

The default setup is to allow people to login securely to coLinux as well as get files from it via TFTP.

Windows Config

Slirp will take care of the Windows connection information for you. There is nothing to change (not that you can in the first place).

Debian Config

In the /etc/network/interfaces file, we tell the system to acquire its network information automatically via DHCP.

auto eth0
iface eth0 inet dhcp

This works because coLinux will emulate a DHCP server on slirp connections which means we don't have to hardcode anything.

Default

With all these pieces in place, we see this information in a default setup:

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:FF:16:F0:75:40
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::2ff:16ff:fef0:7540/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:143 errors:0 dropped:0 overruns:0 frame:0
          TX packets:126 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15114 (14.7 KiB)  TX bytes:20670 (20.1 KiB)
          Interrupt:2
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.2.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
# cat /etc/resolv.conf
nameserver 10.0.2.3
# ping -c 2 10.0.2.2
PING 10.0.2.2 (10.0.2.2) 56(84) bytes of data.
64 bytes from 10.0.2.2: icmp_seq=1 ttl=255 time=0.000 ms
64 bytes from 10.0.2.2: icmp_seq=2 ttl=255 time=0.000 ms

--- 10.0.2.2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms

This tells us that the coLinux side of the slirp tunnel is using IP 10.0.2.15. The Windows side is using 10.0.2.2 as the gateway and 10.0.2.3 as the DNS server.

eth1/TAP

Another method for creating network connections is via a virtual network adapter referred to as TAP. This has the advantage of higher speeds and lower overhead than slirp, but it is more complicated and harder to set up. By default, it's a dedicated private connection between coLinux and Windows, which means it's really only useful if you want to run a Samba server on the coLinux system and mount those shares in Windows, or vice versa.

You could also set up a bridge under Windows so as to use this network device to connect coLinux to the outside world, doing so is out of scope of this document.

The installer will create this connection with the default settings of 10.12.12.1 for the Windows IP and 10.12.12.2 for the coLinux IP.

coLinux Config

The relevant snippet from the coLinux configuration file looks like:

eth1=tuntap

Windows Config

You can change the Windows IP via the normal Network Connections window like with any other network interface.

Debian Config

In the /etc/network/interfaces file, we tell the system to configure things statically.

auto eth1
iface eth1 inet static
   address 10.12.12.2
   netmask 255.255.255.0

Default

# ifconfig eth1
eth1      Link encap:Ethernet  HWaddr 00:FF:41:C8:C9:00
          inet addr:10.12.12.2  Bcast:10.12.12.255  Mask:255.255.255.0
          inet6 addr: fe80::2ff:41ff:fec8:c900/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:973 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:91040 (88.9 KiB)  TX bytes:608 (608.0 b)
          Interrupt:2
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.12.12.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
# ping -c 2 10.12.12.1
PING 10.12.12.1 (10.12.12.1) 56(84) bytes of data.
64 bytes from 10.12.12.1: icmp_seq=1 ttl=128 time=0.000 ms
64 bytes from 10.12.12.1: icmp_seq=2 ttl=128 time=0.000 ms

--- 10.12.12.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms

Troubleshooting

Preventing "network cable unplugged" message

If you use coLinux in Windows XP and TAP-Win32 in a manner in which you are frequently restarting the daemon, you might be annoyed by the “network cable unplugged” message. You can get rid of it with the following Windows settings:

Control-Panel -> Network Connections
 -> right click on the TAP-Win32 connection
 -> Properties -> Configure -> Advanced -> Media Status = Always connected.