Neal Murphy wrote: > On Wednesday 21 July 2010 11:46:07 Dan McGhee wrote: >> On 07/21/2010 09:49 AM, Bruce Dubbs wrote: >>> Dan McGhee wrote: >>>> On 07/19/2010 03:44 PM, Bruce Dubbs wrote: >>>>> This is all discussed at 7.13. Configuring the network Script. >>>>> >>>>> A dhcp server does not interfere with a static ip address unless you >>>>> assign a static ip address *and* the dhcp server assigns the same >>>>> address. Usually the dhcp server will have a range of addresses it >>>>> manages, say 192.168.1.10 - say 192.168.1.200. If the netmask os >>>>> 255.255.255.0 (the default for 192.168.x.x), just make sure you *do* >>>>> use an address in the block (192.168.1.x in this case) and *do not* use >>>>> for x the network address 0, broadcast address 255, router address 1, >>>>> or other statically assigned addresses. >>> The numbers you use are critical. The form will get you up, but you >>> have to use addresses that are right for your ISP or home network. >> I dug out my router book and learned that without changing anything the >> first address it assigns to computers on my network is 192.168.1.100 in >> the range 100-253. I can get the other 98, it reserves 1, by using the >> on-line utility. So here is what is in my "ifconfig-wlan0/ipv4" file: >> >> ONBOOT=yes >> SERVICE=ipv4-static >> IP=192.168.1.100
Use 192.168.1.100 since dhcp want to use 100+ >> GATEWAY=192.168.1.1 >> PREFIX=28 Use 24 because that's what your router has. >> BROADCAST=192.168.1.255 >> >> I added 192.168.1.1 to /etc/resolv.conf >> >> I've been reading and just made these changes. Haven't tested them yet. >> >> My biggest conceptual error was that I thought all the static stuff got >> used only with an ISP and their stuff is all on the router. I've only a >> fuzzy understanding of terms like GATEWAY, NETMASK, BROADCAST. These are >> the things, and the ranges of numbers they use, I need to read up on. >> For example, I think my setup will work now, but if anything stops me it >> will be BROADCAST. At least that's what my guts are telling me. > > If PREFIX is the number of bits in the 'network' part of the address, then it > probably should be '24', which is how most routers are conig'ed by default. > Also, if your router starts addressing at .100, you don't want to use that > address statically; try '.99'. > > In a nutshell: > > BROADCAST: the highest possible address on the LAN. Correct, but incomplete. See below. > NETMASK: the contiguous set of bits, left-to-right, that determine the > network > address of a LAN. The remaining bits, when combined with the network address, > comprise the host address. Modern CIDR addresses make this a little easier to > grok. > > GATEWAY: a 'door' to a network of unknown topology. You have your LAN and you > know how to reach everything on it. You have access to the internet, yet you > don't know how reach any particular node on it. But you don't *need* to know; > you simply send your packets to the gateway, because it knows how to reach > the rest of the internet. It would be the same if you had a second router on > your LAN separating your LAN from three other LANs in your house. That second > router would be the gateway to those other LANs; it would receive packets > destined for those other LANs. Your internet router is still the *default* > gateway: the router that gets all packets your computer doesn't know where to > send (has no route to the destination). Test in the following order: #Test the inteface ping 127.0.0.1 #Test the local IP assignment ping 192.168.1.99 (Or whatever you set above) #Test that you cna get to the router ping 192.168.1.1 #Test that your resolver works ping -c1 www.linuxfromscratch.org Networking 101 An IPv4 address is a 32-bit word. It is represented to users as four bytes, each in decimal notation separated by dots. That is, 1.1.1.1 is really 00000001000000010000000100000001 in binary. The system devides this address into two parts, network and host. This is done with the prefix or the netmask. It is a 32-bit word where each leading bit up to the prefex length is 1. Therefore we have PREFIX=24 = 11111111 11111111 11111111 00000000 = 255.255.255.0 The computer does a logical AND with an IP address and the netmask to separate the network and host parts. 192.168.0.99 is thus 11000000.10101000.00000001.01100011 IP = 192.168. 1.0 11111111 11111111 11111111 00000000 MASK = 255.255.255.0 11000000.10101000.00000001.00000000 NETWORK = 192.168. 1.0 To send a packet, the computer consults the routing table: $ /sbin/route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0 It does an AND with the IP address and the Genmask. If that matches the Destination, it sends the message at the link level directly to the other machine. Note that for router, we send the package directly to that system. If we have another address, say 216.171.237.234, the network, is not in the routing table and the package is sent to the gateway: 192.168.0.1. Note that the last line always matches: 216.171.237.234 linuxfromscratch.org 0. 0. 0. 0 AND Genmask 216.171.237.234 Result -> use 192.168.0.1 The router (gateway) sends the packet to the next system in the chain until the destination is on the local network and then the packet is sent directly to the destination system. Never assign a network address as an IP address. For a /24 network, that means don't use a 0 as the last octet. Also never assign a broadcast address to a system. The broadcast address is special and is the case when the host part of the IP address is all ones. In the case of a /24 network, it is 255. Generally the broadcast address is used on a network for an ARP (address resolution protocol) package at the link level. It is sent out to ask "Who owns IP address x.x.x.x". The system who owns that responds "I do and here is my MAC (Media Access Control) address". The MAC 48-bit MAC address is supposed to be unique for every device on the network. At the hardware level, the MAC address is the only address recognized. $ /sbin/ifconfig eth0 Link encap:Ethernet HWaddr 00:11:11:79:4D:17 inet addr:192.168.0.75 Bcast:192.168.0.255 Mask:255.255.255.0 The HWaddr (in hex) is the MAC address. That's the basics. It can get more complex, but in general, the principles are the same. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-support FAQ: http://www.linuxfromscratch.org/lfs/faq.html Unsubscribe: See the above information page