Ubuntu – Mobile broadband sharing over adhoc wireless

networking

I have a Huwaei modem (E1820 to be precise) that i use for my internet whims and fancies. But what I want to do is set up an adhoc wireless network so another device can connect to my network and in turn I want that device to be able connect to the internet through the network. I've managed to set it up relatively effortlessly on Win7 so the it is possible on my hardware. But now I need to do it here.

Basically what i've done is the following.

  1. Connect to a "Automatic (PPP)" Mobile Broadband
  2. Set up a wireless network

    1. Set the SSID to a unique name
    2. Set the Mode to "Ad-hoc"
    3. Set the IPv4 Method to "Manual"
    4. Set the IP Address (196.168.137.100), Netmask, Gateway (196.168.137.1) to the same as what I would on win7
    5. Tried leaving the DNS server blank, tried filling it with the same DNS server the mobile card uses and tried setting it to 8.8.8.8

tested… didn't work… read some tutorials

  1. Installed Firestarter

    1. Set the Internet Connected Network device to ppp0
    2. Local network connected device to wlan0
    3. Enable internet connection sharing

at this point i cant even connect to the internet on this computer unless i disable the wlan

what am i doing wrong?

Best Answer

Since you're able to use ppp0 and wlan0 both, i'll skip to the main thing. You don't need firestarter. You see to use automatic configuration, you would have to install a DHCP server, which is a fairly painful process, when you take into account all the configuring you need to do. So we'll do this the static way. On your linux machine that is connected to the internet, execute the following commands as root:

iptables -A FORWARD -i ppp0 -o wlan0 -s 192.168.137.1/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

After you do this, go to your other machines and enter the following the the TCP/IPv4 settings for the ad-hoc wireless connection:

IP address: 192.168.137.1-254 (except 100)
Subnet Mask: 255.255.255.0
Gateway: 192.168.137.100

Primary DNS: 8.8.8.8
Secondary DNS: 8.8.4.4

And if everything goes well, you should be able to ping google.com

Related Question