Networking Forums

Networking Forums > Computer Networking > Linux Networking > ifconfig

Reply
 
 
Weilin Gong
Guest
Posts: n/a

 
      05-19-2004, 08:34 PM
Hi,

I issued ifconfig command as the following:

ifconfig eth2 10.6.2.1 netmask 255.255.255.0

got the output as:

eth2 Link encap:Ethernet HWaddr 00:80:F9:7C:03:BB
inet addr:10.6.2.1 Bcast:10.255.255.255 Mask:255.255.255.0
inet6 addr: fe80::280:f9ff:fe7c:3bb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:920 (920.0 b)
Interrupt:34

I expected the Bcast would be set as 10.6.2.255, but got 10.255.255.255
instead.

Anyone knows what happened?

Thanks,
WG

 
Reply With Quote
 
 
 
 
Ken
Guest
Posts: n/a

 
      05-20-2004, 03:09 AM
Hi -

On Wed, 19 May 2004 15:34:17 -0500, Weilin Gong <(E-Mail Removed)>
wrote:

>I expected the Bcast would be set as 10.6.2.255, but got 10.255.255.255
>instead.


ifconfig likes to set the broadcast on the basis of the pre-CIDR
networking:
if the first octet is 1 to 127, the netmask is 255.0.0.0
if the first octet is 128 to 191, the netmask is 255.255.0.0
if the first octet is 192 to 223, the netmask is 255.255.255.0

Just explicitly specify the broadcast address as part of the command.

--
Ken
http://www.ke9nr.net/
 
Reply With Quote
 
moo
Guest
Posts: n/a

 
      05-20-2004, 03:28 AM
On Wed, 19 May 2004 15:34:17 -0500, Weilin Gong wrote:

> Hi,
>
> I issued ifconfig command as the following:
>
> ifconfig eth2 10.6.2.1 netmask 255.255.255.0
>
> got the output as:
>
> eth2 Link encap:Ethernet HWaddr 00:80:F9:7C:03:BB
> inet addr:10.6.2.1 Bcast:10.255.255.255 Mask:255.255.255.0
> inet6 addr: fe80::280:f9ff:fe7c:3bb/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:0 (0.0 b) TX bytes:920 (920.0 b)
> Interrupt:34
>
> I expected the Bcast would be set as 10.6.2.255, but got 10.255.255.255
> instead.
>
> Anyone knows what happened?
>
> Thanks,
> WG


Hi,

I suspect that it is because the 10.x.x.x network is a class /8 network,
you may need to specify it like this:
ifconfig eth2 10.6.2.1/24 broadcast 10.0.0.255 up

I tried adding it as an alias on my card:
# ifconfig eth0:1 10.0.0.1/24 broadcast 10.0.0.255 up
# ifconfig eth0:1
eth0:1 Link encap:Ethernet HWaddr 00:50:EB:0B:2C:67
inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:11 Base address:0xcc00

hth
moo
--
http://www.lgw.co.nz
unmangle to email.

 
Reply With Quote
 
Weilin Gong
Guest
Posts: n/a

 
      05-20-2004, 05:01 AM
Thanks for the response.

I realize a specific broadcast address needs to be provided. However,
coming from Solaris/HP platforms, I would expect Linux should be able to
derive the broadcast address from the netmask as well.

For subneting, it's easier to just specify the netmask, without figuring
out the broadcast.


Ken wrote:
> Hi -
>
> On Wed, 19 May 2004 15:34:17 -0500, Weilin Gong <(E-Mail Removed)>
> wrote:
>
>
>>I expected the Bcast would be set as 10.6.2.255, but got 10.255.255.255
>>instead.

>
>
> ifconfig likes to set the broadcast on the basis of the pre-CIDR
> networking:
> if the first octet is 1 to 127, the netmask is 255.0.0.0
> if the first octet is 128 to 191, the netmask is 255.255.0.0
> if the first octet is 192 to 223, the netmask is 255.255.255.0
>
> Just explicitly specify the broadcast address as part of the command.
>


 
Reply With Quote
 
Ken
Guest
Posts: n/a

 
      05-21-2004, 02:35 AM
Hi Weilin -

On Wed, 19 May 2004 23:01:06 -0600, Weilin Gong <(E-Mail Removed)>
wrote:

>I realize a specific broadcast address needs to be provided. However,
>coming from Solaris/HP platforms, I would expect Linux should be able to
> derive the broadcast address from the netmask as well.


It should be able to, no question about that, but it doesn't, at least
with the version of GNU/Linux that I'm running. I start the interface
through a script so I just have the broadcast address as part of the
script.

--
Ken
http://www.ke9nr.net/
 
Reply With Quote
 
Cameron Kerr
Guest
Posts: n/a

 
      05-21-2004, 05:44 AM
As background for other readers...

There are four types of IPv4 "broadcast" addresses, of which only two
are often used as a broadcast address.

The first is the unconfigured, or all-0s address: 0.0.0.0. However, this
should never be seen as a destination IP address, even for broadcast.

The second is the all-subnets address (probably not it's real name), or
all-1s address: 255.255.255.255. This address should only be used when
the sending interface is in an unconfigured state (ie. DHCP).

The third is the network broadcast, and is deprecated. It's pretty much
equivalent to subnet broadcast addresses when the subnet mask is exactly
divisible by 8.

$ ipsc -a 10.0.0.0/8
Network class: A
Network mask: 255.0.0.0
Network address: 10.0.0.0
Full subnet mask: 255.0.0.0
Bit map: nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh

Note that I said /8, which is the same as 255.255.255.0. However, the
first three bits of a 10 network (10.x.x.x) are 00001010, which does not
indicate a Class A network (Class A network, which have a netmask of
255.0.0.0 used to be indicated by the first three bits being 001) But's
that is no longer the case.

$ ipsc -a 10.0.1.0/16
Network class: A
Network mask: 255.0.0.0
Network address: 10.0.0.0
Full subnet mask: 255.255.0.0
Bit map: nnnnnnnn.ssssssss.hhhhhhhh.hhhhhhhh

(Note the ss in the the bit map). In a subnet broadcast address, the
forth type of broadcast address, and the other common type), is one
where all the hs in the the above bitmap are 1, so 10.2.0.0/16 has
a subnet broadcast address (commonly called "broadcast address"). If we
take a slightly more advanced network, such as 10.42.182.40/30

ipsc 10.42.182.40/30
Network class: A
Network mask: 255.0.0.0
Network address: 10.42.182.40
Full subnet mask: 255.255.255.252
Addresses per subnet: 4
Bit map: nnnnnnnn.ssssssss.ssssssss.sssssshh

--
Cameron Kerr
(E-Mail Removed) : http://nzgeeks.org/cameron/
Empowered by Perl!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ifconfig output markus.grunwald@pruftechnik.com Linux Networking 6 03-27-2006 08:08 PM
Enhanced ifconfig, anyone? Thomas Carter Linux Networking 1 08-30-2005 06:40 PM
ifconfig errors Kevin Brown Linux Networking 3 03-28-2005 08:08 PM
2nd NIC ifconfig Fred Jones Linux Networking 4 05-29-2004 01:36 AM
ifconfig rx/tx counters Geoff Linux Networking 1 07-09-2003 12:31 PM



1 2 3 4 5 6 7 8 9 10 11