-
DHCP & routing table
I am trying to configure my system (laptop, linux) to connect to a wireless point here at my school. I'm almost certain I've got my configuration correction, but I'd like a sanity check.
The wireless point is an 802.1x using EAP-MSCHAPv2. This is not a problem - I can associate with the AP and authentication succeeds. It's DHCP that's the issue. My client (dhcpcd) successfully goes through all the steps: discover, offer, request, ack - it reports all and I can capture all of these steps in a Wireshark capture. It fails on setting up the system at times, with the error of "add_route: No such process"
Sometimes it works, sometimes it doesn't, depending where I am on the campus. I feel that I'm getting a bogus DHCP response from the router. Now, routing tables are not my strong point, so feel free to correct me. When it fails, I generally see something like:
Subnet mask = 255.255.253.0
IP = some IP address
gateway = some other IP address
Now, that subnet mask just looks weird - is it valid? Further, if I do:
Code:
my IP (binary AND) subnet_mask;
gateway's IP (binary AND) subnet_mask;
I end up with two different answers. To me, this says that the gateway and me are on different networks. My understanding is that the gateway is my sort of "portal" to other networks. If something is on another network, I need to go through the gateway. If the gateway is on another network... well, that seems very chicken-and-egg to me.
I found somewhere else that said in this case where the IP & gateway differ like that, that the DHCP response should contain additional info for a route to the gateway. I'm almost certain through my wireshark captures that the DHCP server is not sending anything extra.
-
Any subnet mask is valid, just for sanity there are certain conventions. But yes that one is valid. Theres no rule saying the subnet has to be divided by octets. That one is a bit weird though, most people would have used 254 or 252 unless the company just got unlucky enough to have two class C IP's that were not consecutive, although i guess another way to look at it is they got lucky enough to get 2 that are subnettable at all.
The way subnets work is,
A = your gateways subnet
B = your gateways internal IP
C = destination IP of the packet
if A & B == A & C the packet is local, otherwise it is gets sent up to the next router/switch/hub
or more specifically the way its actually done in the routers
Code:
if((A & B) ^ (A & C)){
localpacket();
} else forwardpacket();
-
253 (11111101b) sounds really strange for subnet mask.
What IP address and gateway address do you get? (it's okay to post them, since they are not external IPs, assuming it's not the ISP that is answering your DHCP request!)
What IP do you get when it works?
Also, just to point out the obvious... have you tried contacting the network admin?
-
I get an external IP, actually. In this instance, my school is my ISP. (It's a college.) I'll randomize a few numbers for an example:
I'll get the following, for example:
128.100.203.123 = my IP
128.100.206.1 = gateway
255.255.253.0 = subnet mask
My understanding was that if (some_ip & netmask) and (gateways_ip & netmask) differed, then some_ip was on a different network, and the packet would be routed to the gateway to get it there. Now, following that logic, my network for the IP address I'm getting is not the same as the gateway's network. This raises to me, how do you route a packet to the gateway, if it's not in your network? I believe this is why route is choking in the dhcpcd's configure process.
The odd thing is that Window's succeeds in these places, but it seems to get 2 IPs - one from the DHCP server that's giving me issues, and one from a more common 192.168.1.1 server. I might have to poke more. There seem to be entries for both in the routing table in windows - which is _huge_ compared to the usual 3 entries in Linux.
I was thinking of contacting the network admin -- that was mostly the point of the post. I wanted to make sure I'm on the right track before I contact them.
-
It's possible that there are 2 DHCP servers on the network, and they are competing to give you an IP (race condition). This is possible, for example, when you have a hub that both the ISP modem and the NAT is connected to. It will work about 50% of the time, when the NAT wins. I doubt a college network would be set up like that, though... People usually do this because they don't want to get a second network card for the NAT (to make it modem->NAT->hub).
-
And yet everything works?
What does your routing table look like in full? If there was a direct route to the gateway on the main network interface, everything could still work.
-
[off-topic]
Has anybody know a good free online (or downloadable) tutorial about these stuffs?
I searched a little, and I have a book named "Networking in Vista". But they arenot whatI need. I thought maybe you know a better one.