tip: auto network configuration on host

Thomas Karpiniec tk at 1.21jiggawatts.net
Fri Jun 25 23:39:39 EDT 2010


Hi folks,

I have a tip here which is totally not ground-breaking but might save
some time. If you're running debian or a similiar distro on your host
PC you can put the following in /etc/network/interfaces

allow-hotplug usb0
iface usb0 inet static
      address 192.168.1.200
      netmask 255.255.255.0
      up echo "1" > /proc/sys/net/ipv4/ip_forward; \
           /sbin/iptables -t nat -F; \
           /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

and when you plug in the USB cable you'll automatically get an IP and
set up masquerading for internet access. Make sure you choose the
appropriate IP -- 192.168.254.100 is the usual one for openwrt/the
official image.

Then on your nano you just need to make sure the gateway gets set. On
Jlime I put "route add default gw 192.168.1.200" in
/etc/muffinman-extras/final.sh. On openwrt, "option gateway
192.168.254.100" in /etc/config/network should do it.

I hope that helps someone. :)

Cheers,
Tom




More information about the discussion mailing list


interactive