My Headlines

Tuesday, March 29, 2011

LINUX HOWTO MINI INTERNET-CONNECTION-SHARING

LINUX HOWTO MINI INTERNET-CONNECTION-SHARING

I have ADSL ethernet modem, wired/cable, DNS.

www/adsl -> eth0 -> wlan0 -> ath0

Desktop network card eth0
Desktop wireless card wlan0
Laptop wireless card ath0

In Terminal:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -j ACCEPT

(Second iptables command - prevents ratelimit messages)

eth0 IP
ifconfig
192.168.1.2

Desktop
iwconfig wlan0 mode ad-hoc
ifconfig wlan0 192.168.2.2

Check mode ad-hoc
iwconfig

Laptop
iwconfig ath0 mode ad-hoc
ifconfig ath0 192.168.2.3
route add default gw 192.168.2.2 (IP address wlan0)

Check mode ad-hoc
iwconfig

Desktop:
/etc/resolv.conf
nameserver XXX.XXX.XXX.XXX

or

nameserver XXX.XXX.XXX.XXX
nameserver XXX.XXX.XXX.XXX

Edit laptop /etc/resolv.conf same as desktop.
ping -c 4 www_dot_gewgle_dot_commm

--------------------------------------------------------

www/cable/adsl -> eth0 -> wlan0 -> ath0
   or
www/wifi_modem/router -> wlan0 -> wlan1 -> ath0
   or
www/gprs/cable_usb -> ppp0 -> wlan0 -> ath0
   or
www/gprs/bluetooth -> rfcomm0 -> wlan0 -> ath0
   or next task satellite

--------------------------------------------------------

www/gprs/cable_usb -> ppp0 -> wlan0 -> ath0 #ATD*99# or ATD*99***1#

pppd connect 'chat "" AT+CGDCONT=1,IP,APN_example_pp.vodapone.co.uk OK ATD*99#' ttyACM0 noauth defaultroute usepeerdns noipdefault

Desktop GPRS connection ppp0
Desktop wireless card wlan0
Laptop wireless card ath0

In Terminal:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -j ACCEPT

(Second iptables command - prevents ratelimit messages)

ppp0 IP
ifconfig
XXX.XXX.XXX.XXX

Desktop
iwconfig wlan0 mode ad-hoc
ifconfig wlan0 192.168.2.2

Check mode ad-hoc
iwconfig

Laptop
iwconfig ath0 mode ad-hoc
ifconfig ath0 192.168.2.3
route add default gw 192.168.2.2 (IP address wlan0)

Check mode ad-hoc
iwconfig

Desktop:
/etc/resolv.conf
nameserver XXX.XXX.XXX.XXX
nameserver XXX.XXX.XXX.XXX

Edit laptop /etc/resolv.conf same as desktop.
ping -c 4 www_dot_gewgle_dot_commm

--------------------------------------------------------

/etc/rfcomm.conf
passkey "1234";
pin_helper /usr/local/bin/hook

#!/bin/sh #hook
PIN='cat /etc/bluetooth/pin'
echo "PIN:$PIN"

/var/lib/bluetooth/MA:CM:AC:MA:CM:AC/pincodes #dongle MAC
MA:CM:AC:MA:CM:AC 1234 #cell-phone MAC

#Display dongle(MAC) - hcitool dev #Display cell-phone(MAC) - hcitool scan #Pair dongle - rfcomm connect rfcomm0

--------------------------------------------------------

No comments: