LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   unable to get out of my subnet w/o dhcp (http://www.linuxquestions.org/questions/linux-networking-3/unable-to-get-out-of-my-subnet-w-o-dhcp-102814/)

wendallsan 10-11-2003 01:22 PM

unable to get out of my subnet w/o dhcp
 
hi all,

I'm trying to give my linux box a static IP addy on my subnetwork so I can use it as a web server. I'm running my subnet through a little Linksys router and have IP forwarding turned on for ports 80, 53, and 21 (http, dns, and ftp). I'd like to be able to set my router up to have a static IP for my linux box and have DHCP running for everyone else. I have my linux box statically assigned to 192.168.1.2. On my linksys router admin page, I have turned DHCP on and set it to start assigning DHCP ip numbers starting at .10, so I presume it won't assign addresses to ip numbers .2-.9. Maybe I'm wrong with this assumption and DHCP doesn't work that way.

The other weird thing is if I completely turn off DHCP on my router and manually assign an IP address to my linux system, I still can't get out to the Internet at large, I'm stuck in my own subnetwork. DHCP seems to be the only way to get out on my box right now.

Any advice, what am I doing horribly wrong?

thanks,

wendallsan

david_ross 10-11-2003 01:40 PM

It sounds like you haven't specified your default route to be the address of the router. Try setting a default route.

wendallsan 10-11-2003 03:07 PM

alright, how do I do that? I have my gateway set in my rc.inet1 config file, but I don't think that's what you're referring to. How do I set this, is it within linux somewhere or on the router itself?

thanks again,

wendallsan

david_ross 10-11-2003 03:14 PM

That is what I mean. If you look at:
route -n

You should have an entry beginning "0.0.0.0" this is your default route. It sounds like - either you don't have one or it is not pointing at your router.

If you have a default route then remove it:
route del default

Then add a new one:
route add default gw IP.OF.ROUTER.HERE

Obviously change IP.OF.ROUTER.HERE for hte IP of your router.

wendallsan 10-11-2003 07:11 PM

alright, thanks for the help . . .

running route -n results in the following entries matching 0.0.0.0:

0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 1 0 0 eth0

I tried removing both and then adding the new default like you instructed, but I ended up still not being able to get out of my local network to the Internet. Do I need to turn off DHCP on my router to be able to use static IP addresses with it, or should I be able to do both at the same time? Any other ideas would be great.

sidmark-2850 10-12-2003 01:31 AM

Like david_ross said, you will need to set the default gateway to the IP of your router. What distro are you running. There should be a configuration tool for your network. Different distros have different tools. If you say which one, someone might be able to help you with it.

kwiksand 10-12-2003 02:00 AM

Is the static IP for the machine set at client level or server?

This is probably ignorance on my behalf, but I didn't realise that (At least with my router, Dlink 804V) If I wanted my web server to have a static IP, I couldn't just tell the client machine to use a static IP and expect it to connect to the network...

Instead, at router level, I gave the machine a static IP by always assignmnet 192.168.0.3 to its MAC address, in which the client still asks for a lease of an IP, but will always get the same one...

If of course this is so blindingly obvious, and represents a big hole in my understanding of DHCP servers then disregard it.. But it might help you out, depending on how you've tried to set things up..

Rab22 10-12-2003 04:07 AM

First, have you made sure that you set the DNS's to the client computers? If you don't it'll seem like you don't have internet because you won't have be able to resolve domain names to IPs. The reason you get internet w/DHCP ( I'm assuming) is because DHCP sends the DNSs along with other information. When you put static IPs in you have to add entires to /etc/resolv.conf to get internet =)

P.S. You'll also have to make sure that the routes on all your client computers are set to the GW of your router.

wendallsan 10-13-2003 02:52 PM

wow, so many answers, so many new questions from all those answers . . .

I think I'll try responding to sidmark-2850 1st:

if I want to set the default gateway to the IP of my router, which IP do I want to use, the IP of the subnet (192.168.1.1), or my WAN IP? I'm running Slackware 9.0 for my distro.

for kwicksand:

man I feel dumb trying to figure out where to start with your post! I have sooo much to learn about networking still. You want to know whether my static IP is set at the client or server level . . . I have been trying to set up my static IP in my /ect/rc.d/rc.inet1 file, that's the only way I know how, and I'm not sure whether that does things at a client or server level. As far as tweaking the router goes, I'll have to try that out as soon as I get home and see what happens, maybe I can do a fancy MAC addy to IP addy assignment w/ my linksys router, too, and that sounds like it would solve the problem.

Rab22:

thanks for the DNS info, I just presumed my computer would automatically use my ISP's DNS, even with a static IP configuration. I'll try adding some DNS entries to that /etc/resolv.conf file you talked about and see what happens.

thanks all of you for your help. I'll keep you all posted as to how far I get with this.

wendallsan


All times are GMT -5. The time now is 08:23 PM.