Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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?
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.
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.
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.
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..
Location: Currently: Normal, IL @ ISU -- Typically: South of Chicago
Distribution: Currently: RH 9 && Slackware 9.1 =)
Posts: 50
Rep:
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.