I made setup where laptop/ubuntu detects phone/android being attached to usb:
/etc/udev/rules.d/99-input.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6863", RUN+="/root/usb.sh", MODE="0666" # samsung
Then usb.sh is run. It executes commands for reverse tethering.
sudo ifconfig usb0 10.42.0.1 netmask 255.255.255.0 >>/root/log 2>>/root/log_err
echo 1 > /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -F >>/root/log 2>>/root/log_err
sudo iptables -t nat -A POSTROUTING -j MASQUERADE >>/root/log 2>>/root/log_err
Log shows that operation went fine and usb0 IP being correct:
inet addr:10.42.0.1
BUT when I check it manually by executing 'ifconfig', it says that IP for usb0 is:
inet addr:192.168.x.x
WHY is the setting not preserved?
(On raspberry Pi it works correctly. Why not on laptop/Ubuntu? )
– user690954 Nov 18 '13 at 08:16