Networking Notes

Networking Over Usb Aka Reverse Teethering

when i don't have access to a wireless network, such as at work, i'd like to connect my phone to my computer and use my computer's Internet connection.

On Linux Computer, setup a bridge:

# usb0 is the new network intreface
sudo ifconfig eth0
sudo ifconfig usb0
sudo brctl addbr br0
sudo brctl addif br0 eth0
sudo brctl addif br0 usb0
sudo ifconfig br0 up
sudo dhclient br0

On windows, Bridge the 2 network interfaces

Setup usb0 interface of your phone. You have to options:
1. From your computer, execute:
./adb shell netcfg usb0 dhcp
2. Or in a root terminal on your phone, type:
netcfg usb0 dhcp

You should now be able to connect to Internet on your phone using your computer's Internet connection.

Try to do a ping to be sure !



sudo ifconfig eth0 down
sudo ifconfig usb0 down
sudo ifconfig br0 down
sudo brctl delbr br0
sudo ifconfig eth0 up
sudo dhclient eth0

Then on your phone, uncheck the USB Tethering option !

On laptop, I'm using following script on laptop after enabling USB tether in Settings > Wireless & Networks > Tethering to setup default route on Android through laptop's network and provide NAT for it.
#!/bin/sh -x

sudo id

android=`adb shell ip addr list usb0 | grep 'inet ' | sed 's/^ *//g'`

a_ip=`echo $android | cut -d" " -f2 | cut -d/ -f1`
c_ip=`echo $a_ip | cut -d. -f-3`.1
netmask=`echo $android | cut -d" " -f4`

echo "Android $a_ip netmask $netmask -> $c_ip"

sudo ifconfig usb0 $c_ip netmask $netmask up
sudo iptables -t nat -A POSTROUTING -s $a_ip -o br0 -j MASQUERADE

adb shell ip route add default via $c_ip
adb shell setprop net.dns1

adb shell ping -c 1 $c_ip
ping -c 1 $a_ip

Compile ettercap 0.7.4 on Ubuntu

  • Download ettercap-0.7.4.tar.gz and unzip it
  • Download ettercap-NG-0.7.3.tar.gz, unzip it and copy utils\etterfilter\ef_grammar.h to the same folder in the ettercap-0.7.4 distribution
  • Get all the prerequisites

sudo aptitude install libpcre3-dev libtoolize autoconf bison libpango1.0-dev libatk1.0-dev libgtk2.0-dev libnet-dev libpcap-dev

  • Compile and install

sudo make install

All done. If you have a restrictive umask, open up the config folder

sudo chmod 755 /usr/local/share/ettercap/

Wireshark filter to hide broadcast traffic

eth.type == IP and (not (eth.addr == ff:ff:ff:ff:ff:ff||eth.addr contains 01:00:5e))

Eliminates ethernet broadcast,multicast and not IP based traffic

Increasing wireless range indoors



How can I increase range outdoors?


How do I read signal and noise ratings?

These numbers are given in decibels (dB) and are expressed as negative numbers. So, a lesser number, like -40 dB, represents more strength than -70 dB. The values are logarithmic. A signal amplitude change of 3 dB is equivalent to a factor of two; 10 dB is a factor of ten.

Based on this Forum-post





Examples would be: Signal Noise SNR Signal Quality -82 -98 16 14%

Signal - Noise = SNR

 -82  -  -98  = 16

Signal / Noise * SNR = Signal Quality

 -82  /  -98  * 16  = 13.4%


@TechnicalNotes @Networking