Chip, I know nothing about the route command, but 0.0.0.0 is never a valid netmask. Do a little reading about netmask on Google for details.
Printable View
Chip, I know nothing about the route command, but 0.0.0.0 is never a valid netmask. Do a little reading about netmask on Google for details.
Harry, no netmask 255.255.255.0 is not working. It has to be 0.0.0.0 in order to make it work. I post my whole test steps below.Quote:
Originally Posted by Harry Kuhman
1. Boot knoppix 4.0.2 cd with cheat code: knoppix nodhcp
2. Open a console session
3. $sudo ifconfig eth0 192.168.1.90
4. $sudo route add -net gw 192.168.1.1 netmask 255.255.255.0 dev eth0
5. $sudo vi /etc/resolv.conf
(add the line: nameserver 192.168.1.1 and then save the file)
6. Try to go to www.yahoo.com (fails)
7. $sudo route add -net gw 192.168.1.1 netmask 0.0.0.0 dev eth0
8. $sudo route del -net gw 192.168.1.1 netmask 255.255.255.0 dev eth0
9. Now use the browser to go to www.yahoo.com (success)
Rgds,
Chip
Chip, something very very strange is going on here. I urge you to look up what netmask does. 0.0.0.0. is never a valid netmask, but if it was it would tell the router to never send traffic off the local lan. If you have any Windows systems on that network I suggest that you check their netmasks with ipconfig (open a DOS shell). Of course, we know that your router is already doing something strange, but this mask should break many things.Quote:
Originally Posted by chip.ling
Harry,Quote:
Originally Posted by Harry Kuhman
I think the netmask value here is for the gateway you try to reach to the outside world and if you set the value to 255.255.255.0, it will limit your address to your local network only. In my case, I want my machine being able to access all possible address on the internet so 0.0.0.0 make sense to me.
Please do a testing on your end by boot up a knoppix cd with DHCP mode on and after it boots up. Type the route command on the console and see if your result is same as mine.
Rgds,
Chip
As I said, I don't use the route command, so I'll want to do some reading and testing with it when I next get a chance. But all of my experience is that 0.0.0.0 is always a bad netmask. As to reaching the outside world, you local system should use the IP address that you are trying to reach and the netmask to determine if the gateway should be used or not. A netmask of 0.0.0.0 indicates that the address is always on the local LAN and so a gateway would never be used. I'm guessing that your somewhat unusual router is likely seeing the IP address as it comes into the switch and knows that it needs to be routed to the WAN port anyway, but things might break for you if your network grows to include additional switches unless this netmask issue is resolved. You may also have some problems the broadcast address and with Address Resolution Protocol with that netmask. And, in fact, this very well could give a clue as to why the same IP address is being handed out more than once! If ARP is broken due to a bad netmask then the routers tables may never be updated to reflect that the IP address is in use and not available for further use (although that still leaves a lot to be explained, like how it manages to route your traffic back to you).Quote:
Originally Posted by chip.ling
I will look at both the route command and it's man page when I have time, although to be honest I haven't even booted Knoppix lately. Again I would ask that you also take a little time and look up netmask on Google and see if you can find me any references that explain validly using 0.0.0.0 as a netmask.Quote:
Originally Posted by chip.ling
You might also want to use ethereal to sniff the network connection and see the ARP traffic that goes on every couple of minutes to see if your system is actually receiving and responding properly to ARP packets. I don't see how it could be with that netmask, since it would not recognize a broadcast as a broadcast, but would think it was a packet intended for someone else.
Neither do I. I just do a wild guess.Quote:
Originally Posted by Harry Kuhman
I think if you already have a knoppix machine up and running, you don't really need to do a reboot. Just open a console and type "route", it will show what your gateway netmask value.Quote:
Originally Posted by Harry Kuhman
Rgds,
Chip
Chip, I'm posting this from Debian so that I can cut and paste some info. I'm not using Knoppix, as I said I have not run Knoppix recently, but I believe that Knoppix and Debian will have the same results here. I am connecting by DHCP to a Dlink router.
I have never had any occasion to use route and am not clear why you are using it either. When I get my DHCP setup I get a netmask and other settings from the router. That info can be seen by looking at the output of ifconfig (only the portion that deals with eth0 is shown here):
Note that the netmask is what it should be for a normal private network using a 192.168 address and having at most 254 users (253 and the router).Code:k6:/home/harry# ifconfig
eth0 Link encap:Ethernet HWaddr 00:A0:CC:E8:48:D3
inet addr:192.168.0.103 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::2a0:ccff:fee8:48d3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6525 errors:0 dropped:0 overruns:0 frame:0
TX packets:2751 errors:1 dropped:0 overruns:0 carrier:2
collisions:0 txqueuelen:1000
RX bytes:7402966 (7.0 MiB) TX bytes:191431 (186.9 KiB)
Interrupt:10 Base address:0xe800
Note also that my router is handing out addresses in the 192.168.0.x range while yours is handing out addresses in the 192.168.1.x range. This is normal and I have even seen some routers that default to the 192.168.2.x range and you likely can set this to any third number that you want in your router setup. It is not a problem that we have different numbers here.
I read through the man documentation for route. I see there plenty of example with a netmask, but none that use a netmask of 0.0.0.0.
I couldn't see anything in the man pages to just get route to show me information, so I just tried the command route with no other input. It outputted this:
Note that there indeed is a 0.0.0.0 in this output, but it is called a genmask, not a netmask. If you Google the term genmask you will quickly find that the routing tables is using this as a mask differently than a normal netmask and that 0.0.0.0 is simply the general case default that the routing table uses if nothing more specific matches. So I guess this is why it is working for you, but I have no idea why you need to use the route command at all. I and most other people here using routers do not need to.Code:k6:/home/harry# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
I try to use static IP address for my Knoppix server instead of DHCP assign IP address to it. So I boot the knoppix with the cheat code: knoppix nodhcpQuote:
Originally Posted by Harry Kuhman
After the boot up, only the "lo" is set up with a value. The eth0 is not defined. No gateway defined.
I need to use the "ifconfig eth0 192.168.1.90" to set up the static IP address.
Then use the "route add -net default gw 192.168.1.1 netmask 0.0.0.0 dev eth0" to set up the default gateway to 192.168.1.1 and Genmask to 0.0.0.0 for device eth0.
The last step is to add an entry "nameserver 192.168.1.1" to the /etc/resolv.conf file, it is to define the DNS service.
Basically, it is a step by step setup the knoppix server address manually.
Yes, you are right. I double check on my "route" output. It is identical to yours. It shows Genmask instead of netmask.Quote:
Originally Posted by Harry Kuhman
But I think the confusion here is the "route" command itself, "netmask 0.0.0.0" in fact setup the genmask value and is not really a netmask setup.
Rgds,
Chip
Actually, I had thought that by doing static IP addresses on the other systems you were now able to use DHCP with Knoppix. But OK, lets assume that you want to boot with knoppix nodhcp for any reason.... After booting try this: run netcardconfig, either from the menu or from a shell. Say no to the first DHCP question (assuming that you still don't want to do a dhcp setup). Then answer the remaining questions, using 255.255.255.0 when asked for a netmask.Quote:
Originally Posted by chip.ling
After doing the above your ethernet connection should work, and it should be cleaner than using ifconfig and then route. No need for multiple commands (although you can use ifconfig after that if you just want to see the setings, but it is not needed).
I think I might run the Linux box as a server in the future that's why I try to use static addressing.Quote:
Originally Posted by Harry Kuhman
Yes, netcardconfig should work fine. But I try to avoid using the interactive command if possible. I think I might put all the setup commands in a script in the future to automate the process. I don't know much about the syntax of netcardconfig command, can I input all the parameters on the command line instead of the interactive mode?Quote:
Originally Posted by Harry Kuhman
I think one of the confusion here is that I don't use the full syntax of the ifconfig command in my case, I just go for the short cut and let the ifconfig command picks the default value of netmask, which is 255.255.255.0. But I can always use the full syntax of it like:
ifconfig eth0 192.168.1.90 netmask 255.255.255.0 broadcast 192.168.1.255
Well, I agree on your point that it is easier to use the netcardconfig. But I think the multiple steps I'm using help me to know more about what the what actually happening under the hood.Quote:
Originally Posted by Harry Kuhman
Rgds,
Chip