-   Linux - Newbie (
-   -   CentOS 5 Internet sharing and DHCP Help (

DavM 10-13-2009 01:14 AM

CentOS 5 Internet sharing and DHCP Help
Hey all. This is my first post, I know I'm a noob and I've been looking around at tutorials to help me in what I want to achieve. I'm looking to create a gateway and DHCP to share a Huawei E220 connection to a WAP so my girlfriend and I can both use the connection (will be replaced later in the year) I've gone through the tutorial at howtoforge and all it seems to do is assign IPs, and doesn't share the internet.
Also, if I restart the computer, the dhcpd service seems to switch off.

So I'm trying to share my internet on ttyUSB0(which is what the E220 shows up as) to eth0(I'm guessing this is the iptables bit) and assign IPs on the eth0 line (DHCP, which seems fine).

I think my main problem is iptables doesn't like my ttyUSB0 bit.

I'm running CentOS 5.3(I think I'll reinstall and start a fresh) on a P4.

So please help me. (even my Ipod gets a IP and it's usually the one that gives me trouble)

Also: when I connect eth0 to the switch, it seems to take over all connections and it stops the CentOS server from accessing the internet on ttyUSB0.

r3sistance 10-13-2009 09:17 AM

DHCPD is not a service that starts by default. you have to set it with the chkconfig command to auto start, IE.

chkconfig --level 2345 dhcpd start

will set it to start by default in run levels 2, 3, 4 and 5 (your likely to be using either 3 or 5), this needs to be run as root, alternatively for an account with sudo

sudo /sbin/chkconfig --level 2345 dhcpd start

I am assuming you are sitting behind a router what is directly connected to the server via USB? if you then have an interface connected to a switch too, you have ensured the two interfaces are sitting on different subnets (else the server won't know what interface to use)? Also could you supply the information for the USB device in ifconfig possibly as well as the eth0 information.

DavM 10-13-2009 12:19 PM

Ok thanks, I know I did the chkconfig but i'm unfamiliar with lvls, will try.
The USB Hauwei E220 is a Wireless Broadband Modem. So it plugs in and goes. and they're defiantly on different subsets. Not even the same ball park! Here's what the ttyUSB0 looks like in NM


I can easily start DHCPD service after sudo/root login but as soon as I plug eth0 in to allow me to start the service, ttyUSB0 takes a back seat and doesn't give me internet even when i don't have the service running. And then it looks like this

Screenshot 2

ttyUSB0 is still running but... isn't. eth0 automatically becomes the default.

r3sistance 10-13-2009 12:50 PM

Can you show the configuration of eth0 by chance? also while you are at it, the out put of "netstat -r" from the terminal before and after eth0 becomes live might help in figuring out the problem that is occuring.

DavM 10-14-2009 12:45 AM

I've come to think this is impossible, seeing that in the "network configuration" gui, it doesn't show the ttyUSB0 (or ppp0 as I've found out and implemented, that lead me to have internet while connecting both interfaces but does something strange to the eth0, you'll see)

Screenshot of eth0

And the netstat:


Destination Gateway Genmask Flags MSS Window irtt Iface * UH 0 0 0 ppp0 * U 0 0 0 __tmp504566582
default UG 0 0 0 ppp0
I think I'll give up and go to XP and just share the connection (unless there is a way). Remember that this isn't how it's going to end up. I'll eventually go for a little more of a sane idea

CLOUD===> wlan0-CentOS-eth0 ===>switch===>WAP===>Laptops

I was just using the E220 as a test(for a few months), but I think it's just not going to work.Supposed to look like this

CLOUD===> ppp0-CentOS-eth0 ===>switch===>WAP===>Laptops

I guess the news is that USB Wireless Broadband Modems aren't routable in Linux(at least the CentOS 5 distro).

DavM 11-06-2009 09:05 PM

So I know this may be a month and a bit since the last post but I just wanted to tie it off. I found a solution, it's a little annoying each startup but here is is...
Changed OS to Ubuntu 9.10 (love it),
Plugin USB Modem
Change some settings (For Three(i.e. 3 Australia) change authentication to only CHAP and use PPP echo packets)
set iptables by going:

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
Then use "Dual DHCP DNS Server" at
Easy install(follow instructions), Then run:

/opt/dualserver/dualserver -v
Then it all works. "Dual DHCP DNS Server" even publishes a webpage that shows:
- Current Leases
- Available Dynamic Leases
- Available Static Leases

I also use vnstat with vnstat php frontend to view bandwidth

Thanks everyone

All times are GMT -5. The time now is 05:01 AM.