[techtalk] network configuring

BobTFish bobtfish at freaks.screaming.net
Thu May 18 17:50:24 EST 2000


At 16:49 18/05/00, Deepa Karnad wrote:
>One basic question. How can an IP address be assigned to a host?
>Tried many ways including Lisa. Could not figure out.
>I understand that there should be some way of accomplishing this. How else 
>does a host know if the destination of a certain arrived packet is itself?

Erm, this isn't all that clear what you want to know but I will try..

I assume you are talking about IP over Ethernet.

Each station is given a unique IP address within it's network (more on this 
later) which it knows. When another host wants to send a packet to a host 
then it transmits an ARP (Address Resolution Protocol) query. This query is 
sent out on the ehernet to all stations (Etherenet address 
FF:FF:FF:FF:FF:FF IIRC) meaning that all stations see it. The station who 
has the IP address asked for replies with a broadcast packet (so everybody 
knows) saying I have IP x.x.x.x and my ethernet address is 
xx:xx:xx:xx:xx:xx. (Each Ethernet card has a unique (Ethernet) address BTW).

Hosts keep a cache of ARP entries (so that they don't have to make a query 
every time they send a packet). On linux you can view this in /proc/net/arp.

The way IP addresses are actually ASSIGNED is a different matter.. You have 
to ask the Internet Assigned Numbers Authority for a block of IP addresses 
- which they give you.. However if the network is not going to be Internet 
connected - or is through a masquerading gateway then you can pick any IP 
in the range 10.x.x.x or 192.168.x.x.

In Linux you actually give an IP address to a host at the same time you 
bring the interface up using the ifconfig command.

Eg:
ifconfig eth0 192.168.1.25 gw 192.168.1.1 mask 255.255.255.0 up

This looks a little confusing... But here we go: eth0 - First ethernet 
interface.
192.168.1.25 <- The actual IP address.
255.255.255.0 <- Netmask - this specifies what hosts you can actually 
contact on the local LAN without going through a gateway machine..
It is a bit mask that is ANDed with the IP address to see who is local thusly:
192.168.1.25   - 11000000.10101000.00000001.00011001
255.255.255.0 - 11111111.11111111.11111111.00000000
Gives:             - 11000000.10101000.00000001.00000000

Meaning that any IP addresses matching 192.168.1.don't care are local. Any 
other IP addresses get sent to the gaateway machine (192.168.1.1) which 
will automagically do the right thing with them..

Hope this helps.. Maybe I went for too much theory, but it's good for you ;)
BobTFish

P.S. If you want to know more about Ethernet I wrote an article about it 
for Napalm zine recently.. Issue 5. (napalm.firest0rm.org)






More information about the Techtalk mailing list