public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] static IP, gateway and netmask setting
@ 2007-11-23 15:20 Rafael Barrera Oro
  2007-11-23 16:02 ` Alberto Avi
  2007-11-23 23:55 ` [gentoo-user] " reader
  0 siblings, 2 replies; 10+ messages in thread
From: Rafael Barrera Oro @ 2007-11-23 15:20 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

Hello, i intend to do a basic static network set up. My goal is to set up
the following:

ip:            10.0.0.1
netmask:  255.255.255.0
gateway:  10.0.0.2

guiding myself with the gentoo handbook i clumsily edited the
/etc/conf.d/net file leaving it like this

config_eth0=( "10.0.0.1 netmask 255.255.255.0 brd 10.0.0.255" )
routes_eth0=( "default via 10.0.0.2" )

i have to admit i totally guessed the 10.0.0.255 value

should this work?
are all the values listed here correct and/or necessary?

thanks in advance people, as usual, your help is very appreciated

take care

Rafael

[-- Attachment #2: Type: text/html, Size: 986 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-user] static IP, gateway and netmask setting
  2007-11-23 15:20 [gentoo-user] static IP, gateway and netmask setting Rafael Barrera Oro
@ 2007-11-23 16:02 ` Alberto Avi
  2007-11-23 16:18   ` Rafael Barrera Oro
  2007-11-23 23:55 ` [gentoo-user] " reader
  1 sibling, 1 reply; 10+ messages in thread
From: Alberto Avi @ 2007-11-23 16:02 UTC (permalink / raw
  To: gentoo-user

> i have to admit i totally guessed the
> 10.0.0.255 value

Hi Rafael,

ipcalc is you friend !

alberto@nabas ~ $ ipcalc 10.0.0.1/255.255.255.0

Address:   10.0.0.1             00001010.00000000.00000000. 00000001
Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
=>
Network:   10.0.0.0/24          00001010.00000000.00000000. 00000000
HostMin:   10.0.0.1             00001010.00000000.00000000. 00000001
HostMax:   10.0.0.254           00001010.00000000.00000000. 11111110
Broadcast: 10.0.0.255           00001010.00000000.00000000. 11111111
Hosts/Net: 254                   Class A, Private Internet
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-user] static IP, gateway and netmask setting
  2007-11-23 16:02 ` Alberto Avi
@ 2007-11-23 16:18   ` Rafael Barrera Oro
  0 siblings, 0 replies; 10+ messages in thread
From: Rafael Barrera Oro @ 2007-11-23 16:18 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 857 bytes --]

thanks very much! ill give it a try

2007/11/23, Alberto Avi <alberto.avi@gmail.com>:
>
> > i have to admit i totally guessed the
> > 10.0.0.255 value
>
> Hi Rafael,
>
> ipcalc is you friend !
>
> alberto@nabas ~ $ ipcalc 10.0.0.1/255.255.255.0
>
> Address:   10.0.0.1             00001010.00000000.00000000. 00000001
> Netmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000
> Wildcard:  0.0.0.255            00000000.00000000.00000000. 11111111
> =>
> Network:   10.0.0.0/24          00001010.00000000.00000000. 00000000
> HostMin:   10.0.0.1             00001010.00000000.00000000. 00000001
> HostMax:   10.0.0.254           00001010.00000000.00000000. 11111110
> Broadcast: 10.0.0.255           00001010.00000000.00000000. 11111111
> Hosts/Net: 254                   Class A, Private Internet
> --
> gentoo-user@gentoo.org mailing list
>
>

[-- Attachment #2: Type: text/html, Size: 1972 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [gentoo-user]  Re: static IP, gateway and netmask setting
  2007-11-23 15:20 [gentoo-user] static IP, gateway and netmask setting Rafael Barrera Oro
  2007-11-23 16:02 ` Alberto Avi
@ 2007-11-23 23:55 ` reader
  2007-11-26 18:10   ` Dan Farrell
  1 sibling, 1 reply; 10+ messages in thread
From: reader @ 2007-11-23 23:55 UTC (permalink / raw
  To: gentoo-user

"Rafael Barrera Oro" <borafael@gmail.com> writes:

> i have to admit i totally guessed the 10.0.0.255 value
>
> should this work?
> are all the values listed here correct and/or necessary?

You won't need to stipulate brdcast address in my own experience.
I'm not sure you even need to list the netmask  but I always do.
I've never listed broadcast address and have'nt had any problems.

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-user]  Re: static IP, gateway and netmask setting
  2007-11-23 23:55 ` [gentoo-user] " reader
@ 2007-11-26 18:10   ` Dan Farrell
  2007-11-28  9:18     ` Etaoin Shrdlu
  0 siblings, 1 reply; 10+ messages in thread
From: Dan Farrell @ 2007-11-26 18:10 UTC (permalink / raw
  To: gentoo-user

On Fri, 23 Nov 2007 17:55:39 -0600
reader@newsguy.com wrote:

> You won't need to stipulate brdcast address in my own experience.
> I'm not sure you even need to list the netmask  but I always do.
> I've never listed broadcast address and have'nt had any problems.

you don't have to list the broadcast or netmask, if they can be guessed
from context.  In the case of using a 192.168.x/24 network they can
generally both be guessed properly, because that's a Class C private
address . 

However, in the case of 10.0.0/24, this may not be true.  that is
defined as class A private address space, and the networking utilities
would probably assume it was 10.0.0/8, a netmask of 255.0.0.0 and a
broadcast of 10.255.255.255.  That is what ifconfig does at least:

pascal ~ # ifconfig eth0:1 10.0.0.1
pascal ~ # ifconfig eth0:1
eth0:1    Link encap:Ethernet  HWaddr 00:50:70:56:2E:CA  
          inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:225 Base address:0xc000 

ifconfig is probably being used to configure your interfaces, unless
you switched to iproute2.  
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-user]  Re: static IP, gateway and netmask setting
  2007-11-26 18:10   ` Dan Farrell
@ 2007-11-28  9:18     ` Etaoin Shrdlu
  2007-11-28 18:58       ` Dan Farrell
  0 siblings, 1 reply; 10+ messages in thread
From: Etaoin Shrdlu @ 2007-11-28  9:18 UTC (permalink / raw
  To: gentoo-user

On Monday 26 November 2007, Dan Farrell wrote:

> you don't have to list the broadcast or netmask, if they can be
> guessed from context.  In the case of using a 192.168.x/24 network
> they can generally both be guessed properly, because that's a Class C
> private address .
>
> However, in the case of 10.0.0/24, this may not be true.  that is
> defined as class A private address space, and the networking utilities
> would probably assume it was 10.0.0/8, a netmask of 255.0.0.0 and a
> broadcast of 10.255.255.255.  That is what ifconfig does at least:
>
> pascal ~ # ifconfig eth0:1 10.0.0.1
> pascal ~ # ifconfig eth0:1
> eth0:1    Link encap:Ethernet  HWaddr 00:50:70:56:2E:CA
>           inet addr:10.0.0.1  Bcast:10.255.255.255  Mask:255.0.0.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           Interrupt:225 Base address:0xc000

That is what ifconfig does, if you don't specify a netmask:

[root@mozart /x]# ifconfig eth0:1 10.0.0.1 netmask 255.255.255.0
[root@mozart /x]# ifconfig eth0:1
eth0:1    Link encap:Ethernet  HWaddr 00:11:2F:BB:F6:0D
          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:17


I don't know exactly how initscripts work, but I suppose that if the /24 
is given in /etc/conf.d/net, then both the resulting iproute2 and 
ifconfig command that bring the interface up will include the netmask 
specification.
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-user]  Re: static IP, gateway and netmask setting
  2007-11-28  9:18     ` Etaoin Shrdlu
@ 2007-11-28 18:58       ` Dan Farrell
  2007-11-28 19:11         ` Rafael Barrera Oro
  2007-11-28 20:56         ` Etaoin Shrdlu
  0 siblings, 2 replies; 10+ messages in thread
From: Dan Farrell @ 2007-11-28 18:58 UTC (permalink / raw
  To: gentoo-user

On Wed, 28 Nov 2007 10:18:05 +0100
Etaoin Shrdlu <shrdlu@unlimitedmail.org> wrote:

> I don't know exactly how initscripts work, but I suppose that if
> the /24 is given in /etc/conf.d/net, then both the resulting iproute2
> and ifconfig command that bring the interface up will include the
> netmask specification.

How the net init script works (there's really only one, generally net.*
is linked to net.lo for update simplicity) is configured
in /etc/conf.d/net.  /etc/conf.d/net.example holds examples for just
about every imaginable configuration, but from my net, iproute2 looks
something like:

modules=("iproute2");
config_eth0=( "192.168.1.87/24 brd 192.168.1.255");
routes_eth0=( "default via 192.168.1.1" );
config_eth1=( "192.168.1.88/24 brd 192.168.1.255" );

but as you can see, that still doesn't set up a netmask but uses the
default.  I agree that in both cases the default would be /8 for a
10.xxx network, but as you can see the config syntax is different for
iproute2 and ifconfig.  
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-user] Re: static IP, gateway and netmask setting
  2007-11-28 18:58       ` Dan Farrell
@ 2007-11-28 19:11         ` Rafael Barrera Oro
  2007-11-28 20:56         ` Etaoin Shrdlu
  1 sibling, 0 replies; 10+ messages in thread
From: Rafael Barrera Oro @ 2007-11-28 19:11 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

Indeed, setting the ip, gateway, and netmask was enough to make it work in
my case.

Thanks to all for your replies.

2007/11/28, Dan Farrell <dan@spore.ath.cx>:
>
> On Wed, 28 Nov 2007 10:18:05 +0100
> Etaoin Shrdlu <shrdlu@unlimitedmail.org> wrote:
>
> > I don't know exactly how initscripts work, but I suppose that if
> > the /24 is given in /etc/conf.d/net, then both the resulting iproute2
> > and ifconfig command that bring the interface up will include the
> > netmask specification.
>
> How the net init script works (there's really only one, generally net.*
> is linked to net.lo for update simplicity) is configured
> in /etc/conf.d/net.  /etc/conf.d/net.example holds examples for just
> about every imaginable configuration, but from my net, iproute2 looks
> something like:
>
> modules=("iproute2");
> config_eth0=( "192.168.1.87/24 brd 192.168.1.255");
> routes_eth0=( "default via 192.168.1.1" );
> config_eth1=( "192.168.1.88/24 brd 192.168.1.255" );
>
> but as you can see, that still doesn't set up a netmask but uses the
> default.  I agree that in both cases the default would be /8 for a
> 10.xxx network, but as you can see the config syntax is different for
> iproute2 and ifconfig.
> --
> gentoo-user@gentoo.org mailing list
>
>

[-- Attachment #2: Type: text/html, Size: 1892 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-user]  Re: static IP, gateway and netmask setting
  2007-11-28 18:58       ` Dan Farrell
  2007-11-28 19:11         ` Rafael Barrera Oro
@ 2007-11-28 20:56         ` Etaoin Shrdlu
  2007-11-29 18:55           ` Dan Farrell
  1 sibling, 1 reply; 10+ messages in thread
From: Etaoin Shrdlu @ 2007-11-28 20:56 UTC (permalink / raw
  To: gentoo-user

On Wednesday 28 November 2007, Dan Farrell wrote:

> How the net init script works (there's really only one, generally
> net.* is linked to net.lo for update simplicity)

That script only calls functions defined elsewhere. The hard (and 
module-dependent) work is done by the files located 
in /lib/rcscripts/net. In particular, /lib/rcscripts/net/iproute2.sh 
and /lib/rcscripts/net/ifconfig.sh define all the various *_up(), 
*_down(), *_add_address(), etc. functions that are invoked by net.lo.
 
> /etc/conf.d/net.example holds examples for just 
> about every imaginable configuration, but from my net, iproute2 looks
> something like:
>
> modules=("iproute2");
> config_eth0=( "192.168.1.87/24 brd 192.168.1.255");
> routes_eth0=( "default via 192.168.1.1" );
> config_eth1=( "192.168.1.88/24 brd 192.168.1.255" );
>
> but as you can see, that still doesn't set up a netmask but uses the
> default.  

What I see is that you are explicitly specifying the netmask. The /24 in 
your lines specifies the netmask. Even if you didn't, in your case 
things would probably still work, because iproute2 would probably use a 
class C netmask, which is also /24. But nonetheless you are not 
using "the default" (whatever this means), but are instead explicitly 
specifying a netmask.

> I agree that in both cases the default would be /8 for a 
> 10.xxx network, but as you can see the config syntax is different for
> iproute2 and ifconfig.

As I understand it, the syntax is exactly the same. What is different are 
the commands that are run behind the scenes to configure the interfaces, 
and these depend on the module you choose (iproute2 or ifconfig). In 
other words, if you substituted modules=("iproute2") with 
modules=("ifconfig") in your etc/conf.d/net, everything would still work 
as expected.
The lack of a netmask specification will result in the tool used for the 
configuration (ifconfig or iproute2) doing whatever is appropriate for 
it: usually, this would just mean "use the default classful netmask",
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gentoo-user]  Re: static IP, gateway and netmask setting
  2007-11-28 20:56         ` Etaoin Shrdlu
@ 2007-11-29 18:55           ` Dan Farrell
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Farrell @ 2007-11-29 18:55 UTC (permalink / raw
  To: gentoo-user

On Wed, 28 Nov 2007 21:56:14 +0100
Etaoin Shrdlu <shrdlu@unlimitedmail.org> wrote:

> On Wednesday 28 November 2007, Dan Farrell wrote:
> 
> > How the net init script works (there's really only one, generally
> > net.* is linked to net.lo for update simplicity)
> 
> That script only calls functions defined elsewhere. The hard (and 
> module-dependent) work is done by the files located 
> in /lib/rcscripts/net. In particular, /lib/rcscripts/net/iproute2.sh 
> and /lib/rcscripts/net/ifconfig.sh define all the various *_up(), 
> *_down(), *_add_address(), etc. functions that are invoked by net.lo.

interesting tidbit.  

> > /etc/conf.d/net.example holds examples for just 
> > about every imaginable configuration, but from my net, iproute2
> > looks something like:
> >
> > modules=("iproute2");
> > config_eth0=( "192.168.1.87/24 brd 192.168.1.255");
> > routes_eth0=( "default via 192.168.1.1" );
> > config_eth1=( "192.168.1.88/24 brd 192.168.1.255" );
> >
> > but as you can see, that still doesn't set up a netmask but uses the
> > default.  
> 
> What I see is that you are explicitly specifying the netmask. The /24
> in your lines specifies the netmask. Even if you didn't, in your case 
> things would probably still work, because iproute2 would probably use
> a class C netmask, which is also /24. But nonetheless you are not 
> using "the default" (whatever this means), but are instead explicitly 
> specifying a netmask.

good point.  i seem to have overlooked the /24 part of my
configuration.  

> > I agree that in both cases the default would be /8 for a 
> > 10.xxx network, but as you can see the config syntax is different
> > for iproute2 and ifconfig.
> 
> As I understand it, the syntax is exactly the same. What is different
> are the commands that are run behind the scenes to configure the
> interfaces, and these depend on the module you choose (iproute2 or
> ifconfig). In other words, if you substituted modules=("iproute2")
> with modules=("ifconfig") in your etc/conf.d/net, everything would
> still work as expected.
> The lack of a netmask specification will result in the tool used for
> the configuration (ifconfig or iproute2) doing whatever is
> appropriate for it: usually, this would just mean "use the default
> classful netmask",
yeah, I guess you're right.  I for some reason thought the syntax was
different, but upon examining net.example I see that I was mistaken.  
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-11-29 19:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-23 15:20 [gentoo-user] static IP, gateway and netmask setting Rafael Barrera Oro
2007-11-23 16:02 ` Alberto Avi
2007-11-23 16:18   ` Rafael Barrera Oro
2007-11-23 23:55 ` [gentoo-user] " reader
2007-11-26 18:10   ` Dan Farrell
2007-11-28  9:18     ` Etaoin Shrdlu
2007-11-28 18:58       ` Dan Farrell
2007-11-28 19:11         ` Rafael Barrera Oro
2007-11-28 20:56         ` Etaoin Shrdlu
2007-11-29 18:55           ` Dan Farrell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox