WisH : RouteR

USB PorT :


I made a script to share my Internet , when any of my 2 computers in a LAN need Internet access :

  • it tries to find gateways
  • and if there is none
  • it sets itself as one and share the connection.

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]]


  • nrv : ppp0 (internet) , eth0 (lan)
  • teuz : eth0 (lan)

ToDo add 3+ hosts support, proxy and firewall

References : French Linux Mag 200410 p14 by http://lionel.tricon.free.fr

GATEWAY LAN without 2 [[Ethernet]] card

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 netmask 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
# Client Side
/sbin/ifconfig eth0 up # C
route del default
route add default gw # @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):

  • Black=0, brown=1, orange=2, red=3, yellow=4, green=5, blue=6, purple=7 gray=9 white=10


[[Ethernet]] [[Modem]]  <=(RJ45)=> [[Laptop]] <=([[USB]])=> [[Computer]]

Ethernet over a Usb PC to PC cable ( Scare USB female 2 , Rect USB female)

# 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/
# usb0: register usbnet at usb-0000:00:02.0-1, Genesys GeneLink, c2:d5:8a:76:a5:bf
ifconfig usb0 down # @S
ifconfig usb0 netmask up # @S
ping -c 1 # @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 netmask up #@C
ping -c 1 # @C # test local network ok
ping -c 1 # @C # test local network ok
route del default # @C
route add default gw # @C # link to gateway
ping # @C #thats a DNS server outside the LAN
echo -e "\n nameserver" >> /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 :




gateway.txt · Last modified: 2020/04/20 18:23 (external edit)
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki