As I mentioned in Sharing My New 3G Internet Connection With The Rest Of The Office I have a new Alltel 3G air card. In that article I configured my workstation to share the connection and having used it this way for a couple of days it isn't really working as well as I would like it. The air card does not stay connected all of the time and it is a bit of a pain to get it to reconnect if I am using my netbook in the other room. So I decided to scrap the connection on my workstation and move it to the server.

The steps to set this up is actually pretty much the same as the above referenced article with some of the article before it thrown in. I am using wvdial to actually discover the air card and dial into the Alltel network. The DHCP server can live anywhere on the network. For me it makes sense to put everything on the server.

Follow up:

1. Install DHCP server:
sudo apt-get install dhcp3-server

2. Make a copy and then edit the /etc/dhcp3/dhcpd.conf file:

cp /etc/dhcp3/dhcpd.conf /etc/dhcp3/dhcpd.conf_orig
cat /dev/null > /etc/dhcp3/dhcpd.conf

Again, here is a copy of my /etc/dhcp3/dhcpd.conf file:

ddns-update-style none;

option domain-name-servers 145.253.2.75, 193.174.32.18;

default-lease-time 86400;
max-lease-time 604800;

authoritative;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.200 192.168.0.229;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.151;
}

host hdtsrvr {
hardware ethernet 00:0B:CD:XX:XX:XX;
fixed-address 192.168.0.151;
default-lease-time 86400;
max-lease-time 86400;
}

host win2000 {
hardware ethernet 08:00:27:XX:XX:XX;
fixed-address 192.168.0.1;
default-lease-time 86400;
max-lease-time 86400;
}

The only thing that has changed here is my server's address is 192.168.0.151.

Once the configuration file is done and saved you need to reset the DHCP server by

/etc/init.d/dhcp3-server restart

You can check your configuration by renewing the IP lease of one of the computers on the network.

4. Now, instead of installing Firestarter as I did in the other article, I am going to configure the iptables and for this please refer to the Internet Connection Sharing Ubuntu help page.

Since I am in the same subnet as the example, I just copied and pasted:

sudo iptables -A FORWARD -i eth0 -o eth1 -s 192.168.0.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A POSTROUTING -t nat -j MASQUERADE


sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

and made the change to /etc/sysctl.conf to add these lines:

net.ipv4.conf.default.forwarding=1
net.ipv4.conf.all.forwarding=1

5. So here I will install and configure wvdial just like I did in the article that started this Alltel 3G adventure
sudo apt-get install wvdial

To find the air card and build the initial configuration file I ran

sudo wvdialconf /etc/wvdial.conf

It discovered the card without a problem. I then went in and edited the /etc/wvdial.conf file to enter #777 for the phone number and the phone number I was given as username and password. To dial in I opened up a terminal and typed

sudo wvdial

Then I wrote a shell script to do the deed:

The shell script is listed below

#!/bin/sh
sudo wvdialconf /etc/wvdial.conf
sudo wvdial

I love it when it works... and it did very well for over a day. That is to say I dialled in and it stayed up for over a day. This morning I came in and wasn't connected still. I didn't have time to mess with it so I took the air card and plugged it into my workstation and did what I needed to do and did my running around. After going around and around trying to get the server to connect and stay connected and then share the connection I discovered the iptables had an address that was on my subnet but wasn't one that I use. Don't know where that came from. Since I am really not familiar with iptables commands, I wasn't able to delete the entry, just re-added those that I had previously added and it is now working again.... until next time. I'll need to do some more research and testing before I will know if it is up for good.