RE: Exact meaning of netmask for ifconfig ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
Hi,

First, an overview on "Netmask".

Every IP address has 2 parts. A "network" park and a "host" part. So the
total 32 bits of IP address are broken into "network" bits and "host" bits.
The NETMASK (network mask) parameter decides how many bits belong to the
network part, and how many to host part. The "1" bits in the netmask tell
that the corresponding bits in ANY IP address are to be treated as "network"
bits, the rest as host bits.

Every computer in a LAN / subnet HAS to have the same "network" part. The
host part may differ. For eg, if you decide to devote 16 bits to network
part, and you give the computer an IP address 122.122.122.122, then left
most 16 bits are network part. And hence the network address is
"122.122.0.0" (A network address has all host bits set to 0). This
represents the address of the NETWORK (subnet) as a whole (meaning THIS
network, instead of any particular PC).

Similarly, every network has a "Broadcast Address". If a computer sends a
packet addressed to the "broadcast address" of a network, then it will be
delievered to all the computers on the network. A broad cast address has all
the host bits set to 1. Hence for the above case, the broad cast address of
the network will be 122.122.255.255. 

The "Network Address" and "Broadcast addres" are reserved and you cannot
assign them to any computer in your network.. 

Your Case
============

I might be totally wrong, but here is my understanding.

You set the IP address 122.122.122.122. But setting the netmask to
255.255.255.255 is WRONG. This means there are all network bits and no host
bits. So essentially you are having a single host network (since no host
bits). 

Regards,

Rajat

-----Original Message-----
From: linux-net-owner@xxxxxxxxxxxxxxx
[mailto:linux-net-owner@xxxxxxxxxxxxxxx] On Behalf Of
david.balazic@xxxxxxxxx
Sent: Monday, January 31, 2005 6:47 PM
To: linux-net@xxxxxxxxxxxxxxx
Subject: Exact meaning of netmask for ifconfig ?

Hi! 

As I am configoring a rather unusual network setup, I must know the exact
meaning of the NETMASK (and BROADCAST) paramaters of the ifconfig command. 

Currently I use : 

ifconfig eth0 122.122.122.122 netmask 255.255.255.255 

(IP not real ) 

"ifconfig eth0" then prints, that eth0 has a broadcast address of
122.255.255.255, which does not look right. 

Later I set this routing : 

route add 10.49.1.1 dev eth0
route add default gw 10.49.1.1 

Will this work ? 

I am currently testing under knoppix 3.7 on a single PC, not in the real
target network. 

Background or "Why am I doing this" ? 

A PC will be conncted to an ADSL modem. It will have a PPPoE session to the
ISP. 
Two other PCs will be connected to the first PC. 
The ISP assigned two static IP adresses, that I want to set for the two PCs
( not the "router" PC ). 

Regards,
David Bala.ic 

-
: send the line "unsubscribe linux-net" in the
body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at
http://vger.kernel.org/majordomo-info.html
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux