USB PorT :
I made a script to share my Internet , when any of my 2 computers in a LAN need Internet access :
This was useful because having a static gateway assume that it is always running when internet is need, and that is a waste of energy. Fell free to contact me if you improve it.
url: http://rzr.online.fr/docs/contribs/bin/net.sh
My script worked for me :
[[Ethernet]] [[Modem]] <=(RJ45)=> [[Ethernet]] Hub \ \=(RJ45)=> [[Laptop]] (nrv) on [[Linux]] \ \=(BNC)=> [[Computer]] (teuz) on [[Linux]]
Interfaces:
ToDo add 3+ hosts support, proxy and firewall
References : French Linux Mag 200410 p14 by http://lionel.tricon.free.fr
I use free.fr 's freebox (which is a bridge that can be set as a router too)
[[Freebox]] <===> [[Ethernet]] hub \ \_ Server eth0 + eth0:0 \_ Client eth0
# Server side /sbin/ifconfig eth0:0 192.168.1.154 netmask 255.255.255.0 up # @S # both can ping themselves echo "1" | sudo tee /proc/sys/net/ipv4/ip_forward # @S iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # @S
you can set this permanently with /etc/sysctl.conf and /etc/networking/interface (pre up ) :
grep forwarding /etc/sysctl.conf net.ipv4.conf.default.forwarding=1
# Client Side /sbin/ifconfig eth0 192.168.1.100 up # C route del default route add default gw 192.168.1.154 # @C # link to gateway # check
Internet Hardware : http://adsl.free.fr/admin/routeur.html http://www.glatozen.org/freebox.php http://www.tldp.org/HOWTO/IP-Alias/commands.html
If using coax, hat is 50 ohms ( Green Black Brown)
Here are restistances codes (in same order as rainbow):
[[Ethernet]] [[Modem]] <=(RJ45)=> [[Laptop]] <=([[USB]])=> [[Computer]]
Ethernet over a Usb PC to PC cable ( Scare USB female 2 , Rect USB female)
lsusb # Bus 001 Device 002: ID 05e3:0502 Genesys Logic, Inc. GL620USB GeneLink USB-USB Bridge
dmesg # on [[AmiloA]] # usb 1-1: new full speed USB device using ohci_hcd and address 6
# S is Server, and C is Client (S has the internet link let say ppp0) poff -a pon dsl-provider route add default ppp0
#S+C# #compile kernel W/ : CONFIG_USB_USBNET=m # device driver / usb support / usb network / mutli purpose usb networking
modprobe -r usbnet #S+C modprobe -v usbnet ; dmesg #S+C# mii # insmod /lib/modules/2.6.14.2-k7-amiloa/kernel/drivers/usb/net/usbnet.ko # usb0: register usbnet at usb-0000:00:02.0-1, Genesys GeneLink, c2:d5:8a:76:a5:bf
ifconfig usb0 down # @S ifconfig usb0 192.168.2.254 netmask 255.255.255.0 up # @S ping -c 1 192.168.2.254 # @S # test local network ok
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE # @S echo "1" > /proc/sys/net/ipv4/ip_forward # @S
# Or : # grep ip_forward /etc/network/options # ip_forward=yes #
# On USB client ifconfig usb0 down # @C ifconfig usb0 192.168.2.100 netmask 255.255.255.0 up #@C ping -c 1 192.168.2.100 # @C # test local network ok ping -c 1 192.168.2.254 # @C # test local network ok route del default # @C route add default gw 192.168.2.254 # @C # link to gateway ping 130.244.127.161 # @C #thats a DNS server outside the LAN echo -e "\n nameserver 130.244.127.161" >> /etc/resolv.conf # @C
cat /var/log/ppp-connect-errors pppoe: read (asyncReadFromPPP): Session 56250: Input/output error pppoe: Timeout waiting for PADS packets
References :