Gentoo Archives: gentoo-server

From: Andy Dustman <farcepest@×××××.com>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] multiple IPs on loopback
Date: Wed, 03 May 2006 17:55:19
Message-Id: 9826f3800605031046i66810cb2v1e86e5b06e5399dd@mail.gmail.com
In Reply to: Re: [gentoo-server] multiple IPs on loopback by Josh Hunholz
1 That doesn't work, and the reason doing it like you would ethernet
2 aliases doesn't work is because the init script currently
3 short-circuits the normal configuration procedure when the interface
4 is lo. The way I eventually made this work was by adding a postup()
5 function to /etc/init.d/net:
6
7 postup() {
8 if [ "${IFACE}" = "eth0" ]; then
9 ifconfig lo:0 x.x.x.x netmask 255.255.255.255
10 fi
11 }
12
13 Due to the short-circuiting, you have to add the aliases when some
14 interface other than lo comes up; postup() and friends are not
15 executed for lo in the current baselayout.
16
17 Why do this at all? It's useful for virtual server transparent load
18 balancing schemes, i.e. the load balancer receives incoming packets
19 for the virtual server address, and then routes them to backend
20 servers without rewriting the packet headers. The backend servers put
21 the public virtual server address on the loopback device and the
22 service listens on that IP. Then the backend server replies go
23 directly to the client and do not have to be processed by the load
24 balancer since they already have the correct source address. An
25 example of this is shown here:
26
27 http://www.linuxvirtualserver.org/VS-DRouting.html
28
29 Note that baselayout-1.12.0_pre19_r1 (current ~x86 and maybe some
30 earlier) do not short-circuit lo behavior, i.e. you can do:
31
32 config_lo=("x.x.x.x/32")
33
34 and it will add x.x.x.x/32 as an alias on lo. The short-circuting
35 behavior applies to baselayout-1.11.14-r8 (current x86).
36
37 On 3/14/06, Josh Hunholz <jhunholz@×××××.com> wrote:
38 > Probably the easiest way is to make them aliases. So assign one to
39 > lo:1, lo:2, lo:3, etc.
40 >
41 > --Josh Hunholz
42 >
43 > On 3/14/06, Joe Rizzo <jrizzo@×××××××××.com> wrote:
44 > > I can not figure this out. How can I configure /etc/conf.d/net to
45 > > assign multiple IP addresses on the lo interface?
46 > >
47 > > cat /etc/conf.d/net
48 > > modules=( "iproute2" )
49 > >
50 > > config_eth0=(
51 > > "null"
52 > > )
53 > >
54 > > vlans_eth0="16"
55 > >
56 > > config_eth0_16=(
57 > > "10.8.16.74/24"
58 > > )
59 > >
60 > > routes_eth0_16=(
61 > > "0.0.0.0/0 via 10.8.16.1"
62 > > )
63 > >
64 > > config_lo=(
65 > > "10.8.16.75/32"
66 > > )
67 > >
68 > > Any help is appreciated -
69 > > Joe Rizzo
70 > >
71 > > --
72 > > gentoo-server@g.o mailing list
73 > >
74 > >
75 >
76 > --
77 > gentoo-server@g.o mailing list
78 >
79 >
80
81
82 --
83 The Pythonic Principle: Python works the way it does
84 because if it didn't, it wouldn't be Python.
85
86 --
87 gentoo-server@g.o mailing list