Click to See Complete Forum and Search --> : DHCP help please


mackstar
09-02-2002, 05:08 PM
I'm a returning Linux user, this time Redhat 7.2. Previously I used mandrake 7. My setup breaks down like this: Internet-->Cable Modem (Comcast)-->Hub-->Win2k + Redhat 7.2 computers.

A few years ago Comcast was known as @home, and they didn't use DHCP so I was able to manually configure linux networking and get it up and running on the exact same hardware configuration as listed above.

But now they only use DHCP, and would not supply me with any hostname information, even when I talked to them directly.

The results of an ifconfig -a tell me that my NIC is working, and it's using the correct driver. But I can't ping anything, and can't connect at all. I'm a little rusty with all of the commands used in networking, so if anyone could help me here, I'd greatly appreciate it.

Thanks, mackstar

jumpedintothefire
09-02-2002, 05:19 PM
edit the ifcfg-eth0 file and change bootproto to 'dhcp", leaving the network info blank.

/sbin/ifdown eth0
/sbin/ipup eth0

mackstar
09-02-2002, 05:42 PM
In the 'ifcfg' file i don't see anything about dhcp, but i do in the other 2 files you mentioned. It has bootproto listed a few times, should i change all the bootp references to dhcp?

cowanrl
09-02-2002, 07:23 PM
If you are using static IP addressing, then in your /etc/sysconfig/network-scripts/ifcfg-eth0 file you should see the line that says bootproto = none or bootproto = static. Change that line to say bootproto = dhcp to use dhcp to get the IP address. You don't need to change any of the other lines.

jumpedintothefire was indicating to execute:

/sbin/ifdown eth0
/sbin/ifup eth0

to stop and start eth0 without rebooting. You definitely don't want to edit those scripts.

mackstar
09-02-2002, 07:40 PM
thanks for the clarification

mackstar
09-02-2002, 07:47 PM
Ok changed that file and it's still not working. Do you think comcast has some sort of limiter that sees that they've only issued me one IP, and until it expires I can't get another, thereby limiting me to the one IP address I pay for?

Or should I be able to obtain multiple IPs with DHCP, even though I'm only paying for one?

kam
09-02-2002, 07:51 PM
You would need to pay for one for each computer, unless you get a router (which I recommend). With a router, you only need one IP address.

jumpedintothefire
09-02-2002, 08:08 PM
Your switching the network cable between machines??
Try unpluging the modem for a bit, might need to forget its mac address from the last machine it was connected to... linux does that, also...

mackstar
09-02-2002, 08:36 PM
I'm now posting from my linux box! :)

I did what you suggested and disconnected my win2k box, powered the modem down and back up and then ran the ifup eth0 command and it worked immediately. Thanks alot for the help!

Now to just get both comps online at the same time...

cowanrl
09-02-2002, 08:40 PM
Since you're only paying for 1 IP address, I agree with kam, you're going to need a router to use more than one computer.

Since I'm Linux biased, I say use your Linux machine as your router. Install 2 NICs in your Linux machine. Attach one to your cable modem and set it to use DHCP to get the IP address from your ISP. Assign the other NIC an IP address on the 192.168.0.0 net.. Attach that NIC into a hub or switch to attach your other computers to.

To start routing on your Red Hat machine, execute this command:

echo 1 > /proc/sys/net/ipv4/ip_forward

To use NAT so that the other computers on the network can access the Internet through the Linux box, execute this command:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

The ethx output port of that command would be the Ethernet port that faces the Internet.

Assign your other computers an IP address on the 192.168.0.0 network and assign the 192.168.0.0 network IP address of the Linux box as their default gateway.

You should be ready to rock and roll.

mackstar
09-02-2002, 09:39 PM
That sounds good...a friend suggested I do that. Certainly a NIC would be less expensive than a router.

Would it be easy to create a script that would start the forwarding every time I booted up?

jumpedintothefire
09-02-2002, 10:30 PM
Stick that line in rc.local

cowanrl
09-03-2002, 04:46 AM
On Red Hat 7.2 you should have a file named /etc/sysctl.conf. In it you should see a couple of lines like this:

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

Change that 0 to a 1 and IP forwarding will be enabled at boot up.

You could put the iptables MASQUERADE line I mentioned in /etc/rc.d/rc.local. That will run it at boot up.
If you read the Red Hat documentation, there is a script file that it uses to start up iptables. I'm not using it and I can't remember what it is. I know I've read it in the manuals though. You could also add the MASQUERADE line to Red Hats scripts to run it at boot up.