First I restart both computers and let them fully boot.
Then I connect the cable.
Then I enter commands.
The guide says to use 192.168.0.*, but I use 192.168.1.*, because the pre-existing local area network already uses 192.168.0.*.
Commands I put into the gateway (Ubuntu Intrepid 8.10):
Code:
root@EMONSTER:~# ifconfig usb0 192.168.1.1
root@EMONSTER:~# iptables -A FORWARD -i eth0 -o usb0 -s 192.168.1.0/24 -m state --state NEW -j ACCEPT
root@EMONSTER:~# iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
root@EMONSTER:~# iptables -A POSTROUTING -t nat -j MASQUERADE
root@EMONSTER:~# echo 1 > /proc/sys/net/ipv4/ip_forward
Commands I put into the client (Debian Etch):
Code:
~# /etc/init.d/networking stop
Deconfiguring network interfaces...done.
~# ifconfig usbd0 192.168.1.100
~# route add default gw 192.168.1.1
~# /etc/init.d/networking restart
/etc/network/options is deprecated (see README.Debian of netbase).
Setting up IP spoofing protection...done (rp_filter).
Reconfiguring network interfaces...done.
Client /etc/resolve.conf:
Code:
# Domain name searches will fail until you point this to a real DNS server.
nameserver 207.22.166.61
nameserver 207.22.166.2
nameserver 192.168.192.1
nameserver 192.168.0.1
nameserver 192.168.0.2
nameserver 192.168.1.1
prepend domain-name-servers 208.67.222.222,208.67.220.220;
When I put 192.168.0.1 (LAN) into firefox, I get the main routers login interface.
When I put 192.168.1.1 (Gateway) into firefox, I get "The connection was refused when attempting to contact 192.168.1.1".
Pinging 218.248.255.145 and google works just fine.
When I do "wget google.com" or "wget yahoo.com", it stops at:
"HTTP request sent, awaiting response... "
So that is pretty much where I'm stuck. I can ping, but I cannot download.
=====================================================================
=====================================================================
I don't know if this will help, but I have some code from about 2 years ago. I used to use this code to get this same Client connected.
The difference now is I'm using a different computer as a Gateway, and I'm not on dialup internet. Here is the code I used then-
Gateway:
Code:
MY_IP=`ifconfig ppp0 | grep "inet addr" | cut -d ":" -f 2 | cut -d " " -f 1`
if [ -z "$MY_IP" ]; then sleep 120; continue; fi
echo $MY_IP
ifconfig usb0 192.168.129.1 netmask 255.255.255.255 up #2> /dev/null
route add -host 192.168.129.201 usb0 #2> /dev/null
iptables -t nat -F
iptables -t nat -A POSTROUTING -j SNAT -o ppp0 --to "$MY_IP"
echo 1 > /proc/sys/net/ipv4/ip_forward
Client:
Code:
#!/bin/bash
# connect2host.sh - For connecting through USB to a host machine for net access
su -c "/sbin/route add -host 192.168.129.1 usbd0"
su -c "/sbin/route delete -net 192.168.129.0/24 usbd0"
su -c "/sbin/route add default gw 192.168.129.1"
When I tried replacing "eth0" for "ppp0", I ended up with the same results I have now. (Ping, but no download)