Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Feb 2003 01:13:10 +0100
From:      "C.Steiner" <C.Steiner@elch.ch>
To:        freebsd-questions@freebsd.org
Subject:   how to get two IPs from DHCP for one NIC
Message-ID:  <5.2.0.9.0.20030212003300.00a71e50@www.elch.ch>

next in thread | raw e-mail | index | archive | help
Hello !

There is the following problem concerning my gateway:
(FreeBSD dynsoft.ch 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Wed Oct  9 15:08:34 
GMT 2002     root@builder.freebsdmall.com:/usr/obj/usr/src/sys/GENERIC  i386)

I've got a rl0 (outer world) and a rl1 (LAN side) NIC setup as IPF/NAT 
gateway which is working.
(with an empty /etc/dhclient.conf file)
Here is my /etc/rc.conf file:

=========== rc.conf start ======
inetd_enable="NO"
sendmail_enable="NONE"
portmap_enable="NO"

gateway_enable="YES"
ipfilter_enable="YES"
ipnat_enable="YES"
ifconfig_rl0="DHCP"
ifconfig_rl1_alias0="inet 10.0.0.1 netmask 255.255.255.0"
hostname="dynsoft.ch"

kern_securelevel_enable="NO"
nfs_reserved_port_only="YES"
sshd_enable="YES"
usbd_enable="YES"
=========== rc.conf end======

I've also a /etc/dhclient-exit-hook script which updates DNS entries when 
IP is changing.
All of this is working well.

I've now tried (hard) to get a second IP (which I should be able to get) 
from DHCP,
configured to the same NIC (rl0).

To force dhclient to get a second (functional) lease I've added the 
following lines in dhclient.conf:
======== paste start ============
     interface "rl0" {
         script "/sbin/dhclient-script";
         send dhcp-client-identifier "dynsoft.ch";
         send host-name "dynsoft.ch";
     }
     pseudo "secondary" "rl0" {
         script "/sbin/dhclient-secondary";
         send dhcp-client-identifier "mysql.dynsoft.ch";
         send host-name "mysql.dynsoft.ch";
     }
======== paste end ============

like I've seen in the manpages, and on 
http://www.isc.org/ml-archives/dhcp-server/1999/06/msg00218.html

As you can see, I've setup a secondary dhclient-script, which is basicaly a 
copy of the original one
(/sbin/dhclient-script) with some debugging messages included.

After firing this thing up,
I ended up with only one IP bound to rl0, and in /var/db/dhclient.leases 
there were two leases,
one for the original interface, and one for the secondary, but both of them 
with the same (functional) IP,
and both of them with the same host-name !! :

=============== start of pasting ========================
lease {
   interface "rl0";
   name "secondary";
   fixed-address 217.162.228.227;
   option subnet-mask 255.255.252.0;
   option routers 217.162.228.1;
   option dhcp-lease-time 3107;
   option dhcp-message-type 5;
   option domain-name-servers 62.2.17.60,62.2.24.162,62.2.17.61,62.2.24.158;
   option dhcp-server-identifier 62.2.28.73;
   option broadcast-address 255.255.255.255;
   option host-name "x1-6-00-30-4f-1d-21-b1";
   renew 3 2003/2/12 01:17:50;
   rebind 3 2003/2/12 01:39:38;
   expire 3 2003/2/12 01:46:07;
}
lease {
   interface "rl0";
   fixed-address 217.162.228.227;
   option subnet-mask 255.255.252.0;
   option routers 217.162.228.1;
   option dhcp-lease-time 2790;
   option dhcp-message-type 5;
   option domain-name-servers 62.2.17.60,62.2.24.162,62.2.17.61,62.2.24.158;
   option dhcp-server-identifier 62.2.28.73;
   option broadcast-address 255.255.255.255;
   option host-name "x1-6-00-30-4f-1d-21-b1";
   renew 3 2003/2/12 01:17:38;
   rebind 3 2003/2/12 01:40:18;
   expire 3 2003/2/12 01:46:07;
}
=============== end of pasting ========================

I've tried to adapt that dhclient-secondary script, but It wasn' successfull.
I think that maybe the ISP DHCP Server checks the MAC address of my NIC,
and so I get the same IP again, when dhclient requests the second IP.

Has anybody a clue how to solve this ??

greetings from switzerland,	c.steiner@elch.ch


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.2.0.9.0.20030212003300.00a71e50>