Re: dhclient fallback lease declaration doesn't configure the interface

2014-04-27 Thread Alessandro DE LAURENZIS
On Sun 27/04, Kenneth R Westerback wrote:
> On Fri, Apr 25, 2014 at 12:31:16PM +0200, Alessandro DE LAURENZIS wrote:
> > On Tue 22/04, Kenneth Westerback wrote:
> > > >
> > > > Another thing: as highlighted in my initial message, I'm using the
> > > > loopback i/f as router address in the lease declaration section:
> > > >
> > > > # Lease declarations (fallback)
> > > > lease {
> > > > interface "trunk0";
> > > > fixed-address 192.168.1.103;
> > > > option subnet-mask 255.255.255.0;
> > > > option routers 127.0.0.1;
> > > > option domain-name-servers 127.0.0.1;
> > > > option dhcp-lease-time 259200;
> > > > renew  4 2020/12/31 23:59:59 UTC;
> > > > rebind 4 2020/12/31 23:59:59 UTC;
> > > > expire 4 2020/12/31 23:59:59 UTC;
> > > > }
> > > >
> > > > (this is the only way to make the router ping-able when trying to
> > > > configure a crossover cable connection between 2 PCs). Tomas Bodzar from
> > > > misc@ pointed me out it is in a different subnet w.r.t. the fixed 
> > > > address;
> > > > do you think it may be relevant?
> > > 
> > > Shouldn't be relevant for the dhclient part. Unless there is a check
> > > which I'm not aware of. But I'll look to make sure.
> > > 
> > >  Ken
> > > 
> > 
> 
> And now a version that doesn't loop after trying a static lease. :-)
> 
>  Ken
> 

Hello Ken,

Your last patch doesn't apply to 5.4-Stable as is, some hunks required a
bit of manual code modifications, but finally... it worked!

Now the i/f (both the physical eth and the virtual trunk) are correctly
configured after having acquired the fallback lease.

If you need to experiment with other modifications/adjustments, please
let me know.

Great achievement, in my opinion! Thanks a lot for your support,
kindness and patience.

Cheers

-- 
Alessandro DE LAURENZIS
[mailto:just22@gmail.com]
LinkedIn: http://it.linkedin.com/in/delaurenzis



Re: dhclient fallback lease declaration doesn't configure the interface

2014-04-21 Thread Tomas Bodzar
On Mon, Apr 21, 2014 at 4:29 PM, Alessandro DE LAURENZIS <
just22@gmail.com> wrote:

> Hello,
>
> 5.4-Rel here, GENERIC.MP kernel.
>
> Rather often I need to connect my laptop to networks without DHCP service
> (sometimes I use a direct connection through a crossover cable, too); so
> it would be nice to have a semi-automatic configuration procedure.
>
> I'm trying to exploit the dhclient's "lease declaration" feature; this
> is an excerpt of my /etc/dhclient.conf:
>
> # Lease declarations (fallback)
> lease {
> interface "trunk0";
> fixed-address 192.168.1.103;
> option subnet-mask 255.255.255.0;
> option routers 127.0.0.1;
> option domain-name-servers 127.0.0.1;
> option dhcp-lease-time 259200;
> renew  4 2020/12/31 23:59:59 UTC;
> rebind 4 2020/12/31 23:59:59 UTC;
> expire 4 2020/12/31 23:59:59 UTC;
> }
>
> (note that I used the loopback address for routers and
> domain-name-servers fields, in order to bound them to something
> "ping-able"). When I connect the Eth i/f to a DHCP-less network and
> restart the service, I obtain:
>
> just22@poseidon:[~]> sudo sh /etc/netstart trunk0
> [...]
> DHCPREQUEST on trunk0 to 255.255.255.255 port 67
> DHCPREQUEST on trunk0 to 255.255.255.255 port 67
> DHCPREQUEST on trunk0 to 255.255.255.255 port 67
> [...]
> No acceptable DHCPOFFERS received.
> Trying recorded lease 192.168.1.103
> bound: renewal in 128358 seconds.
>
> So it seems that the lease has been obtained as expected; unfortunately,
> the interface is still not configured:
>
> just22@poseidon:[~]> ifconfig trunk0
> trunk0: flags=8843 lladdr 00:21:86:94:34:8e
> priority: 0
> trunk: trunkproto failover
> trunkport iwn0
> trunkport em0 master,active
> groups: trunk egress
> media: Ethernet autoselect
> status: active
> inet6 fe80::221:86ff:fe94:348e%trunk0 prefixlen
>
> Am I doing anything wrong? Is this an expected behavior? Could you point
> me in the right direction?
>
> Thanks in advance for your time and patience
>
> --
> Alessandro DE LAURENZIS
> [mailto:just22@gmail.com]
> LinkedIn: http://it.linkedin.com/in/delaurenzis
>


>From man dhclient:

A mobile host which may sometimes need to access a network on which no
 DHCP server exists may be preloaded with a lease for a fixed address on
 that network.  When all attempts to contact a DHCP server have failed,
 *dhclient* will try to validate the static lease, and if it succeeds, it
 will use that lease until it is restarted.

 . First of all not good idea having router with 127. and your IP
192... Give them same subnet. Second can you try with real interface
directly to skip trunk (if there's not something wrong with trunk itself)?
Third try to enable debug for dhclient and network interface if it does
show something more. Did you try if your config is working directly defined
in interface file and what it shows during debug run?
http://www.openbsd.org/faq/faq6.html#Setup



dhclient fallback lease declaration doesn't configure the interface

2014-04-21 Thread Alessandro DE LAURENZIS
Hello,

5.4-Rel here, GENERIC.MP kernel.

Rather often I need to connect my laptop to networks without DHCP service
(sometimes I use a direct connection through a crossover cable, too); so
it would be nice to have a semi-automatic configuration procedure.

I'm trying to exploit the dhclient's "lease declaration" feature; this
is an excerpt of my /etc/dhclient.conf:

# Lease declarations (fallback)
lease {
interface "trunk0";
fixed-address 192.168.1.103;
option subnet-mask 255.255.255.0;
option routers 127.0.0.1;
option domain-name-servers 127.0.0.1;
option dhcp-lease-time 259200;
renew  4 2020/12/31 23:59:59 UTC;
rebind 4 2020/12/31 23:59:59 UTC;
expire 4 2020/12/31 23:59:59 UTC;
}

(note that I used the loopback address for routers and
domain-name-servers fields, in order to bound them to something
"ping-able"). When I connect the Eth i/f to a DHCP-less network and
restart the service, I obtain:

just22@poseidon:[~]> sudo sh /etc/netstart trunk0
[...]
DHCPREQUEST on trunk0 to 255.255.255.255 port 67
DHCPREQUEST on trunk0 to 255.255.255.255 port 67
DHCPREQUEST on trunk0 to 255.255.255.255 port 67
[...]
No acceptable DHCPOFFERS received.
Trying recorded lease 192.168.1.103
bound: renewal in 128358 seconds.

So it seems that the lease has been obtained as expected; unfortunately,
the interface is still not configured:

just22@poseidon:[~]> ifconfig trunk0
trunk0: flags=8843mailto:just22@gmail.com]
LinkedIn: http://it.linkedin.com/in/delaurenzis