Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
binding /26 or so to an ether card... can I?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Thu Mar 06, 2003 2:04 am    Post subject: binding /26 or so to an ether card... can I? Reply with quote

I seem to recall that once upon a time I did this, but if it was under Solaris or Unix I can not recall.

I'm doing a web server and some IP based vhosts. eth0 will be the main IP of the machine, 10.20.40.20/22.

I'd like to add 10.20.40.64-127 as eth0:0... or I could put them all on eth0, really doesn't matter. I suppose I could specify them all as aliases, but I was hoping for a one liner type thing to drop in the config or stick in rc.local.

Has anyone managed to pull this off under Gentoo?

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
Chris W
l33t
l33t


Joined: 25 Jun 2002
Posts: 972
Location: Brisbane, Australia

PostPosted: Thu Mar 06, 2003 2:41 am    Post subject: Reply with quote

On Solaris you'd achieve this with:
Code:

# ifconfig hme0:1 plumb
# ifconfig hme0:1 10.20.40.65 netmask 255.255.255.192 broadcast 10.20.40.63 up


On Gentoo you have two options:
Code:

# cat rc.local
ifconfig eth0:0 10.20.40.65 netmask 255.255.255.192 broadcast 10.20.40.63 up

or you could add the new address, netmask, and broadcast address to /etc/conf.d/net in alias_eth0, netmask_eth0, and broadcast_eth0 respectively. The original address should still be set in iface_eth0. IMHO the second option is cleaner, keeps all the addresses in one place, and will have precisely the same result.
_________________
Cheers,
Chris W
"Common sense: The collection of prejudices acquired by age 18." -- Einstein
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Thu Mar 06, 2003 3:14 am    Post subject: Reply with quote

It's already "built in" to gentoo... look in your /etc/conf.d/net file =) (Hint: it's the aliases option)

I do this to firewall all of our public IP's. Router plugs straight into a Gentoo box that houses all the external IP's (/27) and forwards 'em to selected boxes on the internal network.
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Thu Mar 06, 2003 8:47 pm    Post subject: Reply with quote

splooge wrote:
It's already "built in" to gentoo... look in your /etc/conf.d/net file =) (Hint: it's the aliases option)

I do this to firewall all of our public IP's. Router plugs straight into a Gentoo box that houses all the external IP's (/27) and forwards 'em to selected boxes on the internal network.


Finally found a reference and it appears to be a redhat thing.

/etc/sysconfig/network-scripts/ifcfg-eth0-range0

IPADDR_START=10.20.40.64
IPADDR_END=10.20.40.127
NETMASK=255.255.252.0
CLONENUM_START=0 # start with sub interface 0

It is documented in 'ifup-aliases' under Redhat. Hmmm maybe I'll play with it and see how hard it would be to do the same on Gentoo.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
thumper
Guru
Guru


Joined: 06 Dec 2002
Posts: 554
Location: Venice FL

PostPosted: Mon May 05, 2003 10:34 pm    Post subject: Reply with quote

Quote:

Finally found a reference and it appears to be a redhat thing.

/etc/sysconfig/network-scripts/ifcfg-eth0-range0

IPADDR_START=10.20.40.64
IPADDR_END=10.20.40.127
NETMASK=255.255.252.0
CLONENUM_START=0 # start with sub interface 0


Before I dive in and rip up net.eth0 I was wondering if you got anywhere with it?

I've no desire to have 62 ip's on a line seperated by spaces if I could use a mask or defined ranges :)

George
Back to top
View user's profile Send private message
dice
Guru
Guru


Joined: 21 Apr 2002
Posts: 577

PostPosted: Mon May 05, 2003 11:19 pm    Post subject: Reply with quote

:twisted:

Code:
echo -n "alias_eth0=\"" >> /etc/conf.d/net
for a in `seq 64 127`; do
  echo -n "10.20.40.$a " >> /etc/conf.d/net;
done
echo "\"" >> /etc/conf.d/net
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Tue May 06, 2003 1:20 am    Post subject: Awesome =) Reply with quote

I misunderstood what Kashani wanted to do.

Good job there dice =)
_________________
http://get.a.clue.de
Back to top
View user's profile Send private message
thumper
Guru
Guru


Joined: 06 Dec 2002
Posts: 554
Location: Venice FL

PostPosted: Tue May 06, 2003 9:56 pm    Post subject: Reply with quote

dice, that is nice typing saver, but still a lot of IP's to look through when reviewing the file, I was thinking of something like alias_eth0="192.168.0.193:61"

where the ip before the colon was the beginning ip, and the number after the colon was the number if ip's to count up from the base ip. In the above example the last ip would be 192.168.0.254.

Then more than one range could be specified having different counts and base ip's.

And now that I think about it, it could be expanded to handle the netmask and broadcast addresses such as alias_eth0="192.168.0.193:61:255.255.255.0:192.168.0.255".

This is the approach I have decided to take, and the /etc/conf.d/net will still be easy to read and /etc/init.d/net.eth0 will do the parsing.

George
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum