1 |
On Monday 26 November 2007, Dan Farrell wrote: |
2 |
|
3 |
> you don't have to list the broadcast or netmask, if they can be |
4 |
> guessed from context. In the case of using a 192.168.x/24 network |
5 |
> they can generally both be guessed properly, because that's a Class C |
6 |
> private address . |
7 |
> |
8 |
> However, in the case of 10.0.0/24, this may not be true. that is |
9 |
> defined as class A private address space, and the networking utilities |
10 |
> would probably assume it was 10.0.0/8, a netmask of 255.0.0.0 and a |
11 |
> broadcast of 10.255.255.255. That is what ifconfig does at least: |
12 |
> |
13 |
> pascal ~ # ifconfig eth0:1 10.0.0.1 |
14 |
> pascal ~ # ifconfig eth0:1 |
15 |
> eth0:1 Link encap:Ethernet HWaddr 00:50:70:56:2E:CA |
16 |
> inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0 |
17 |
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 |
18 |
> Interrupt:225 Base address:0xc000 |
19 |
|
20 |
That is what ifconfig does, if you don't specify a netmask: |
21 |
|
22 |
[root@mozart /x]# ifconfig eth0:1 10.0.0.1 netmask 255.255.255.0 |
23 |
[root@mozart /x]# ifconfig eth0:1 |
24 |
eth0:1 Link encap:Ethernet HWaddr 00:11:2F:BB:F6:0D |
25 |
inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0 |
26 |
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 |
27 |
Interrupt:17 |
28 |
|
29 |
|
30 |
I don't know exactly how initscripts work, but I suppose that if the /24 |
31 |
is given in /etc/conf.d/net, then both the resulting iproute2 and |
32 |
ifconfig command that bring the interface up will include the netmask |
33 |
specification. |
34 |
-- |
35 |
gentoo-user@g.o mailing list |