Tag Archives: network

Making an Ethernet Loopback Adapder

This post will be short (and sweet). Ethernet Loopback Adapters are little handy pieces of equipment that route the transmitting pins in an Ethernet jack back to the receiving pins in the same jack. This is good for testing link connectivity on an Ethernet card – if the adapter can establish a link with itself the hardware on the adapter is probably OK. In real life, this can save you hassle quickly testing ADSL modems, routers, switches, desktops and laptops without plugging the device into another jack to get the link light to come on.

This how-to will use an existing Ethernet cable which will be converted to a Loopback cable.  There are lots of guides and video online about creating such an adapter using an Ethernet jack and wires, but this requires having an uncrimped  Ethernet jack, some wires, and a crimper. In my case, a trip to the store to buy the components I already have at home on ready Ethernet cables seemed wasteful (most people will have a cable or two, or can buy a short cat 5 cable for under 2 dollars). I strongly recommend using a cable with a broken or missing jack – after all, we only need one Ethernet jack which is properly wired to a cat5 or higher cable.

1. Cut the cat5 cable a few ( 2 or 3 ) inches from the jack.

2. Strip about an inch from the shielding of the cat 5 cable, revealing 8 separately shielded color coded wires inside.

3. Strip about half an inch from the shielding on four wires: green-white, green, orange-white, and orange.

4. Twist the green-white and orange-white stripped ends together, connecting pin 1 to pin 3.

5. Twist the green and orange stripped ends together, connecting pin 2 to pin 6.

If you have some tape, you may want to cover the tips up. Otherwise, make sure the tips don’t touch each other. The end result will look like this:

twisted pairs on an Ethernet loopback adapter

twisted pairs on an Ethernet loopback adapter

You can test your new loopback adapter in any working Ethernet jack by plugging it in!

You can see the Port line is on for a wireless router with the loopback adapter plugged in:

Link light on with loopback adaper plugged in

Link light on with loopback adaper plugged in


Leave a comment

Filed under #!

Make your PC link the Ben to the Internet, Automagically!

A familiar pain for Ben Nanonote users is connecting the Ben online every-time they plug it in. udev can remove this pain with a simple rule to run all the commands on the host the Ben is connected to when its connected. To get this done, you will need 2 pieces: a udev rule, and a script.

Your udev rule can be a file under  /etc/udev/rules.d/ . I called mine “72-BenNanoNnote-net.rules”

It’s content should look like this:

SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0525", ATTR{idProduct}=="a4a1", RUN+="/usr/local/bin/ben-net.sh"
# where RUN+= points to your script

The script should look like this, and can feel comfortable under /usr/local/bin :

if (/usr/bin/lsusb -t -d "0525:a4a1"); then
        echo .
        echo "Ben NanoNote found, setting up USB network ... "
        if !( /sbin/lsmod | grep 'ip_tables' ) && ( /sbin/modprobe -l ip_tables ); then
                /sbin/modprobe ip_tables
                echo "ip_tables is now loaded"
                echo "ip_tables already loaded"
        if ( grep '0' /proc/sys/net/ipv4/ip_forward ); then
                echo "1" > /proc/sys/net/ipv4/ip_forward
                echo "IP forwarding is now enabled"
                echo "IP forwarding already enabled"
        if !( /usr/sbin/iptables -L | grep $GATEWAY_IF ); then
                /usr/sbin/iptables -t nat -A POSTROUTING -o $GATEWAY_IF -j MASQUERADE
                echo "Routing is now enabled"
                echo "Routing already setup on "$GATEWAY_IF
        /sbin/ifconfig usb0 netmask
# where GATEWAY_IF is the interface that is connected to your LAN or the Internet.

Leave a comment

Filed under Ben Nanonote

Eavesdropping with Linux – A BigBrother Network Bridge (or: kiss your privacy goodbye)

All wires can be tapped. Luckily Ethernet wires are no exception. This How-to will cover the fastest way to get everything you need for eavesdropping on your network neighbors: setting up 2 bridged Ethernet adapters and configuring them for an uninterrupted network flow, which then can be monitored or shaped.

The most reliable way to achieve full transparency and control over a specific network segment is to have a full featured operating system on a network bridge (a HUB or a Switch) – Having network tools running locally on a relay point is hard to beat. There are lots of commercial grade relay points you can purchase, but any Cisco router which will give you network management tools is likely to still be lacking, and expensive. In other words – good-luck running graphical or 3rd party propriety applications on your 300$ switch.

This How-to will leave you with a box which will always come up with 2 bridged adapters. There will be uninterrupted network flow between the box and the network segment it fragments. There will be remote access and tools to play with. It shall be a real privacy violator. Let’s get to it!

You will need:

  • 1 Desktop/Workstation/Server
  • 2 Ethernet cards
  • Linux distribution (we like Slackware Linux) with this software installed:
    • net-tools
    • bridge-utils
    • iptables
    • X11 (recommended for VNC)
    • xfs (recommended for VNC)

1.  Prepare Ethernet adapters for bridging:

The about to be bridged adapters should have no assigned IPs and placed in promiscuous mode:

# ifconfig eth0 promisc up
# ifconfig eth1 promisc up

2. Bridge the Ethernet adapters using bridge-utils:

# brctl addbr br0
# brctl addif br0 eth0
# brctl addif br0 eth1

3. Configure and initialize the new network bridge:

# ifconfig br0 netmask broadcast up

4. Ensure uninterrupted flow between adapters and bridge:

# iptables -A INPUT -i eth0 -j ACCEPT
# iptables -A INPUT -i eth1 -j ACCEPT
# iptables -A INPUT -i br0 -j ACCEPT

5. Setup networking for the eavesdropping machine itself:

# route add default gateway br0
# echo "nameserver" > /etc/resolv.conf

6. Install a TightVNC server for remote access:

Having access to the graphic environment on the eavesdropping machine is very handy, when you consider the awsome GUI of Wireshark and Zenmap (or the lame fact Wireshark MUST have a GUI to run). TightVNC is the best VNC server out there, and it happens to be free! Get the source, compile and install, then start the X Font Server and TightVNC:

# xfs -daemon
# vncserver :1

7. Install Wireshark (and other tools)

This is where it all comes together – the power of having color-coded packet entries fly by your eyes at the speed of lite, or, well, electricity, is hard to beat. Wireshark is the best network packet analyzer out there. Luckily, it’s also the easiest to run. Get the source, compile and install. ZenMap also goes a long way on such a setup, but as it ships with Slackware, we’ll leave those steps out.

8. Script the whole thing:

This bit is here only to ensure you’ll keep eavesdropping after a reboot 😉 The easiest way to achieve this is to dump all the above commands into a file, make it executable, and place an entry for it in /etc/rc.local.

You can use this tested rc.bigbrother script if you are feeling lazy. It will do all of the above and more. Just place it anywhere and add to /etc/rc.local.


Screen-shot of BigBrother in action

Screen-shot of BigBrother in action

Leave a comment

Filed under #!