Adding an additional IP on a NIC getting DHCP address

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding an additional IP on a NIC getting DHCP address

bonne
The NIC hostname file contains:

dhcp

and it configures the nic with a DHCP address and configure mygate
according to this.

Now I need to add an additional static IP on top of this and use the static
IP address gateway address (thus not configuring myname from DHCP)

Can I just add inet x.x.x.x b.b.b.b to myname so that it reads:

dhcp
inet x.x.x.x b.b.b.b

and if so, how do I make sure that mygate does not get overwritten from
dhcp?

Regards, Lars.
Reply | Threaded
Open this post in threaded view
|

Re: Adding an additional IP on a NIC getting DHCP address

Theodore Wynnychenko-2
Hello

This is the first time I am responding to a post that is not my mine.  I hope it is not too uninformed.

Anyway, back in about October, 2016, I noticed that the included dhcp client would no longer assign an alias address alongside the address from the dhcp lease.  Before about this time, I seem to recall, it would.

My solution was to use the isc-dhcp-client from ports.  But, that also had some issues.

My solution (and if it is a poor solution, sorry) is on the mailing list at:

https://marc.info/?l=openbsd-misc <https://marc.info/?l=openbsd-misc&m=147638874608453&w=2> &m=147638874608453&w=2

It is working as expected through my last update of current, which was about 2 months ago.

Ted


> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Lars Bonnesen
> Sent: Friday, March 22, 2019 5:06 AM
> To: [hidden email]
> Subject: Adding an additional IP on a NIC getting DHCP address
>
> The NIC hostname file contains:
>
> dhcp
>
> and it configures the nic with a DHCP address and configure mygate
> according to this.
>
> Now I need to add an additional static IP on top of this and use the
> static
> IP address gateway address (thus not configuring myname from DHCP)
>
> Can I just add inet x.x.x.x b.b.b.b to myname so that it reads:
>
> dhcp
> inet x.x.x.x b.b.b.b
>
> and if so, how do I make sure that mygate does not get overwritten from
> dhcp?
>
> Regards, Lars.


Reply | Threaded
Open this post in threaded view
|

Re: Adding an additional IP on a NIC getting DHCP address

Stuart Henderson
On 2019-03-22, Theodore Wynnychenko <[hidden email]> wrote:

> This is the first time I am responding to a post that is not my mine.
> I hope it is not too uninformed.
>
> Anyway, back in about October, 2016, I noticed that the included dhcp
> client would no longer assign an alias address alongside the address
> from the dhcp lease. Before about this time, I seem to recall, it would.
>
> My solution was to use the isc-dhcp-client from ports. But, that also
> had some issues.
>
> My solution (and if it is a poor solution, sorry) is on the mailing list at:
>
> https://marc.info/?l=openbsd-misc&m=147638874608453&w=2
>
> It is working as expected through my last update of current, which was about 2 months ago.

That sounds reasonable.


>> -----Original Message-----
>> From: [hidden email] [mailto:[hidden email]] On Behalf Of Lars Bonnesen
...
>> and if so, how do I make sure that mygate does not get overwritten from
>> dhcp?

So this is a bit different to Theodore's setup as you want a static
gatewy. The simplest method is probably to allow dhclient to set the
0.0.0.0/0 default route itself, and add lines like these to hostname.if

!route add 0.0.0.0/1 $gw_address
!route add 128.0.0.0/1 $gw_address

That way dhclient can add and remove addresses as it wants and it
won't interfere with your real gateway. (Some of the tun-based VPN
clients use the same trick).


Reply | Threaded
Open this post in threaded view
|

Re: Adding an additional IP on a NIC getting DHCP address

Shane Lazarus
Hi Folks

Any reason you are not using the append / supercede options in the built in
dhclient.conf?
https://man.openbsd.org/dhclient.conf

Totally curious, as that is what I am using to override / append
information...


Thanks

Shane


On Sat, Mar 23, 2019 at 3:55 AM Stuart Henderson <[hidden email]>
wrote:

> On 2019-03-22, Theodore Wynnychenko <[hidden email]> wrote:
> > This is the first time I am responding to a post that is not my mine.
> > I hope it is not too uninformed.
> >
> > Anyway, back in about October, 2016, I noticed that the included dhcp
> > client would no longer assign an alias address alongside the address
> > from the dhcp lease. Before about this time, I seem to recall, it would.
> >
> > My solution was to use the isc-dhcp-client from ports. But, that also
> > had some issues.
> >
> > My solution (and if it is a poor solution, sorry) is on the mailing list
> at:
> >
> > https://marc.info/?l=openbsd-misc&m=147638874608453&w=2
> >
> > It is working as expected through my last update of current, which was
> about 2 months ago.
>
> That sounds reasonable.
>
>
> >> -----Original Message-----
> >> From: [hidden email] [mailto:[hidden email]] On Behalf
> Of Lars Bonnesen
> ...
> >> and if so, how do I make sure that mygate does not get overwritten from
> >> dhcp?
>
> So this is a bit different to Theodore's setup as you want a static
> gatewy. The simplest method is probably to allow dhclient to set the
> 0.0.0.0/0 default route itself, and add lines like these to hostname.if
>
> !route add 0.0.0.0/1 $gw_address
> !route add 128.0.0.0/1 $gw_address
>
> That way dhclient can add and remove addresses as it wants and it
> won't interfere with your real gateway. (Some of the tun-based VPN
> clients use the same trick).
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Adding an additional IP on a NIC getting DHCP address

Stuart Henderson
On 2019-03-22, Shane Lazarus <[hidden email]> wrote:
> Hi Folks
>
> Any reason you are not using the append / supercede options in the built in
> dhclient.conf?
> https://man.openbsd.org/dhclient.conf
>
> Totally curious, as that is what I am using to override / append
> information...

If you have a working setup with adding an alias IP address to the
interface as well as the address coming from DHCP, please do send it.


Reply | Threaded
Open this post in threaded view
|

Re: Adding an additional IP on a NIC getting DHCP address

Shane Lazarus
Hi Folks

Oddly enough I couldn't figure out a way to do that  :)

So I just did the following instead with hostname.de1:
dhcp
inet6 autoconf
!ifconfig de1 inet alias 192.168.2.28 255.255.255.0
!route add 128.0.0.0/1  192.168.2.254
up


Have Fun

Shane



On Sat, Mar 23, 2019 at 12:51 PM Stuart Henderson <[hidden email]>
wrote:

> On 2019-03-22, Shane Lazarus <[hidden email]> wrote:
> > Hi Folks
> >
> > Any reason you are not using the append / supercede options in the built
> in
> > dhclient.conf?
> > https://man.openbsd.org/dhclient.conf
> >
> > Totally curious, as that is what I am using to override / append
> > information...
>
> If you have a working setup with adding an alias IP address to the
> interface as well as the address coming from DHCP, please do send it.
>
>
>