LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   DHCP or not? (https://www.linuxquestions.org/questions/linux-networking-3/dhcp-or-not-41810/)

9nine9 01-17-2003 09:37 AM

DHCP or not?
 
Recently I just read that DHCP shouldn't be used for networking on a dial-up connection. Does anybody know if this is true? I've been having trouble setting up connection sharing between Linux and a Windows machine and I'm wondering if it's because I'm trying to do it the wrong way. Thing is, the Mandrake Control Center seems to default to this method unless I'm missing something. (which I probably am)

:study:

baldy3105 01-17-2003 11:17 AM

You haven't really specified the problem for anyone to help. So you've got a windows machine and a linux machine, which one has the modem and which one is trying to share it?

dorian33 01-18-2003 09:38 AM

DHCP is protocol which allows to send and get the IPs for hosts.
So there is a DHCP server and DHCP client. The first one is sending IPs to the second one on request.
Usually with dial-up connection the IP of your machine (+ another IPs about your current gateway, nameserver, etc) is not constant and you has to ask for them. So in typical dial-up situation you need use DHCP client on the computer which has got the modem.

On the other hand the second machine may also use DHCP client to get its IPs. But the request will be sent to the first one. So in that case you has to run DHCP server also - just for this second machine.

9nine9 01-18-2003 11:27 AM

Quote:

Originally posted by baldy3105
So you've got a windows machine and a linux machine, which one has the modem and which one is trying to share it?
Actually, I have a dual-boot machine with Windows and Linux. This is the machine with the modem (2 modems). I want to share the internet connection with a Windows-only machine.

When I'm in Windows, connection sharing works fine with the interior modem on my dual-boot machine. When I'm in Linux, I can connect fine with the external modem, but I can't get connection sharing to work.

I did get it to work one time using DHCP, but then connection sharing didn't work when I booted back to Windows.

9nine9 01-18-2003 11:33 AM

I was sharing my internet connection with my wife's computer before I installed Linux in my computer. As far as I know, I had no DHCP client in my machine.

But my question really is "should DHCP be used with a dial-up connection"? I have read that it shouldn't be.

By the way, I connect directly to the internet via a modem, either an internal modem when I'm in windows or an external modem when I'm in Linux.

9nine9 01-18-2003 11:41 AM

Quote:

Originally posted by dorian33
On the other hand the second machine may also use DHCP client to get its IPs. But the request will be sent to the first one. So in that case you has to run DHCP server also - just for this second machine.
It sounds like the 2nd machine would have to connect in two different ways, depending on whether the 1st machine was booted to Windows or Linux.

I guess I need to find somebody who has already done the same thing I'm trying to do - that is share an internet connection from a dual boot machine with a windows-only machine.

The way it is right now, my wife can share my internet connection when I'm in Windows, but not when I'm in Linux. Our two computers are connected directly through NICs. One NIC in each computer.

I hope I've explained this right.

baldy3105 01-18-2003 01:24 PM

OK , the Q makes more sense now.

FYI the protocol that is used to allocate IP Addresses and Default Gateways etc to you when you are connecting on a serial circuit is actually IPCP which is a part of the PPP protocol suite, DHCP is used for LANs. I have seen IPCP refered to as DHCP before on certain cheap and nasty routers, but it isn't.

When you configure internet connection sharing on a windows machine, two things happen. Firstly a DHCP server is set up on the first pc which allocates ( I beleive) 192.168.0.x addresses to your second PC.

Then a proxy server is set up on the first pc. This which allows your second pc to use its nice new DHCP derived IP address to access the first machines proxy server and hence the internet.

Your first PC gets its Internet facing address by negotiating via IPCP with your ISP.

Now when you boot to linux, because it is a superior and more flexible operating system doesn't have a simple ICS thingy ( OK OK, I really am a newbie about Linux so someone is going to prove me wrong here! (go to it, its how I learn!)) so you must set up the DHCP server and proxy server yourself (or possible NAT may be easier to do, as I say I'm not a Linux expert).

At this point I run out of puff, and some nice Linux guru will have to step up and tell you how to configure DHCP and Proxy/NAT on linux to duplicate what your Windows machine is doing.

Good Luck Jim, This message will self destruct ...etc

dorian33 01-18-2003 04:35 PM

Yeah, Baldy is right. Sorry. I've forgotten a lot about ppp connection :( So you do not need any dhcp client. Re the matter of dhcp server: it depens if the second computer requires it or not. Usually Windows are set up to use dhcp so you should run the dhcp server at linux box.

baldy3105 01-20-2003 05:21 AM

Hey, If you wan't to know anything about PPP just ask. Its a pet subject of mine, or was, anything I can't remember I can lookup! :study:

Darin 01-20-2003 07:38 AM

OK so when it's win box to win box your machine with modem and ICS is being a DHCP server AND a NAT proxy router AND a caching DNS server, albeit it kinda sucks at all 3, so there are really 3 things you need to work out when you are in linux and DHCP is actually one of the things you can skip with a little advanced knowledge :)

The Three Things are:
1) NAT proxy routing or getting your wife's box to talk on the internet
2)DNS or getting your wife's box to turn names like www.linuxquestions.org into IP addresses and
3)IP assignment (DHCP) giving your wife's box an IP address in the first place when your win box isn't booted up and doing ICS.
...and since you will probably be overwhelmed by all three I'll try and cheat one or two out of the way for you.

1---
When you are in windows your box makes it's own IP address and is a DHCP server that gives your wife's box an IP address, the hard method is to set up DHCP on the linux box, go find a man page or HOWTO for DHCP. The dirty way is this:
run winipcfg (or ipconfig from a dos box) on both machines and write down all the numbers. In linux set your internal IP *the same* as it was in 98, this is usually 192.168.0.1 so that's what you'd most likely use if you made one yourself anyhow. Now on your wife's machine set it up to not use DHCP and manually enter all the same numbers for IP address, subnet mask, etc in the TCP/IP settings as it has, this again is probably 192.168.0.2 and probably what you'd use if you set it yourself. Now whether you did this the dirty way or not your wife's machine should still work when you are in windows, test it before going to step 2 but note this will break if you add a 3rd box and don't assign it a number by hand also.

2---
DNS, this can also be done the dirty way with a little luck. Dial into your ISP and check the settings it gives for DNS servers (winipcfg or ipconfig under ppp adapter or in linux look in /etc/ppp/resolv.conf) then hang up and redial a few times and make sure it always gives the same ones, if not you get to do it the hard way which is to set up named/bind/DNS consulting any man pages or HOWTOs as needed. If the numbers are always the same then go back to the wife's box and find the TCP/IP setting for DNS servers and put the numbers in there manually. Once done, test her connection when you are in windows again then proceed to step 3 :)

3--
Almost there! now you get to set up a NAT proxy/firewall which is one of the things linux boxes are most often used for, again rather than give an even longer post I have to defer you to man pages and HOWTOs for setting this up since I'm probably over my size limit for posts haha!
http://www.tldp.org for HOWTOs, look for howtos with firewall, proxy or masquerading in them.

When it's all working you can learn more by going back at your leisure and setting up linux as a DNS caching server and then if you feel really adventurous set it up as a DHCP server also!

baldy3105 01-20-2003 11:59 AM

You would normally nat, or proxy at this point, both seems a bit like overkill. If you are using it as a proxy server then your browser will resolve all DNS queries via the proxy anyway so no need for DNS server settings. If you go for NAT on the Linux then you do need to configure DNS servers on the second machine.

Unless you want to do something other than browse and email etc I would say proxying would be the way to go, mainly because it eliminates the problem of changing DNS server addresses, because its always the linux box that is doing DNS resolution on behalf of the WinPC, and the Linux box gets his DNS info dynamically.

Good call on the static IP's btw, of course its simpler all round ( it how my little farm is configured after all)

Cheers

Darin 01-20-2003 12:31 PM

Sorry, NAT not proxy (technically though nat is a form of proxy) which is iptables in 2.4.x kernels and ipchains in 2.2.x kernels.

The reason I mentioned NAT (iptables) with BIND/DNS and DHCP is that this would give the exact same results as what windows does when it shares the modem using ICS. This also gives you a "plug n play" network meaning anyone with a DHCP client (like say a fresh XP install) can plug into your LAN and surf the web through your connection on the linux box without any special configuration (great for hosting LAN parties.)

9nine9 01-23-2003 01:12 PM

Quote:

Originally posted by baldy3105

When you configure internet connection sharing on a windows machine, two things happen. Firstly a DHCP server is set up on the first pc which allocates ( I beleive) 192.168.0.x addresses to your second PC.

Well, it may have done that, but when I open up the Network dialog box from the Control Panel, there is no IP address listed for the 2nd computer. My computer was given one though and it's like the one you listed here.

9nine9 01-23-2003 01:14 PM

Quote:

Originally posted by dorian33
Yeah, Baldy is right. Sorry. I've forgotten a lot about ppp connection :( So you do not need any dhcp client. Re the matter of dhcp server: it depens if the second computer requires it or not. Usually Windows are set up to use dhcp so you should run the dhcp server at linux box.
When I configured connection sharing in Linux, it said it was setting it up under DHCP. I'm assuming that it meant it was setting up Linux as a DHCP server. At any rate, it's not working. I can ping the other computer, but I can't get it to share my connection.

9nine9 01-23-2003 01:40 PM

Quote:

Originally posted by Darin

1---
The dirty way is this:
run winipcfg (or ipconfig from a dos box) on both machines and write down all the numbers. In linux set your internal IP *the same* as it was in 98, this is usually 192.168.0.1 so that's what you'd most likely use if you made one yourself anyhow. Now on your wife's machine set it up to not use DHCP and manually enter all the same numbers for IP address, subnet mask, etc in the TCP/IP settings as it has, this again is probably 192.168.0.2 and probably what you'd use if you set it yourself. Now whether you did this the dirty way or not your wife's machine should still work when you are in windows, test it before going to step 2 but note this will break if you add a 3rd box and don't assign it a number by hand also.

Thanks, I appreciate all the stuff you've written in that post and I hope it eventually helps me, but right now I'm kinda stuck on step #1. I did all that stuff, and when I assigned my wife's box with an IP address, 192.168.0.2, the Windows connection share stopped working.

I think my ISP is assigning addresses dynamically. They gave me two DNS addresses when I signed up, but I don't think those are always the ones I'm getting when I'm online.

Anyway, now I'm having another problem and I don't know how it happened. I'm getting Failure messages on boot-up and shut down with named being the problem file. It doesn't keep Linux from working, but it's probably related to my connection problems, I don't know.

I would post the named lines from /var/log/messages here but I'm not in Linux right now.

Another problem I had a few days ago was that I opened winipcfg in Windows and like an idiot I clicked on "Update All" or something like that and all of a sudden, my browser wasn't resolving addresses any more. Even after a reboot, it wasn't working. I restored an earlier copy of the registry and restored my internet settings from my ISP, and got it working again, but I still don't know what I did wrong or what exactly happened and I can't find any help at all on winipcfg. No Help file that I can find.

Anyway, I'm still back at square one - I can share my connection in Windows but not in Linux. Fortunately, I at least can get online in Linux, but then my wife is bummed out because she's left out in the cold.

Geez. This is beginning to look like a nightmare.

The funny thing is, Linux is telling me that my connection share is working. I wish it would inform my wife's box of this fact.

:confused:


All times are GMT -5. The time now is 02:29 AM.