Difference between revisions of "Talk:ECE497 Tips and Tricks"
Line 4: | Line 4: | ||
Here's my whole script: | Here's my whole script: | ||
− | + | <pre> | |
− | + | #!/bin/sh | |
− | + | BEAGLE_ADDR=192.168.7.2 | |
+ | HOST_ADDR=192.168.7.1 | ||
− | + | sudo sh -c <<SCRIPT | |
− | + | gwdev=en0 | |
− | + | targetdev=en1 | |
− | + | /sbin/ifconfig $targetdev down | |
− | + | /sbin/ifconfig bridge0 create | |
− | + | /sbin/ifconfig bridge0 up | |
− | + | /sbin/ifconfig bridge0 addm $gwdev | |
− | + | /sbin/ifconfig bridge0 $HOST_ADDR | |
− | + | /sbin/route add default -interface bridge0 -ifscope bridge0 -cloning | |
− | + | /usr/sbin/sysctl -w net.inet.ip.forwarding=1 | |
− | + | /sbin/ipfw add 100 divert natd ip from any to any via $gwdev | |
− | + | /usr/sbin/natd -interface $gwdev -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss -enable_natportmap -natportmap_interface $targetdev | |
− | + | SCRIPT | |
− | + | ssh-copy-id $BEAGLE_ADDR | |
− | + | scp /etc/resolv.conf root@$BEAGLE_ADDR:/tmp | |
− | + | ssh root@$BEAGLE_ADDR "cat /etc/resolv.conf >> /tmp/resolv.conf.orig" | |
− | + | ssh root@$BEAGLE_ADDR "cp /tmp/resolv.conf /etc/resolv.conf" | |
− | + | ssh root@$BEAGLE_ADDR "/sbin/route add default gw $HOST_ADDR" | |
− | + | </pre> | |
+ | [[User:Jkridner|Jkridner]] ([[User talk:Jkridner|talk]]) 20:38, 6 July 2013 (UTC) |
Revision as of 13:39, 6 July 2013
I believe the topic of Internet connection sharing from a Windows/Linux/Mac host to BeagleBone's USB virtual network connection could be elevated to its own page as I believe this is a common use-case. In the case of Mac, I've found http://apple.stackexchange.com/questions/73485/internet-sharing-from-wifi-to-ethernet-doesnt-work-in-mountain-lion, but haven't had time to try it.
This worked for me: https://discussions.apple.com/thread/5152615
Here's my whole script:
#!/bin/sh BEAGLE_ADDR=192.168.7.2 HOST_ADDR=192.168.7.1 sudo sh -c <<SCRIPT gwdev=en0 targetdev=en1 /sbin/ifconfig $targetdev down /sbin/ifconfig bridge0 create /sbin/ifconfig bridge0 up /sbin/ifconfig bridge0 addm $gwdev /sbin/ifconfig bridge0 $HOST_ADDR /sbin/route add default -interface bridge0 -ifscope bridge0 -cloning /usr/sbin/sysctl -w net.inet.ip.forwarding=1 /sbin/ipfw add 100 divert natd ip from any to any via $gwdev /usr/sbin/natd -interface $gwdev -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss -enable_natportmap -natportmap_interface $targetdev SCRIPT ssh-copy-id $BEAGLE_ADDR scp /etc/resolv.conf root@$BEAGLE_ADDR:/tmp ssh root@$BEAGLE_ADDR "cat /etc/resolv.conf >> /tmp/resolv.conf.orig" ssh root@$BEAGLE_ADDR "cp /tmp/resolv.conf /etc/resolv.conf" ssh root@$BEAGLE_ADDR "/sbin/route add default gw $HOST_ADDR"