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 am trying to connect my laptop to the ethernet at work. However, I cannot ping the router from my laptop, even though I am using the same cable as my work's desktop (I'm unplugging from the desktop and plugging in my laptop).
Booting into my freshly installed Fedora Core 3 partition doesn't work. I ran this
and no pings went through. Pinging 192.168.0.71 works fine though, so I know eth0 is working... And yes, the cable is connected :) Booting into windows on my laptop connects to the 'net just fine using the same cable. I just had to use the same static IP, gateway, and netmask as the desktop.
So I though the routing table might be off. Here's what `/sbin/route` shows:
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.71 * 255.255.255.224 U 0 0 0 eth0
I thought, "why isn't there a default gateway?" so I typed `/sbin/route add default gw 192.168.0.1` which resulted in:
By using 255.255.255.224 mask, this makes 32 hosts (well 30 if you count with network & broadcast addresses) in your network. Beeing the .71 host, your network ranges from 192.168.0.64 (network address) to 192.168.0.95 (broadcast address).
Thus 192.168.0.1 is not in your subnet. If it also has the samemask, it's subnet starts at 192.168.0.0 (network address) and ends at 192.168.0.31 (broadcast address).
So if you didn't mistake yourself with the mask, then you _have_ to choose an IP between 192.168.0.2 and 192.168.0.30.
If you can change the mask to 255.255.255.0 on _every_ machine of your LAN, I'll really advise you to do so, since it's much more simple to manage (with a .0 mask, network range is from .0 to .255 which is more common)
Well, the thing is, I am not the sysadmin of my workplace. But I believe he set up the netmask like that so he could make a sub-subnet with our alotted IPs. We only have about 10 computers, some for clients to use for browsing the net and checking email, and some more restrictive ones for accounting and stuff. I'm trying to connect to the "email" computer subnet.
But why would my windows partition connect? It uses the exact same numbers. 192.168.0.71, 255.255.255.224, and 192.168.0.1 for the gateway. It makes sense that it wouldn't be able to see the 192.168.0.1 because of the mask, so maybe there's some link before the internet gateway. Yeah, I bet I'm trying to make 2 hops, which requires some addition to the routing table in my laptop. Does Windows create the correct routing table automatically or something?
I'm trying to get ahold of the sysadmin, but he's busy with other companies, too. In the meantime, I'll keep plugging away with LQ's help I love this site!
it's possible that the Win PC got a route to 192.168.0.0 either configured 'in hard' or through dhcp. You can check it out with the 'route print' command in a DOS terminal.
Below is a printout from my windows partition on my laptop while connected to the ethernet cable at work. After rebooting into linux and running
route add 0.0.0.0 netmask 0.0.0.0 gw 192.168.0.1
I got the same 'network unreachable' error as before. I don't get why windows can get away with adding the default. Well, hopefully this printout will help answer some questions:
I don't think it's linked to dns, since the route he tries to add doesn't contains references to names, only IPs.
this one route is queer :
192.168.0.255 255.255.255.255 192.168.0.71 192.168.0.71 20
it says : if you want to talk to 192.168.0.255, then do it right through your ethernet interface, there's no router in-between... why not, but that's a broadcast address... I don't think there's an host with this IP !
Maybe you could try to add this route in your Linux box and then add the default gw. I don't see why it would work, but that's the only thing that's not classical in your windows routing table (and you do have a routing issue, since your gateway is not in the same subnet as your Linux box).
I guess Microsoft's tcp/ip stack compensates for specifying a gateway address outside the host address range for the subnet.
Just for grins, I tried configuring my XP box with the same netmask and... whoa! it worked.
Code:
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.9.1 192.168.9.71 1
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.9.64 255.255.255.224 192.168.9.71 192.168.9.71 1
192.168.9.71 255.255.255.255 127.0.0.1 127.0.0.1 1
192.168.9.255 255.255.255.255 192.168.9.71 192.168.9.71 1
224.0.0.0 240.0.0.0 192.168.9.71 192.168.9.71 1
255.255.255.255 255.255.255.255 192.168.9.71 192.168.9.71 1
Default Gateway: 192.168.9.1
===========================================================================
C:\>ping 192.168.9.1
Pinging 192.168.9.1 with 32 bytes of data:
Reply from 192.168.9.1: bytes=32 time<1ms TTL=64
Reply from 192.168.9.1: bytes=32 time<1ms TTL=64
Reply from 192.168.9.1: bytes=32 time<1ms TTL=64
Reply from 192.168.9.1: bytes=32 time<1ms TTL=64
C:\>ping www.yahoo.com
Pinging www.yahoo.akadns.net [68.142.197.83] with 32 bytes of data:
Reply from 68.142.197.83: bytes=32 time=27ms TTL=58
Reply from 68.142.197.83: bytes=32 time=25ms TTL=58
Reply from 68.142.197.83: bytes=32 time=25ms TTL=58
Reply from 68.142.197.83: bytes=32 time=25ms TTL=58
Incredible! In a perfect world, the above should NOT work. But then look at the classful broadcast address that the MS stack calculated. Again, in a perfect world (well classless at least), the broadcast address should be 192.168.9.95
To the OP - the problem description and solution that fr_laz posted is correct. Until you change your netmask to 255.255.255.0, the linux tcp/ip stack is NOT going to allow you to add a defualt route which is outside the host address range for the network address. Why the Micosoft stack does is anyones guess. You would think Microsoft would perform some sort of sanity check when you hit the OK button. <groan!>
Hey guys, thanks for all your help. It's working fine now. I figured, "If my router (192.168.0.1) is outside my subnet (255.255.255.224), why not change my subnet to include it? So on my laptop I ran
ifconfig eth0 192.168.0.71 subnet 255.255.255.0 <--- note the changed subnet
and it worked just fine. I'm still confused as to why the the sysadmin configured the subnet with the 224, but oh well. My laptop works now and that's all that matters.
For future reference - most, if not all linux distro's include a command called "ipcalc" (which I should have used before I posted my previous reply. I incorrectly stated the broadcast address). Anyway, given an IP/netmask combination...
...the host addressable range (including the default route) should fall between the two. The default route is "usually" the lower or upper end of the host address range. i.e.
Distribution: Just about anything... so long as it is Debain based.
Posts: 297
Rep:
I've set-up networks like this previously. The reason I did it was to provide an incorrect default gw to disallow internet acccess to users that should not have Internet connection. On these networks, we used a proxy server for internet access and there was no "Default Gateway" that allowed for direct internet access.
It was simply a way of confusing those who did not know how our network worked. Those who tired to figure it out were quickly detected by our IDS and dealt with.
In all, it was an effective method of controlling the network.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.