Gentoo Archives: gentoo-user

From: Nilesh Govindarajan <contact@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: Network configuration - Two ips one from dhcp & other static
Date: Sat, 07 Jan 2012 08:27:25
Message-Id: 4F08017B.8020309@nileshgr.com
In Reply to: Re: [gentoo-user] Re: Network configuration - Two ips one from dhcp & other static by Pandu Poluan
1 On Sat 07 Jan 2012 01:53:18 PM IST, Pandu Poluan wrote:
2 >
3 > On Jan 7, 2012 3:13 PM, "Nilesh Govindarajan" <contact@××××××××.com
4 > <mailto:contact@××××××××.com>> wrote:
5 > >
6 > > On Sat 07 Jan 2012 01:27:45 PM IST, Nilesh Govindarajan wrote:
7 > > > Well, the title tells the question clearly; how do I configure network
8 > > > such that the first ip is obtained via dhcpcd and other is static?
9 > > > config_eth0="dhcp <static>" doesn't work.
10 > > >
11 > > > As a solution I wrote a dhcpcd hook containing /sbin/ifconfig eth0:0
12 > > > <ip> netmask <netmask>
13 > > >
14 > > > Is there a direct way?
15 > > >
16 > >
17 > > Yikes! It works now :O
18 > >
19 >
20 > AFAIK dhcpcd will remove all IP addresses on an interface (i.e., all
21 > addresses listed by 'ip addr sh dev eth0') before it sets the
22 > interface's address using the values provided by the DHCP server.
23 >
24 > Thus, your configuration will work only if dhcpcd receives an address
25 > soon enough before the static address(es) gets assigned.
26 >
27 > If the dynamic address assignment is delayed, then the static
28 > addresses will be removed by dhcpcd, resulting in just one address on
29 > the interface.
30 >
31 > Of course, this is pure conjecture on my part. If there's anyone more
32 > familiar with how addresses gets assigned in Gentoo, feel free to
33 > correct me.
34 >
35 > Rgds,
36 >
37
38 The hook was working. Before I discovered it myself that using with
39 config_eth0 it works. May be I was little sleepy or so when I tried the
40 first time. :/
41
42 --
43 Nilesh Govindarajan
44 http://nileshgr.com